Initial file uploding w/ new "files" app
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
from django.urls import reverse
|
||||
from django import forms
|
||||
from django.urls import reverse, reverse_lazy
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.utils.safestring import mark_safe
|
||||
|
||||
@ -18,6 +18,14 @@ class MinimumZoomWidget(LeafletWidget):
|
||||
|
||||
class BaseCaseStudyForm(forms.models.ModelForm):
|
||||
"""Base form class for the CaseStudy model."""
|
||||
|
||||
official_project_documents = forms.FileField(
|
||||
widget=forms.ClearableFileInput(attrs={
|
||||
'multiple': True,
|
||||
'data-url': reverse_lazy('files:upload'),
|
||||
})
|
||||
)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(BaseCaseStudyForm, self).__init__(*args, **kwargs)
|
||||
self.helper = FormHelper(self)
|
||||
@ -38,11 +46,15 @@ class BaseCaseStudyForm(forms.models.ModelForm):
|
||||
'SCALE': False
|
||||
}
|
||||
}),
|
||||
'official_project_documents': forms.ClearableFileInput(attrs={'multiple': True}),
|
||||
'other_documents': forms.ClearableFileInput(attrs={'multiple': True}),
|
||||
'shapefiles': forms.ClearableFileInput(attrs={'multiple': True}),
|
||||
}
|
||||
|
||||
class Media:
|
||||
js = (
|
||||
'files/jquery.ui.widget.js',
|
||||
'files/jquery.iframe-transport.js',
|
||||
'files/jquery.fileupload.js'
|
||||
)
|
||||
|
||||
|
||||
class ShortCaseStudyForm(BaseCaseStudyForm):
|
||||
"""Short version of the CaseStudy form."""
|
||||
|
18
apps/map/migrations/0056_delete_shapefile.py
Normal file
18
apps/map/migrations/0056_delete_shapefile.py
Normal file
@ -0,0 +1,18 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.6 on 2018-04-19 17:32
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('map', '0055_auto_20180419_1650'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.DeleteModel(
|
||||
name='Shapefile',
|
||||
),
|
||||
]
|
@ -17,8 +17,8 @@ from . import validators
|
||||
|
||||
class CaseStudyDraft(models.Model):
|
||||
author = models.ForeignKey(
|
||||
User,
|
||||
on_delete=models.CASCADE
|
||||
User,
|
||||
on_delete=models.CASCADE
|
||||
)
|
||||
|
||||
data = models.TextField()
|
||||
@ -36,12 +36,6 @@ class SpatialRefSys(connection.ops.spatial_ref_sys()):
|
||||
verbose_name = "spatial reference system"
|
||||
|
||||
|
||||
class Shapefile(models.Model):
|
||||
file = models.FileField(
|
||||
upload_to='shapefiles/',
|
||||
)
|
||||
|
||||
|
||||
class CaseStudyQuerySet(models.QuerySet):
|
||||
def approved(self):
|
||||
return self.filter(
|
||||
|
Reference in New Issue
Block a user