diff --git a/input/admin.py b/input/admin.py index f7cfbb6..a2c1406 100644 --- a/input/admin.py +++ b/input/admin.py @@ -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, ]) diff --git a/input/forms.py b/input/forms.py index a0505d0..c96e1c2 100644 --- a/input/forms.py +++ b/input/forms.py @@ -10,7 +10,8 @@ class ProjectForm(ModelForm): class Meta: model = Project - exclude = ('pid',) + fields = '__all__' + # exclude = ('pid',) class VolunteerForm(ModelForm): diff --git a/input/models.py b/input/models.py index f335bd4..c44c17c 100644 --- a/input/models.py +++ b/input/models.py @@ -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