forked from beba/foerderbarometer
dates in tabulatures, based on django style with almost no new code. only applied to projects change list page
This commit is contained in:
parent
a5b7d92ec2
commit
792f8df588
|
@ -32,13 +32,18 @@ class ProjectAdmin(admin.ModelAdmin):
|
|||
search_fields = ('name', 'pid','finance_id', 'realname', 'start', 'end', 'participants_estimated', 'participants_real', 'cost', 'status')
|
||||
list_display = ('name', 'pid','finance_id', 'realname', 'start', 'end', 'participants_estimated', 'participants_real', 'cost', 'status')
|
||||
# action = ['export_as_csv']
|
||||
date_hierarchy = 'start'
|
||||
|
||||
@admin.register(BusinessCard)
|
||||
class BusinessCardAdmin(admin.ModelAdmin):
|
||||
save_as = True
|
||||
search_fields = ('realname', 'service_id', 'granted', 'granted_date', 'project')
|
||||
search_fields = (('realname', 'service_id'), 'granted', 'granted_date', 'project')
|
||||
list_display = ('realname', 'service_id', 'granted', 'granted_date', 'project')
|
||||
list_display_links = ('realname', 'service_id')
|
||||
# action = ['export_as_csv']
|
||||
classes = ['collapse']
|
||||
|
||||
|
||||
|
||||
admin.site.register([
|
||||
Account,
|
||||
|
|
|
@ -93,12 +93,14 @@ class Project(Volunteer):
|
|||
# we don't call save with args/kwargs to avoid UNIQUE CONSTRAINT errors
|
||||
# but maybe there is a better solution?
|
||||
super().save()
|
||||
self.pid = str(self.account.code) + str(self.pk).zfill(3)
|
||||
self.pid = str(self.start.year) + '-' + str(self.account.code) + str(self.pk).zfill(3)
|
||||
# self.pid = str(self.account.code) + str(self.pk).zfill(3)
|
||||
# generation of finance_id
|
||||
if not self.project_of_year:
|
||||
#print('AAA')
|
||||
print('AAA')
|
||||
# we need to determine if this is a new year with its first new project...
|
||||
year = self.start.year
|
||||
print(year)
|
||||
projects = Project.objects.filter(start__year=year)
|
||||
if not projects:
|
||||
#print('BBB')
|
||||
|
|
Loading…
Reference in New Issue