minor model changes (url length)

This commit is contained in:
Benni Bärmann 2020-10-07 09:55:32 +02:00
parent 90e2bf5411
commit 78272a2f77
2 changed files with 29 additions and 11 deletions

View File

@ -0,0 +1,23 @@
# Generated by Django 3.1.1 on 2020-10-07 07:54
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('input', '0011_auto_20201007_0743'),
]
operations = [
migrations.AlterField(
model_name='honorarycertificate',
name='request_url',
field=models.CharField(max_length=2000),
),
migrations.AlterField(
model_name='ifg',
name='url',
field=models.CharField(max_length=2000),
),
]

View File

@ -12,25 +12,20 @@ class Volunteer(models.Model):
class Project(Volunteer): class Project(Volunteer):
name = models.CharField(max_length=200) name = models.CharField(max_length=200)
start = models.DateField('start date') start = models.DateField('start date')
# contact = models.ForeignKey(Volonteer, on_delete = models.CASCADE, null = True)
pid = models.IntegerField(null=True, blank=True) # automaticly generated pid = models.IntegerField(null=True, blank=True) # automaticly generated
# @property
# def pid(self):
# pid = "hurzel " + self.get_pk
# print(pid)
# return pid
def save(self,*args,**kwargs): def save(self,*args,**kwargs):
super().save(*args,*kwargs) # is there a way to call super().save() only once?
self.pid = 10000 + self.pk super().save(*args,*kwargs)
super().save(*args,*kwargs) self.pid = 10000 + self.pk
super().save(*args,*kwargs)
def __str__(self): def __str__(self):
return self.name return self.name
class HonoraryCertificate(Volunteer): class HonoraryCertificate(Volunteer):
request_url = models.CharField(max_length=400) #can urls be longer in theory? request_url = models.CharField(max_length=2000)
number = models.IntegerField(null = True) number = models.IntegerField(null = True)
def __str__(self): def __str__(self):
@ -53,7 +48,7 @@ class Library(Grant):
return self.library return self.library
class IFG(Grant): class IFG(Grant):
url = models.CharField(max_length=400) #can urls be longer in theory? url = models.CharField(max_length=2000)
def __str__(self): def __str__(self):
return "IFG-Anfrage von " + self.realname return "IFG-Anfrage von " + self.realname