Ticket #24539: admin.py

File admin.py, 426 bytes (added by Evandro Myller, 10 years ago)

admin module

Line 
1from django.contrib import admin
2from django.forms.models import modelform_factory
3
4from .models import Product
5
6
7@admin.register(Product)
8class ProductAdmin(admin.ModelAdmin):
9
10 def get_form(self, *args, **kwargs):
11 class ProductForm(modelform_factory(Product, fields=['reference'])):
12
13 def clean(self):
14 # Implement some custom validation
15 pass
16
17 return ProductForm
Back to Top