0

Let's say I want to use a different template for the add page but not the edit. What would be the best way to accomplish that? I was thinking either subclassing add_view or change_view, or alternatively maybe subclass some InlineModelAdmin method. What's your guys take on this? Thanks.

2
  • What framework are you using? Aug 25, 2009 at 9:03
  • django, sorry about that
    – orwellian
    Aug 25, 2009 at 9:04

1 Answer 1

1

This is a pretty crappy solution but here is how I solved it:

class FooInline(admin.TabularInline):
    model = Foo

    def get_fieldsets(self, request, obj=None): 
       url = request.get_full_path()
       if '/add/' not in url:
           self.template = 'listing.html'
       return super(FooInline, self).get_fieldsets( request, obj)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.