I have a django app with the following class in my admin.py:
class SoftwareVersionAdmin(ModelAdmin):
fields = ("product", "version_number", "description",
"media", "relative_url", "current_version")
list_display = ["product", "version_number", "size",
"current_version", "number_of_clients", "percent_of_clients"]
list_display_links = ("version_number",)
list_filter = ['product',]
I want to have these fileds for add page but different fields for change page. How can I do that?
First have a look at source of ModelAdmin class’
get_formandget_formsetsmethods located indjango.contrib.admin.options.py. You can override those methods and use kwargs to get the behavior you want. For example: