Monday, September 2, 2013

quick question: RE model relations

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 admin
from django.db import models
from django.contrib.auth.models import User
from tinymce import models as tinymce_models
from galleryview.models import Gallery

active_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.

No comments:

Post a Comment