Hi, I have an application with a model and a modelform. I have another application and in a a specific case I would like to override one attribute from the modelform in the original application.
Example: class Article(models.Model): identifier: = models.CharField(max_length=10) headline = models.CharField(max_length=100) publications = models.ManyToManyField(Publication) class ArticleForm(ModelForm): class Meta: model = Article def add(request): form = ArticleForm(request.POST or None) if request.POST and form.is_valid(): instance = form.save() return HttpResponseRedirect(reverse("add-article", args=[instance.pk])) else: errors = form.errors context = { 'form': form, 'request': request } return render_to_response('article/add.html', context) Now I have another application that uses the articles application but in another way so that the identifier is not used and should not appear in the form to add an Article. What is the best way to do it? I considered 2 things: 1 - make the view a class and override the form attribute in the new application. 2 - make the form an attribute of the view function and override it in the new application Am I thinking correctly? What are the best practices on this topic? Thanks, -- 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.