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.

53 lines
1.5 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. return "hurzel " + str(id)
  16. def __str__(self):
  17. return self.name
  18. class HonoraryCertificate(Volunteer):
  19. request_url = models.CharField(max_length=400) #can urls be longer in theory?
  20. number = models.IntegerField(null = True)
  21. def __str__(self):
  22. return "Certificate for " + self.realname
  23. #abstract class for Library, IFG, ...
  24. class Grant(Volunteer):
  25. cost = models.CharField(max_length=10)
  26. notes = models.CharField(max_length=500)
  27. class Meta:
  28. abstract = True
  29. # should be identical for ELitStip and Software?
  30. class Library(Grant):
  31. library = models.CharField(max_length=200)
  32. duration = models.CharField(max_length=100)
  33. def __str__(self):
  34. return self.library
  35. class IFG(Grant):
  36. url = models.CharField(max_length=400) #can urls be longer in theory?
  37. def __str__(self):
  38. return "IFG-Anfrage von " + self.realname