Add CRUD for Drug
This commit is contained in:
@@ -3,7 +3,9 @@ from django.contrib.auth.forms import UserCreationForm
|
||||
from django.forms import ModelForm
|
||||
from mixins.restrictions import RestrictedFormMixin
|
||||
|
||||
from .models import NotificationSettings, User
|
||||
from mxs.restrictions import RestrictedFormMixinStaff
|
||||
|
||||
from .models import Drug, NotificationSettings, User
|
||||
|
||||
# Create your forms here.
|
||||
|
||||
@@ -47,3 +49,32 @@ class CustomUserCreationForm(UserCreationForm):
|
||||
class Meta:
|
||||
model = User
|
||||
fields = "__all__"
|
||||
|
||||
|
||||
class DrugForm(RestrictedFormMixinStaff, ModelForm):
|
||||
class Meta:
|
||||
model = Drug
|
||||
fields = (
|
||||
"name",
|
||||
"drug_class",
|
||||
"common_name",
|
||||
"links",
|
||||
"dosages",
|
||||
"timings",
|
||||
"effects",
|
||||
"actions",
|
||||
"experiences",
|
||||
)
|
||||
help_texts = {
|
||||
"name": "Lysergic acid diethylamide, Phenibut",
|
||||
"drug_class": "Psychedelic, Sedative, Stimulant",
|
||||
"common_name": "LSD",
|
||||
"links": "Factsheets, posts",
|
||||
"dosages": "Dosages, how much to take to get a certain effect",
|
||||
"timings": (
|
||||
"Timings, how long to wait to reach maximum intensity (and " "others)"
|
||||
),
|
||||
"effects": "Effects, what does it do on a subjective level?",
|
||||
"actions": "Actions, what does it do on an objective level?",
|
||||
"experiences": "Experiences, what do people experience?",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user