forked from beba/foerderbarometer
project id displayed in admin
This commit is contained in:
parent
9c10b1c3b6
commit
23b28e0406
|
@ -3,12 +3,22 @@ from django.contrib import admin
|
|||
# Register your models here.
|
||||
from .models import Project, HonoraryCertificate, Library, IFG #, ELitStip
|
||||
|
||||
# @admin.register(Project)
|
||||
# class ProjectAdmin(admin.ModelAdmin):
|
||||
# #fields = ('pid',)
|
||||
# readonly_fields = ('pid',)
|
||||
# # list_display =('pid',)
|
||||
# def __init__(self, *args, **kwargs):
|
||||
# super().__init__(*args, **kwargs)
|
||||
# self.fields = super().get_all_field_names() + 'pid'
|
||||
# return self
|
||||
|
||||
@admin.register(Project)
|
||||
class ProjectAdmin(admin.ModelAdmin):
|
||||
fields = ('pid',)
|
||||
readonly_fields = ('pid',)
|
||||
|
||||
admin.site.register([HonoraryCertificate,
|
||||
admin.site.register([
|
||||
HonoraryCertificate,
|
||||
Library,
|
||||
IFG,
|
||||
])
|
||||
|
|
|
@ -17,9 +17,14 @@ class Project(Volunteer):
|
|||
# pid = models.IntegerField(null=True) # automaticly generated
|
||||
@property
|
||||
def pid(self):
|
||||
return "hurzel " + str(id)
|
||||
|
||||
pid = "hurzel " + self.get_pk
|
||||
print(pid)
|
||||
return pid
|
||||
|
||||
# def save(self,*args,**kwargs):
|
||||
# self.pid =
|
||||
# super().save(*args,*kwargs)
|
||||
#
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
|
Loading…
Reference in New Issue