As per the current docs[0], you need to provide a dotted path to your model in the form app.ModelName when defining a ForeignKey.
So try this instead:
GalleryId = models.ForeignKey('galleryview.Gallery', verbose_name=_('Gallery Id'), related_name='Gallery_Id',blank=True, null=True, help_text=_("You can associate a photo gallery to this event here."))
If you don't mind me saying, 'galleryview' is a funny name for a django module, considering how we use the name 'view' for something else entirely.
Cheers,
On Mon, Sep 2, 2013 at 1:24 PM, Bobby Roberts <tchendrix@gmail.com> wrote:
I'm creating an event module and want people to be able to associate a picture gallery with the event:--from django.utils.translation import get_language, ugettext, ugettext_lazy as _from django.contrib import adminfrom django.db import modelsfrom django.contrib.auth.models import Userfrom tinymce import models as tinymce_modelsfrom galleryview.models import Galleryactive_choices=((1,"Yes"),(0,"No"),)class event (models.Model):id = models.AutoField (primary_key=True)active = models.IntegerField(blank=False, choices=active_choices)title = models.CharField(blank=False,max_length=150)startDate = models.DateTimeField (blank=False,db_index=True)endDate = models.DateTimeField (blank=False,db_index=True)blurb = models.TextField (blank=False, max_length=175,help_text="limit to a sentence, 175 chars.")message = models.TextField (blank=False, max_length=2000)GalleryId = models.ForeignKey('Gallery', verbose_name=_('Gallery Id'), related_name='Gallery_Id',blank=True, null=True, help_text=_("You can associate a photo gallery to this event here."))class eventAdmin(admin.ModelAdmin):list_display = ('startDate','endDate','title','active',)list_filter = ('startDate',)date_heiarchy = ['startDate','endDate']search_fields = ['title','blurb','message']admin.site.register(event,eventAdmin)
when i try to syncdb, i'm getting the following error:Error: One or more models did not validate:events.event: 'GalleryId' has a relation with model Gallery, which has either not been installed or is abstract.What am i doing wrong here?
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment