summaryrefslogtreecommitdiffstats
path: root/agenda/admin.py
blob: df5cd5ae92dc938d551624edd52f39ebfca75dbc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
from django.contrib import admin
from infopoint.agenda.models import *
from django.utils.translation import ugettext as _
class LocationInline(admin.TabularInline):
        model = Location

class TodoInline(admin.TabularInline):
        model = Todo

class EventInline(admin.TabularInline):
	model = Event
	extra = 1

class GroupInline(admin.TabularInline):
	model = Group

class AttendanceInline(admin.TabularInline):
	model = Attendance

class NetworkInline(admin.TabularInline):
	model = Network

class AttendanceAdmin(admin.ModelAdmin):
	list_display = ('event', 'person', 'attendance' )
admin.site.register(Attendance,AttendanceAdmin)

class LocationAdmin(admin.ModelAdmin):
	list_display = ('title', 'description', 'size' , 'picture')
	inlines = [EventInline]
admin.site.register(Location,LocationAdmin)

class TodoAdmin(admin.ModelAdmin):
	list_display = ('title', 'public','due_date','creator', 'done')
	date_hierarchy = 'due_date'

admin.site.register(Todo,TodoAdmin)

class WishAdmin(admin.ModelAdmin):
	list_display = ('title', 'public','due_date','creator', 'done')
	date_hierarchy = 'due_date'

admin.site.register(Wish,WishAdmin)

class EventAdmin(admin.ModelAdmin):
        list_display = ('title', 'confirmed','description', 'location', 'start_date', 'public')
	list_filter = ('location', 'public')
	save_as = True
admin.site.register(Event,EventAdmin)

class NetworkAdmin(admin.ModelAdmin):
	list_display = ('event', 'group')
admin.site.register(Network,NetworkAdmin)

class Billboard(models.Model):
	title = models.CharField(max_length=100)
	groups = models.ManyToManyField(Group, null=True,blank=True,related_name='cartel')
	refresh = models.IntegerField(help_text=_('In seconds'),max_length=3)
	published = models.BooleanField(null=True,blank=True)
	location = models.ManyToManyField(Location, null=True,blank=True, related_name='cartel')
	timespan = models.CharField(max_length=1, choices=TIMESPAN_CHOICES)
	color1 = models.CharField(max_length=6)
	color2 = models.CharField(max_length=6)
	color3 = models.CharField(max_length=6)
	color4 = models.CharField(max_length=6)
	csstitle = models.TextField(max_length=500, help_text="decide the style of the title here",blank=True,default="padding: 30px;font-family: verdana, arial, sans-serif;text-transform: capitalize;BORder: 10px dotted;")
	cssdate = models.TextField(max_length=500, help_text="decide the style of the date here",blank=True,default="padding: 30px;")
	csslocation = models.TextField(max_length=500, help_text="decide the style of the location here",blank=True,default="padding: 30px;text-transform: capitalize;")
	cssdescription = models.TextField(max_length=500, help_text="decide the style of the description here",blank=True)
	
	def __unicode__(self):
		return self.title

class BillboardInline(admin.TabularInline):
        model = Billboard

class BillboardAdmin(admin.ModelAdmin):
	list_display = ('title', 'refresh','timespan','published')
	fieldsets = (
		(None, {
		'fields': (('title', 'refresh'), ('published'))
		}),
				('content', {
		'fields': (('groups', 'location'), ('timespan'))
		}),
		('css', {
		'classes': ('collapse','small'),
		'fields': (('csstitle', 'cssdescription'),('cssdate', 'csslocation'))
		}),
		('colors', {
		'fields': (('color1', 'color2'), ('color3', 'color4'))
		}),

	)

admin.site.register(Billboard,BillboardAdmin)



databrowse.site.register(Event)
databrowse.site.register(Location)
databrowse.site.register(Comment)
databrowse.site.register(Billboard)
databrowse.site.register(ContentType)
databrowse.site.register(Group)
databrowse.site.register(Network)
databrowse.site.register(Todo)
databrowse.site.register(Wish)
databrowse.site.register(User)