-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.py
More file actions
71 lines (54 loc) · 2.1 KB
/
models.py
File metadata and controls
71 lines (54 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import datetime
import typing
from django.db import models
from apps.common.models import UserResource
from apps.tool_picker.models import Tool
class ContactRequest(models.Model):
"""Model representing contact where anyone can react out to the admins."""
name = models.CharField[str, str](max_length=200)
email = models.CharField[str, str](max_length=200)
created_at = models.DateTimeField[datetime.datetime, datetime.datetime](auto_now_add=True)
national_society = models.CharField[str, str](max_length=200)
content = models.TextField[str, str](blank=True, null=True)
class Meta:
ordering = ["name"]
@typing.override
def __str__(self):
return self.name
class CaseStudy(UserResource):
"""Model representing case study of national society for specific tool."""
title = models.CharField[str, str](max_length=200)
content = models.TextField[str, str](max_length=320)
cover_image = models.ImageField(
upload_to="case_studies/",
verbose_name="Case Study Cover Image",
)
tool = models.ForeignKey[Tool, Tool](
Tool,
on_delete=models.CASCADE,
related_name="case_studies",
)
link = models.URLField(verbose_name="External case study URL")
class Meta(UserResource.Meta):
ordering = ["title"]
@typing.override
def __str__(self):
return self.title
class RequestDemo(models.Model):
"""Model representing contact where anyone can request the tool demo to the admins."""
name = models.CharField[str, str](max_length=200)
email = models.CharField[str, str](max_length=200)
created_at = models.DateTimeField[datetime.datetime, datetime.datetime](auto_now_add=True)
national_society = models.CharField[str, str](max_length=200)
content = models.TextField[str, str](blank=True, null=True)
tool = models.ForeignKey[Tool, Tool](
Tool,
related_name="request_demo_tool",
verbose_name="Related Tool",
on_delete=models.CASCADE,
)
class Meta:
ordering = ["name"]
@typing.override
def __str__(self):
return self.name