I have a model with a number of attributes (some included as example below):
class Release(models.Model): project_fk = models.ForeignKey(Project) title = models.CharField(max_length=30) summary = models.TextField() owner = models.ForeignKey(User) planning_status = models.CharField(max_length=1, choices=PS_CHOICES, default=PS_CHOICES[0][0]) development_status = models.CharField(max_length=1, choices=DEV_CHOICES, default=DEV_CHOICES[0][0]) point_estimate = models.IntegerField(choices=ESTIMATE_CHOICES, default=0) staffing_level = models.FloatField(default=0, choices=STAFF_CHOICES) internal_priority = models.IntegerField(default=0) created_on = models.DateField(auto_now=False, auto_now_add=True) last_updated = models.DateField(auto_now=True, auto_now_add=True) I want a varying number of these fields to appear in an edit form depending on the group a user belongs to. I was thinking I would have seperat form objects and specify the fields I need in each return, returning them in the view after testing for the proper user group. class ReleaseBasicForm(forms.ModelForm): """Form for basic release information.""" class Meta: model = Release fields = ( 'title', 'summary', 'owner' ) class ReleasePlanningForm(forms.ModelForm): """Form for release planning details.""" class Meta: model = Release fields = ( 'planning_status', 'staffing_level' ) class ReleaseDevelopmentForm(forms.ModelForm): """Form for release development details.""" class Meta: model = Release fields = ( 'development_status', 'point_estimate' ) I'm having trouble though understanding how I would process this form data. In a normal model form I'd have to save a form with 'commit=false' and then add back in whatever fields I excluded or it will save those as null. Since what fields will appear will change by user role though I'm not sure how best to approach this. Any help would be appreciated. --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---