ashish2py

exclude changed to readonly_fileds in django1.2

Feb 20th, 2013
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.75 KB | None | 0 0
  1. django-1.1 to 1.2 exclude changed to readonly_fields
  2.  
  3. http://ygamretuta.me/2011/02/17/django-1-2-exclude-does-not-work-on-datetimefield-with-auto_now-and-auto_now_add/
  4.  
  5. class ProductAdmin(admin.ModelAdmin):
  6.     list_display = ('name', 'description', 'created_at', 'updated_at',)
  7.     list_display_links = ('name',)
  8.     list_per_page = 50
  9.     ordering = ['-created_at']
  10.     search_fields = ['name', 'description']
  11.     exclude = ('created_at', 'updated_at',)
  12.  
  13. class ProductAdmin(admin.ModelAdmin):
  14.     list_display = ('name', 'description', 'created_at', 'updated_at',)
  15.     list_display_links = ('name',)
  16.     list_per_page = 50
  17.     ordering = ['-created_at']
  18.     search_fields = ['name', 'description']
  19.     readonly_fields = ('created_at', 'updated_at',)
Advertisement
Add Comment
Please, Sign In to add comment