Compare commits
No commits in common. "c850a99200b726fe168f3180da21d55052848cce" and "73fe51ba9c09bddd5275797c5f869d46089a1d84" have entirely different histories.
c850a99200
...
73fe51ba9c
@ -1,15 +0,0 @@
|
||||
repos:
|
||||
- repo: https://github.com/ambv/black
|
||||
rev: 18.9b0
|
||||
hooks:
|
||||
- id: black
|
||||
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v2.1.0
|
||||
hooks:
|
||||
- id: flake8
|
||||
|
||||
- repo: https://github.com/asottile/reorder_python_imports
|
||||
rev: v1.3.5
|
||||
hooks:
|
||||
- id: reorder-python-imports
|
@ -1,11 +1,9 @@
|
||||
from django.contrib.auth.models import User
|
||||
from rest_framework import serializers
|
||||
from rest_framework import viewsets
|
||||
from rest_framework import serializers, viewsets
|
||||
from rest_framework_gis import serializers as gis_serializers
|
||||
|
||||
from apps.files.models import File
|
||||
from apps.map.models import CaseStudy
|
||||
from apps.map.models import PointOfInterest
|
||||
from apps.map.models import CaseStudy, PointOfInterest
|
||||
|
||||
|
||||
class UserSerializer(serializers.HyperlinkedModelSerializer):
|
||||
|
0
apps/contact/__init__.py
Normal file
0
apps/contact/__init__.py
Normal file
10
apps/contact/forms.py
Normal file
10
apps/contact/forms.py
Normal file
@ -0,0 +1,10 @@
|
||||
from envelope.forms import ContactForm
|
||||
from crispy_forms.helper import FormHelper
|
||||
from crispy_forms.layout import Submit
|
||||
|
||||
|
||||
class ContactForm(ContactForm):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(ContactForm, self).__init__(*args, **kwargs)
|
||||
self.helper = FormHelper()
|
||||
self.helper.add_input(Submit("submit", "Submit", css_class="btn-lg pull-right"))
|
21
apps/contact/templates/envelope/contact.html
Normal file
21
apps/contact/templates/envelope/contact.html
Normal file
@ -0,0 +1,21 @@
|
||||
{% extends "base_page.html" %}
|
||||
{% load bootstrap3 %}
|
||||
{% load crispy_forms_tags %}
|
||||
{% load envelope_tags %}
|
||||
|
||||
{% block page_name %}Contact{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<div class="page-lead">
|
||||
<h2>Contact</h2>
|
||||
<p class="lead">Send us your thoughts and feedback.</p>
|
||||
</div>
|
||||
{% bootstrap_messages %}
|
||||
<form action="{% url 'contact' %}" method="post">
|
||||
{% csrf_token %}
|
||||
{% antispam_fields %}
|
||||
{% crispy form %}
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
3
apps/contact/tests.py
Normal file
3
apps/contact/tests.py
Normal file
@ -0,0 +1,3 @@
|
||||
# from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
5
apps/contact/urls.py
Normal file
5
apps/contact/urls.py
Normal file
@ -0,0 +1,5 @@
|
||||
from django.conf.urls import url
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [url(r"^$", views.ContactView.as_view(), name="contact")]
|
12
apps/contact/views.py
Normal file
12
apps/contact/views.py
Normal file
@ -0,0 +1,12 @@
|
||||
from braces.views import FormMessagesMixin
|
||||
from envelope.views import ContactView
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from .forms import ContactForm
|
||||
|
||||
|
||||
class ContactView(FormMessagesMixin, ContactView):
|
||||
form_invalid_message = _(u"There was an error in the contact form.")
|
||||
form_valid_message = _(u"Thanks for your message.")
|
||||
form_class = ContactForm
|
@ -1,7 +1,6 @@
|
||||
from django import forms
|
||||
|
||||
from .models import File
|
||||
from .models import ImageFile
|
||||
from .models import File, ImageFile
|
||||
|
||||
|
||||
class FileForm(forms.ModelForm):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.11.6 on 2018-04-23 02:20
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,10 +2,9 @@
|
||||
# Generated by Django 1.11.6 on 2018-04-29 22:07
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,10 +2,9 @@
|
||||
# Generated by Django 1.11.6 on 2018-05-26 15:47
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.11.6 on 2018-05-30 03:08
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.11.15 on 2018-09-22 17:17
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Generated by Django 2.0.8 on 2018-09-28 13:23
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -1,8 +1,8 @@
|
||||
# Generated by Django 2.1.1 on 2018-12-01 23:15
|
||||
import django.db.models.deletion
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -1,8 +1,9 @@
|
||||
from django.contrib.auth.models import User
|
||||
from django.http import QueryDict
|
||||
from django.test import TestCase
|
||||
from django.urls import reverse
|
||||
from django.utils.translation import activate
|
||||
from django.urls import reverse
|
||||
|
||||
from override_storage import override_storage
|
||||
|
||||
from .models import File
|
||||
|
@ -1,14 +1,21 @@
|
||||
from django.urls import path
|
||||
from django.conf.urls import url
|
||||
|
||||
from . import views
|
||||
from .views import (
|
||||
FileUploadView,
|
||||
FileDeleteView,
|
||||
ImageFileUploadView,
|
||||
ImageFileDeleteView,
|
||||
)
|
||||
|
||||
app_name = "files"
|
||||
|
||||
urlpatterns = [
|
||||
path("upload/", views.FileUpload.as_view(), name="upload"),
|
||||
path("upload/image/", views.ImageFileUpload.as_view(), name="upload_image"),
|
||||
path("delete/<int:pk>/", views.FileDelete.as_view(), name="delete"),
|
||||
path(
|
||||
"delete/image/<int:pk>/", views.ImageFileDelete.as_view(), name="delete_image"
|
||||
url(r"^upload/$", FileUploadView.as_view(), name="upload"),
|
||||
url(r"^upload/image/$", ImageFileUploadView.as_view(), name="upload_image"),
|
||||
url(r"^delete/(?P<pk>\d+)/$", FileDeleteView.as_view(), name="delete"),
|
||||
url(
|
||||
r"^delete/image/(?P<pk>\d+)/$",
|
||||
ImageFileDeleteView.as_view(),
|
||||
name="delete_image",
|
||||
),
|
||||
]
|
||||
|
@ -1,16 +1,13 @@
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
from django.http import JsonResponse
|
||||
from django.views.generic import DetailView
|
||||
from django.views.generic import FormView
|
||||
from django.views.generic import FormView, DetailView
|
||||
|
||||
from .forms import FileForm
|
||||
from .forms import ImageFileForm
|
||||
from .models import File
|
||||
from .models import ImageFile
|
||||
from .forms import ImageFileForm, FileForm
|
||||
from .models import ImageFile, File
|
||||
|
||||
|
||||
class FileUpload(LoginRequiredMixin, FormView):
|
||||
class FileUploadView(LoginRequiredMixin, FormView):
|
||||
model = File
|
||||
form_class = FileForm
|
||||
|
||||
@ -32,12 +29,12 @@ class FileUpload(LoginRequiredMixin, FormView):
|
||||
return JsonResponse({"is_valid": False, "errors": form.errors})
|
||||
|
||||
|
||||
class ImageFileUpload(FileUpload):
|
||||
class ImageFileUploadView(FileUploadView):
|
||||
model = ImageFile
|
||||
form_class = ImageFileForm
|
||||
|
||||
|
||||
class FileDelete(LoginRequiredMixin, DetailView):
|
||||
class FileDeleteView(LoginRequiredMixin, DetailView):
|
||||
model = File
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
@ -54,5 +51,5 @@ class FileDelete(LoginRequiredMixin, DetailView):
|
||||
return JsonResponse({"success": True})
|
||||
|
||||
|
||||
class ImageFileDelete(FileDelete):
|
||||
class ImageFileDeleteView(FileDeleteView):
|
||||
model = ImageFile
|
||||
|
@ -1,12 +1,9 @@
|
||||
from dal import autocomplete
|
||||
from django import forms
|
||||
from django.contrib import admin
|
||||
from django import forms
|
||||
from dal import autocomplete
|
||||
from leaflet.admin import LeafletGeoAdmin
|
||||
|
||||
from .models import CaseStudy
|
||||
from .models import CaseStudyDraft
|
||||
from .models import PointOfInterest
|
||||
from .models import SpatialRefSys
|
||||
from .models import CaseStudy, CaseStudyDraft, SpatialRefSys, PointOfInterest
|
||||
|
||||
|
||||
class CaseStudyDraftAdmin(admin.ModelAdmin):
|
||||
|
@ -1,28 +1,19 @@
|
||||
from crispy_forms.bootstrap import FormActions
|
||||
from crispy_forms.bootstrap import PrependedText
|
||||
from crispy_forms.bootstrap import Tab
|
||||
from crispy_forms.bootstrap import TabHolder
|
||||
from crispy_forms.helper import FormHelper
|
||||
from crispy_forms.layout import Div
|
||||
from crispy_forms.layout import Fieldset
|
||||
from crispy_forms.layout import HTML
|
||||
from crispy_forms.layout import Layout
|
||||
from crispy_forms.layout import Submit
|
||||
from dal import autocomplete
|
||||
from django import forms
|
||||
from django.urls import reverse
|
||||
from django.urls import reverse_lazy
|
||||
from django.urls import reverse, reverse_lazy
|
||||
from django.utils.safestring import mark_safe
|
||||
from django.utils.text import format_lazy
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from crispy_forms.helper import FormHelper
|
||||
from crispy_forms.layout import Submit, Layout, HTML, Fieldset, Div
|
||||
from crispy_forms.bootstrap import Tab, TabHolder, PrependedText, FormActions
|
||||
from dal import autocomplete
|
||||
from leaflet.forms.widgets import LeafletWidget
|
||||
|
||||
from .models import CaseStudy
|
||||
from .models import PointOfInterest
|
||||
from .models import SpatialRefSys
|
||||
from apps.files.models import File, ImageFile
|
||||
|
||||
from .models import CaseStudy, SpatialRefSys, PointOfInterest
|
||||
from .widgets import JSONFileListWidget
|
||||
from apps.files.models import File
|
||||
from apps.files.models import ImageFile
|
||||
|
||||
|
||||
SECTOR_HELP = {
|
||||
|
@ -2,12 +2,11 @@
|
||||
# Generated by Django 1.11.1 on 2017-05-19 21:42
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.conf import settings
|
||||
import django.contrib.gis.db.models.fields
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import django_countries.fields
|
||||
from django.conf import settings
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.10.7 on 2017-10-06 15:59
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.10.7 on 2017-10-06 20:33
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.10.7 on 2017-10-07 13:49
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,8 @@
|
||||
# Generated by Django 1.10.7 on 2017-10-07 14:23
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import django_extensions.db.fields
|
||||
from django.db import migrations
|
||||
import django_extensions.db.fields
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.10.7 on 2017-10-07 15:02
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.10.7 on 2017-10-07 15:44
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,10 +2,8 @@
|
||||
# Generated by Django 1.11.6 on 2017-10-11 16:06
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
|
||||
import apps.map.validators
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.11.6 on 2017-10-12 15:52
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -3,9 +3,8 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import django.contrib.gis.db.models.fields
|
||||
from django.db import migrations, models
|
||||
import django_countries.fields
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.11.6 on 2017-10-12 16:40
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.11.6 on 2017-10-25 20:35
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.11.6 on 2017-10-30 15:50
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.11.6 on 2017-10-31 14:42
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.11.6 on 2017-11-01 15:08
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.11.6 on 2017-11-02 22:05
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.11.6 on 2017-11-02 22:11
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.11.6 on 2017-11-02 22:19
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.11.6 on 2017-11-02 22:23
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.11.6 on 2017-11-02 22:28
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.11.6 on 2017-11-02 22:32
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.11.6 on 2017-11-02 22:50
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.11.6 on 2017-11-02 23:00
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.11.6 on 2017-11-02 23:26
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.11.6 on 2017-11-02 23:46
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.11.6 on 2017-11-02 23:58
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,8 @@
|
||||
# Generated by Django 1.11.6 on 2017-11-03 13:28
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import multiselectfield.db.fields
|
||||
from django.db import migrations
|
||||
import multiselectfield.db.fields
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.11.6 on 2017-11-03 16:08
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.11.6 on 2017-11-03 16:10
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.11.6 on 2017-11-03 17:45
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.11.6 on 2017-11-03 22:30
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.11.6 on 2017-11-03 22:54
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.11.6 on 2018-03-26 01:57
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.11.6 on 2018-03-27 03:34
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.11.6 on 2018-03-27 05:49
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.11.6 on 2018-03-28 01:46
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.11.6 on 2018-03-28 02:45
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.11.6 on 2018-03-28 03:09
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,8 @@
|
||||
# Generated by Django 1.11.6 on 2018-03-28 06:16
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import multiselectfield.db.fields
|
||||
from django.db import migrations
|
||||
import multiselectfield.db.fields
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.11.6 on 2018-03-28 11:22
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,11 +2,9 @@
|
||||
# Generated by Django 1.11.6 on 2018-03-29 10:44
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import multiselectfield.db.fields
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
|
||||
import apps.map.validators
|
||||
from django.db import migrations, models
|
||||
import multiselectfield.db.fields
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,9 +2,8 @@
|
||||
# Generated by Django 1.11.6 on 2018-03-31 04:59
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import phonenumber_field.modelfields
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,9 +2,8 @@
|
||||
# Generated by Django 1.11.6 on 2018-03-31 05:17
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import phonenumber_field.modelfields
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,10 +2,8 @@
|
||||
# Generated by Django 1.11.6 on 2018-03-31 06:04
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
|
||||
import apps.map.validators
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,8 @@
|
||||
# Generated by Django 1.11.6 on 2018-03-31 06:08
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import multiselectfield.db.fields
|
||||
from django.db import migrations
|
||||
import multiselectfield.db.fields
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,9 +2,8 @@
|
||||
# Generated by Django 1.11.6 on 2018-03-31 09:33
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import multiselectfield.db.fields
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.11.6 on 2018-03-31 11:34
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,8 @@
|
||||
# Generated by Django 1.11.6 on 2018-04-02 12:37
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import multiselectfield.db.fields
|
||||
from django.db import migrations
|
||||
import multiselectfield.db.fields
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -3,9 +3,8 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import django.contrib.gis.db.models.fields
|
||||
from django.db import migrations, models
|
||||
import multiselectfield.db.fields
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -3,10 +3,9 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import django.contrib.gis.db.models.fields
|
||||
from django.db import migrations, models
|
||||
import django_countries.fields
|
||||
import multiselectfield.db.fields
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,10 +2,9 @@
|
||||
# Generated by Django 1.11.6 on 2018-04-12 06:50
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,11 +2,10 @@
|
||||
# Generated by Django 1.11.6 on 2018-04-16 03:55
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import django.contrib.gis.db.models.fields
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
import django.contrib.gis.db.models.fields
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,9 +2,8 @@
|
||||
# Generated by Django 1.11.6 on 2018-04-19 16:50
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import multiselectfield.db.fields
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.11.6 on 2018-04-23 02:20
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.11.6 on 2018-04-29 22:05
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,9 +2,8 @@
|
||||
# Generated by Django 1.11.6 on 2018-05-19 18:01
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import multiselectfield.db.fields
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.11.6 on 2018-05-23 16:59
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,9 +2,8 @@
|
||||
# Generated by Django 1.11.6 on 2018-05-25 00:35
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import multiselectfield.db.fields
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.11.6 on 2018-05-25 00:52
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.11.6 on 2018-05-26 15:36
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,7 @@
|
||||
# Generated by Django 1.11.6 on 2018-05-26 15:47
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,9 +2,8 @@
|
||||
# Generated by Django 1.11.6 on 2018-05-30 02:52
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.utils.timezone
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,9 +2,8 @@
|
||||
# Generated by Django 1.11.15 on 2018-09-22 17:43
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import multiselectfield.db.fields
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
|
||||
string_fields = [
|
||||
"additional_technical_details",
|
||||
|
@ -2,9 +2,8 @@
|
||||
# Generated by Django 1.11.15 on 2018-09-22 18:06
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import multiselectfield.db.fields
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,12 +2,11 @@
|
||||
# Generated by Django 1.11.6 on 2018-10-12 22:48
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.conf import settings
|
||||
import django.contrib.gis.db.models.fields
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import django_extensions.db.fields
|
||||
from django.conf import settings
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -1,9 +1,9 @@
|
||||
# Generated by Django 2.1.1 on 2018-12-01 23:15
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import django_extensions.db.fields
|
||||
import multiselectfield.db.fields
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Generated by Django 2.1.1 on 2018-12-02 02:09
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -1,4 +1,5 @@
|
||||
# Generated by Django 2.1.1 on 2018-12-02 02:23
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Generated by Django 2.1.1 on 2019-03-04 20:16
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Generated by Django 2.1.1 on 2019-03-04 20:40
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Generated by Django 2.1.1 on 2019-03-21 19:24
|
||||
|
||||
from django.db import migrations, models
|
||||
import multiselectfield.db.fields
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -1,8 +1,8 @@
|
||||
# Generated by Django 2.1.1 on 2019-04-07 15:30
|
||||
|
||||
from django.db import migrations, models
|
||||
import django_countries.fields
|
||||
import multiselectfield.db.fields
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Generated by Django 2.1.1 on 2019-04-07 16:04
|
||||
|
||||
from django.db import migrations, models
|
||||
import multiselectfield.db.fields
|
||||
from django.db import migrations
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -6,8 +6,9 @@ from django.contrib.gis.db import models
|
||||
from django.db import connection
|
||||
from django.template.defaultfilters import slugify
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django_countries.fields import CountryField
|
||||
|
||||
from django_extensions.db.fields import AutoSlugField
|
||||
from django_countries.fields import CountryField
|
||||
from multiselectfield import MultiSelectField
|
||||
from phonenumber_field.modelfields import PhoneNumberField
|
||||
|
||||
|
@ -7,9 +7,9 @@ from django.test import TestCase
|
||||
from django.urls import reverse
|
||||
from django.utils.translation import activate
|
||||
|
||||
from .views import DraftsAPI
|
||||
from .models import CaseStudy
|
||||
from .models import CaseStudyDraft
|
||||
from .views import DraftsAPI
|
||||
|
||||
|
||||
class CaseStudyDraftAPITests(TestCase):
|
||||
|
@ -1,4 +1,4 @@
|
||||
from django.urls import path
|
||||
from django.conf.urls import url
|
||||
from django.urls import reverse_lazy
|
||||
from django.views.generic import RedirectView
|
||||
from django.views.i18n import JavaScriptCatalog
|
||||
@ -6,35 +6,47 @@ from django.views.i18n import JavaScriptCatalog
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
path("", RedirectView.as_view(url=reverse_lazy("map")), name="index"),
|
||||
path("map", views.Map.as_view(), name="map"),
|
||||
path("case-study/create", views.CreateCaseStudySelector.as_view(), name="create"),
|
||||
path(
|
||||
"case-study/create/short",
|
||||
url(r"^$", RedirectView.as_view(url=reverse_lazy("map")), name="index"),
|
||||
url(
|
||||
r"^case-study/create/?$", views.CreateCaseStudySelector.as_view(), name="create"
|
||||
),
|
||||
url(
|
||||
r"^case-study/create/short/?$",
|
||||
views.CreateShortCaseStudy.as_view(),
|
||||
name="short-form",
|
||||
),
|
||||
path(
|
||||
"case-study/create/long", views.CreateLongCaseStudy.as_view(), name="long-form"
|
||||
url(
|
||||
r"^case-study/create/long/?$",
|
||||
views.CreateLongCaseStudy.as_view(),
|
||||
name="long-form",
|
||||
),
|
||||
path(
|
||||
"case-study/create/poi",
|
||||
url(
|
||||
r"^case-study/create/poi/?$",
|
||||
views.CreatePointOfInterest.as_view(),
|
||||
name="point-of-interest-form",
|
||||
),
|
||||
path(
|
||||
"case-study/create/success",
|
||||
url(
|
||||
r"^case-study/create/success/?$",
|
||||
views.CreateCaseStudySuccess.as_view(),
|
||||
name="form-success",
|
||||
),
|
||||
path("case-study/edit/<int:pk>", views.EditCaseStudy.as_view(), name="edit"),
|
||||
path("case-study/draft", views.DraftsAPI.as_view(), name="drafts"),
|
||||
url(
|
||||
r"^case-study/edit/(?P<pk>[\d]+)/?$", views.EditCaseStudy.as_view(), name="edit"
|
||||
),
|
||||
# Case study drafts
|
||||
url(r"^case-study/draft/?$", views.DraftsAPI.as_view(), name="drafts"),
|
||||
# View case studies
|
||||
# This should be last so that the above options will be tried first!
|
||||
path("case-study/<slug:slug>", views.ViewCaseStudyDetail.as_view(), name="detail"),
|
||||
url(
|
||||
r"^case-study/(?P<slug>[-\w]+)/?$",
|
||||
views.ViewCaseStudyDetail.as_view(),
|
||||
name="detail",
|
||||
),
|
||||
url(r"^map/?$", views.Map.as_view(), name="map"),
|
||||
# API
|
||||
path("jsi18n", JavaScriptCatalog.as_view(), name="javascript-catalogue"),
|
||||
path(
|
||||
"srs-autocomplete",
|
||||
url(r"^jsi18n/$", JavaScriptCatalog.as_view(), name="javascript-catalogue"),
|
||||
url(
|
||||
r"^srs-autocomplete/$",
|
||||
views.SpatialRefSysAutocomplete.as_view(),
|
||||
name="srs-autocomplete",
|
||||
),
|
||||
|
@ -1,27 +1,29 @@
|
||||
import json
|
||||
import logging
|
||||
import json
|
||||
|
||||
from dal import autocomplete
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
from django.contrib.auth.mixins import UserPassesTestMixin
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin
|
||||
from django.core.mail import send_mail
|
||||
from django.db.models import Q
|
||||
from django.http import HttpResponse
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.urls import reverse
|
||||
from django.urls import reverse_lazy
|
||||
from django.utils.translation import get_language
|
||||
from django.views import View
|
||||
from django.views.generic import DetailView
|
||||
from django.views.generic.base import TemplateView
|
||||
from django.views.generic.edit import CreateView
|
||||
from django.views.generic.edit import UpdateView
|
||||
from django.views.generic.edit import CreateView, UpdateView
|
||||
|
||||
from dal import autocomplete
|
||||
|
||||
from . import forms
|
||||
from . import models
|
||||
from apps.files.models import File
|
||||
|
||||
from . import models
|
||||
from . import forms
|
||||
from .models import CaseStudy, CaseStudyDraft, SpatialRefSys
|
||||
from .forms import ShortCaseStudyForm, LongCaseStudyForm
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
NOTIFY_MESSAGE = """
|
||||
@ -80,9 +82,9 @@ def delete_user_draft(user_id):
|
||||
""" Delete the draft of a given user """
|
||||
|
||||
try:
|
||||
draft = models.CaseStudyDraft.objects.get(author=user_id)
|
||||
draft = CaseStudyDraft.objects.get(author=user_id)
|
||||
draft.delete()
|
||||
except models.CaseStudyDraft.DoesNotExist:
|
||||
except CaseStudyDraft.DoesNotExist:
|
||||
pass
|
||||
|
||||
|
||||
@ -115,7 +117,7 @@ class BaseCreateForm(LoginRequiredMixin, FilesHandlerMixin, CreateView):
|
||||
|
||||
template_name = "map/form-case_study.html"
|
||||
success_url = reverse_lazy("form-success")
|
||||
model = models.CaseStudy
|
||||
model = CaseStudy
|
||||
|
||||
def form_valid(self, form):
|
||||
self.handle_files(form)
|
||||
@ -134,14 +136,14 @@ class BaseCreateForm(LoginRequiredMixin, FilesHandlerMixin, CreateView):
|
||||
class CreateShortCaseStudy(BaseCreateForm):
|
||||
"""View for short version of case study form."""
|
||||
|
||||
form_class = forms.ShortCaseStudyForm
|
||||
form_class = ShortCaseStudyForm
|
||||
form_type = "short"
|
||||
|
||||
|
||||
class CreateLongCaseStudy(BaseCreateForm):
|
||||
"""View for long version of case study form."""
|
||||
|
||||
form_class = forms.LongCaseStudyForm
|
||||
form_class = LongCaseStudyForm
|
||||
form_type = "long"
|
||||
|
||||
|
||||
@ -151,7 +153,7 @@ class CreateCaseStudySuccess(TemplateView):
|
||||
|
||||
class ViewCaseStudyDetail(DetailView):
|
||||
template_name = "map/detail.html"
|
||||
model = models.CaseStudy
|
||||
model = CaseStudy
|
||||
context_object_name = "case_study"
|
||||
|
||||
|
||||
@ -160,7 +162,7 @@ class BaseEditForm(LoginRequiredMixin, FilesHandlerMixin, UpdateView):
|
||||
|
||||
template_name = "map/form-case_study.html"
|
||||
success_url = reverse_lazy("form-success")
|
||||
model = models.CaseStudy
|
||||
model = CaseStudy
|
||||
|
||||
def form_valid(self, form):
|
||||
self.handle_files(form)
|
||||
@ -169,7 +171,7 @@ class BaseEditForm(LoginRequiredMixin, FilesHandlerMixin, UpdateView):
|
||||
|
||||
|
||||
class EditCaseStudy(UserPassesTestMixin, BaseEditForm):
|
||||
form_class = forms.ShortCaseStudyForm
|
||||
form_class = ShortCaseStudyForm
|
||||
|
||||
def test_func(self):
|
||||
if settings.FFCAN_EDIT is False:
|
||||
@ -186,7 +188,7 @@ class EditCaseStudy(UserPassesTestMixin, BaseEditForm):
|
||||
|
||||
class SpatialRefSysAutocomplete(autocomplete.Select2QuerySetView):
|
||||
def get_queryset(self):
|
||||
qs = models.SpatialRefSys.objects.all()
|
||||
qs = SpatialRefSys.objects.all()
|
||||
|
||||
if self.q:
|
||||
qs = qs.filter(
|
||||
@ -210,16 +212,14 @@ class DraftsAPI(LoginRequiredMixin, View):
|
||||
|
||||
def put(self, request):
|
||||
try:
|
||||
draft = models.CaseStudyDraft.objects.get(author=request.user)
|
||||
draft = CaseStudyDraft.objects.get(author=request.user)
|
||||
draft.data = request.body.decode()
|
||||
draft.save()
|
||||
return HttpResponse(status=200) # OK
|
||||
|
||||
except models.CaseStudyDraft.DoesNotExist:
|
||||
# If it doesn't exist, create it
|
||||
models.CaseStudyDraft.objects.create(
|
||||
author=request.user, data=request.body.decode()
|
||||
)
|
||||
CaseStudyDraft.objects.create(author=request.user, data=request.body.decode())
|
||||
return HttpResponse(status=201) # Created
|
||||
|
||||
def delete(self, request):
|
||||
|
@ -1,7 +1,6 @@
|
||||
import json
|
||||
|
||||
from django.forms import widgets
|
||||
|
||||
from apps.files.models import File
|
||||
|
||||
|
||||
|
3
apps/profiles/admin.py
Normal file
3
apps/profiles/admin.py
Normal file
@ -0,0 +1,3 @@
|
||||
# from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user