Save the form type (long, short) with the case study
This commit is contained in:
parent
3c45e38fd5
commit
f8d4cfe755
18
apps/map/migrations/0076_casestudy_form_type.py
Normal file
18
apps/map/migrations/0076_casestudy_form_type.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 2.1.1 on 2019-03-04 20:40
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('map', '0075_auto_20190304_2016'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='casestudy',
|
||||||
|
name='form_type',
|
||||||
|
field=models.CharField(blank=True, max_length=16),
|
||||||
|
),
|
||||||
|
]
|
@ -317,6 +317,9 @@ class CaseStudy(models.Model):
|
|||||||
# Language this case study is written in
|
# Language this case study is written in
|
||||||
language = models.CharField(max_length=16, blank=True)
|
language = models.CharField(max_length=16, blank=True)
|
||||||
|
|
||||||
|
# Long or short case study?
|
||||||
|
form_type = models.CharField(max_length=16, blank=True)
|
||||||
|
|
||||||
##
|
##
|
||||||
# Territory info
|
# Territory info
|
||||||
##
|
##
|
||||||
|
@ -119,6 +119,7 @@ class BaseCreateForm(LoginRequiredMixin, FilesHandlerMixin, CreateView):
|
|||||||
|
|
||||||
self.object.author = self.request.user
|
self.object.author = self.request.user
|
||||||
self.object.language = get_language()
|
self.object.language = get_language()
|
||||||
|
self.object.form_type = self.form_type
|
||||||
self.object.save()
|
self.object.save()
|
||||||
|
|
||||||
send_email(self.object.id)
|
send_email(self.object.id)
|
||||||
@ -130,11 +131,13 @@ class BaseCreateForm(LoginRequiredMixin, FilesHandlerMixin, CreateView):
|
|||||||
class CreateShortCaseStudy(BaseCreateForm):
|
class CreateShortCaseStudy(BaseCreateForm):
|
||||||
"""View for short version of case study form."""
|
"""View for short version of case study form."""
|
||||||
form_class = ShortCaseStudyForm
|
form_class = ShortCaseStudyForm
|
||||||
|
form_type = "short"
|
||||||
|
|
||||||
|
|
||||||
class CreateLongCaseStudy(BaseCreateForm):
|
class CreateLongCaseStudy(BaseCreateForm):
|
||||||
"""View for long version of case study form."""
|
"""View for long version of case study form."""
|
||||||
form_class = LongCaseStudyForm
|
form_class = LongCaseStudyForm
|
||||||
|
form_type = "long"
|
||||||
|
|
||||||
|
|
||||||
class CreateCaseStudySuccess(TemplateView):
|
class CreateCaseStudySuccess(TemplateView):
|
||||||
|
Loading…
Reference in New Issue
Block a user