ModelForm in Generic Relations isn't display in the template

19 views
Skip to first unread message

carlos

unread,
Apr 7, 2012, 2:41:56 AM4/7/12
to django...@googlegroups.com
Hello, I have an unsolved mystery 
ok i have a generic model example

models.py

class ModelOne(models.Model):
     content_type = models.ForeignKey(ContentType)
    object_id = models.IntegerField(db_index=True)
    content_object = generic.GenericForeignKey()

    name = models.CharField(max_length=200)
    attach = models.FileField(upload_to=get_file_path, null=True, blank=True)
   
    def __unicode__(self):
        return self.name

I relate this model with another model as follows example
class ModelTwo(models.Model):
    name = models.CharField(max_length=200)
    attach1 = generic.GenericRelation(ModelOne)

ok i now in forms.py i create ModelForm

forms.py

class ModelTwoForm(ModelForm):
    class Meta:
        model = ModelTwo

but when I print the ModelTwoForm in the template do not show me my generic field attach1 why?

know how to solve this? i don't use the contrib.admin

thank you very much for any help








Reply all
Reply to author
Forward
0 new messages