first steps in generating project ids

This commit is contained in:
Benni Baermann 2020-10-06 13:17:28 +02:00
parent 8db27707e1
commit 9c10b1c3b6
3 changed files with 13 additions and 4 deletions

View file

@ -3,8 +3,12 @@ from django.contrib import admin
# Register your models here.
from .models import Project, HonoraryCertificate, Library, IFG #, ELitStip
admin.site.register([Project,
HonoraryCertificate,
@admin.register(Project)
class ProjectAdmin(admin.ModelAdmin):
fields = ('pid',)
readonly_fields = ('pid',)
admin.site.register([HonoraryCertificate,
Library,
IFG,
])

View file

@ -10,7 +10,8 @@ class ProjectForm(ModelForm):
class Meta:
model = Project
exclude = ('pid',)
fields = '__all__'
# exclude = ('pid',)
class VolunteerForm(ModelForm):

View file

@ -14,7 +14,11 @@ class Project(Volunteer):
start = models.DateTimeField('start date')
# contact = models.ForeignKey(Volonteer, on_delete = models.CASCADE, null = True)
pid = models.IntegerField(null=True) # automaticly generated
# pid = models.IntegerField(null=True) # automaticly generated
@property
def pid(self):
return "hurzel " + str(id)
def __str__(self):
return self.name