daily pastebin goal
81%
SHARE
TWEET

Untitled

a guest Apr 29th, 2018 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from django.contrib import admin
  2. from Demoscopesis.models import Poll
  3. from Demoscopesis.models import PollCat
  4. from Demoscopesis.models import PollChoice
  5.  
  6. from django.forms import TextInput, Textarea
  7. from django.db import models
  8.  
  9. class PollInline(admin.StackedInline):
  10.     model = PollChoice
  11.     extra = 3
  12.  
  13.  
  14. class DemoscopesisAdmin(admin.ModelAdmin):
  15.     list_display = ('PL_TITLE', 'PL_SHRBODY', 'PL_CREATION', 'USER')
  16.     fieldsets = [
  17.         (None,               {'fields': ['PL_TITLE', 'PL_SHRBODY', 'PL_BODY']}),
  18.         ('Date information', {'fields': ['PL_CREATION', 'PL_STARTDT', 'PL_ENDDT', 'PL_DURATION']}),
  19.         ('Code information', {'fields': ['PL_CODE', 'PL_CODE2']}),
  20.         ('User and Category information', {'fields': ['USER', 'UGROUP', 'POLLCAT']}),
  21.     ]
  22.     formfield_overrides = {
  23.         models.CharField: {'PL_BODY': TextInput(attrs={'size': '120'})},
  24.         models.TextField: {'PL_BODY': Textarea(attrs={'rows': 14, 'cols': 140})},
  25.     }
  26.     inlines = [PollInline]
  27.  
  28.  
  29. admin.site.register(Poll, DemoscopesisAdmin)
  30. admin.site.register(PollCat)
  31. admin.site.register(PollChoice)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top