You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.6 KiB

4 years ago
4 years ago
  1. from django.db import models
  2. class Volunteer(models.Model):
  3. realname = models.CharField(max_length=200, null=True)
  4. email = models.CharField(max_length=200, null=True)
  5. username = models.CharField(max_length=200, null=True)
  6. class Meta:
  7. abstract = True
  8. class Project(Volunteer):
  9. name = models.CharField(max_length=200)
  10. start = models.DateTimeField('start date')
  11. # contact = models.ForeignKey(Volonteer, on_delete = models.CASCADE, null = True)
  12. # pid = models.IntegerField(null=True) # automaticly generated
  13. @property
  14. def pid(self):
  15. pid = "hurzel " + self.get_pk
  16. print(pid)
  17. return pid
  18. # def save(self,*args,**kwargs):
  19. # self.pid =
  20. # super().save(*args,*kwargs)
  21. #
  22. def __str__(self):
  23. return self.name
  24. class HonoraryCertificate(Volunteer):
  25. request_url = models.CharField(max_length=400) #can urls be longer in theory?
  26. number = models.IntegerField(null = True)
  27. def __str__(self):
  28. return "Certificate for " + self.realname
  29. #abstract class for Library, IFG, ...
  30. class Grant(Volunteer):
  31. cost = models.CharField(max_length=10)
  32. notes = models.CharField(max_length=500)
  33. class Meta:
  34. abstract = True
  35. # should be identical for ELitStip and Software?
  36. class Library(Grant):
  37. library = models.CharField(max_length=200)
  38. duration = models.CharField(max_length=100)
  39. def __str__(self):
  40. return self.library
  41. class IFG(Grant):
  42. url = models.CharField(max_length=400) #can urls be longer in theory?
  43. def __str__(self):
  44. return "IFG-Anfrage von " + self.realname