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
14de26de70
commit
94d8d7a50b
2 changed files with 11 additions and 4 deletions
|
@ -32,13 +32,18 @@ class ProjectAdmin(admin.ModelAdmin):
|
||||||
search_fields = ('name', 'pid','finance_id', 'realname', 'start', 'end', 'participants_estimated', 'participants_real', 'cost', 'status')
|
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')
|
list_display = ('name', 'pid','finance_id', 'realname', 'start', 'end', 'participants_estimated', 'participants_real', 'cost', 'status')
|
||||||
# action = ['export_as_csv']
|
# action = ['export_as_csv']
|
||||||
|
date_hierarchy = 'start'
|
||||||
|
|
||||||
@admin.register(BusinessCard)
|
@admin.register(BusinessCard)
|
||||||
class BusinessCardAdmin(admin.ModelAdmin):
|
class BusinessCardAdmin(admin.ModelAdmin):
|
||||||
save_as = True
|
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 = ('realname', 'service_id', 'granted', 'granted_date', 'project')
|
||||||
|
list_display_links = ('realname', 'service_id')
|
||||||
# action = ['export_as_csv']
|
# action = ['export_as_csv']
|
||||||
|
classes = ['collapse']
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
admin.site.register([
|
admin.site.register([
|
||||||
Account,
|
Account,
|
||||||
|
|
|
@ -93,12 +93,14 @@ class Project(Volunteer):
|
||||||
# we don't call save with args/kwargs to avoid UNIQUE CONSTRAINT errors
|
# we don't call save with args/kwargs to avoid UNIQUE CONSTRAINT errors
|
||||||
# but maybe there is a better solution?
|
# but maybe there is a better solution?
|
||||||
super().save()
|
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
|
# generation of finance_id
|
||||||
if not self.project_of_year:
|
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...
|
# we need to determine if this is a new year with its first new project...
|
||||||
year = self.start.year
|
year = self.start.year
|
||||||
|
print(year)
|
||||||
projects = Project.objects.filter(start__year=year)
|
projects = Project.objects.filter(start__year=year)
|
||||||
if not projects:
|
if not projects:
|
||||||
#print('BBB')
|
#print('BBB')
|
||||||
|
|
Loading…
Reference in a new issue