Hi,

I am trying to get this model and admin declaration working:

#models.py

class SeoUrl(models.Model):
        seotitle = models.SlugField(max_length = 100)
        priority = models.PositiveIntegerField(blank=False, null=False)

        content_type = models.ForeignKey(ContentType)
        object_id = models.PositiveIntegerField()
        content_object = generic.GenericForeignKey('content_type',
'object_id')

class Content(models.Model):
        seo_urls = generic.GenericRelation(SeoUrl)
        def get_absolute_url(self):
                return ('/%s/' % self.seo_urls[0])

        class Meta:
                abstract = True

class Author(Content):
        firstname = models.CharField(max_length = 1000)
        lastname = models.CharField(max_length = 1000)


#admin.py

class SeoUrlInline(generic.GenericStackedInline):
        model = SeoUrl

class AuthorAdmin(admin.ModelAdmin):
        inlines = [ SeoUrlInline,]
        prepopulated_fields = {'seotitle':("firstname", "lastname",) } #This
line should pre-populate the first seo_url

I want the first inline of SeoUrl to be populated when the user types
something in to the firstname and lastname fields. The last line of
AuthorAdmin is the problem. It causes this error:

`AuthorAdmin.prepopulated_fields` refers to field `seotitle` that is
missing from model `Author`.

which is correct! Is there a way to make this possible? I know I could
resort to some jQuery and admin template modification, but was
wondering if the prepopulate_fields code has some awareness of the
eventual id's of inline form fields.

Cheers in advance,
Donovan.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to