forked from beba/foerderbarometer
added project ForeignKey to HonoraryCertificate
This commit is contained in:
parent
188d39deb9
commit
ce2e84395d
|
@ -0,0 +1,23 @@
|
|||
# Generated by Django 3.1.1 on 2020-10-21 07:21
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('input', '0014_auto_20201020_0714'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='honorarycertificate',
|
||||
name='number',
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='honorarycertificate',
|
||||
name='project',
|
||||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='input.project'),
|
||||
),
|
||||
]
|
|
@ -29,11 +29,11 @@ class Project(Volunteer):
|
|||
super().save(*args,*kwargs)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
return f"{self.pid} {self.name}"
|
||||
|
||||
class HonoraryCertificate(Volunteer):
|
||||
request_url = models.CharField(max_length=2000)
|
||||
number = models.IntegerField(null = True)
|
||||
project = models.ForeignKey(Project, null = True, on_delete = models.SET_NULL)
|
||||
|
||||
def __str__(self):
|
||||
return "Certificate for " + self.realname
|
||||
|
|
|
@ -14,6 +14,9 @@ from .settings import URLPREFIX, IF_EMAIL
|
|||
|
||||
|
||||
def authorize(request, choice, pk):
|
||||
'''If IF grant a support they click a link in a mail which leads here'''
|
||||
# TODO: write a timestamp which is needed to determine time of next mail
|
||||
|
||||
if choice in ('BIB', 'ELIT', 'SOFT'):
|
||||
Library.set_granted(pk,True)
|
||||
return HttpResponse(f"AUTHORIZED! choice: {choice}, pk: {pk}")
|
||||
|
@ -22,6 +25,8 @@ def authorize(request, choice, pk):
|
|||
|
||||
|
||||
def deny(request, choice, pk):
|
||||
'''If IF denies a support they click a link in a mail which leads here'''
|
||||
|
||||
if choice in ('BIB', 'ELIT', 'SOFT'):
|
||||
Library.set_granted(pk,False)
|
||||
return HttpResponse(f"DENIED! choice: {choice}, pk: {pk}")
|
||||
|
|
Loading…
Reference in New Issue