Browse Source

dates in tabulatures, based on django style with almost no new code. only applied to projects change list page

master
alpcentaur 1 year ago
parent
commit
94d8d7a50b
2 changed files with 11 additions and 4 deletions
  1. +7
    -2
      input/admin.py
  2. +4
    -2
      input/models.py

+ 7
- 2
input/admin.py View File

@ -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')
save_as = True
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,

+ 4
- 2
input/models.py View File

@ -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…
Cancel
Save