On Dec 10, 5:53 am, Shai <sha...@gmail.com> wrote:
> Hi all,
>
> I'm not sure my title is correct. Here Is my problem: I want to use
> the django admin for data entry into some models. The models are based
> on actual paper forms. There are several forms. and they share some
> fields. I would like to follow the principle of DRY when creating this
> app. As an illustration, consider the following models:

It makes out of the box admin use a bit harder, but have you
considered modeling your data properly, and then using a django Form
object hierarchy to represent what fields you want displayed for each
form.

Like I said - this is a bit more work up front, but a much cleaner way
to separate the difference between what is a piece of information, and
how it is displayed in a form.

-Preston

>
> class Form1(models.Model):
>   def __unicode__(self):
>     return "Form1"
>
> class Form2(models.Model):
>   def __unicode__(self):
>     return "Form2"
>
>    ## some fields here
>
> class SubForm1(models.Model):
>   def __unicode__(self):
>     return "SubForm1"
>
>   Form = models.ForeignKey(Form1)
>   ## some fields here
>
> I would like to have Form2 also be linked to a SubForm1 model. How can
> this be done?
>
> Thanks,
> Shai

--

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


Reply via email to