diff --git a/marine_mammal_incidents/filters.py b/marine_mammal_incidents/filters.py index 652c92d56..b77e00e04 100644 --- a/marine_mammal_incidents/filters.py +++ b/marine_mammal_incidents/filters.py @@ -1,5 +1,6 @@ from django.contrib.admin import SimpleListFilter from django.utils.translation import gettext_lazy as _ +import datetime class DateRangeFilter(SimpleListFilter): title = _('incident date range') # or use any title you want diff --git a/marine_mammal_incidents/forms.py b/marine_mammal_incidents/forms.py new file mode 100644 index 000000000..929d4baa0 --- /dev/null +++ b/marine_mammal_incidents/forms.py @@ -0,0 +1,25 @@ +from django import forms +from .models import Incident, Uploaded_file +from mapwidgets.widgets import MapboxPointFieldWidget + +class IncidentForm(forms.ModelForm): + comments = forms.CharField( + widget=forms.Textarea(attrs={'cols': '100', 'rows': '10'}), + required=False + ) + + class Meta: + model = Incident + fields = '__all__' + widgets = { + 'geo_location': MapboxPointFieldWidget(), + } + +class UploadedFileForm(forms.ModelForm): + class Meta: + model = Uploaded_file + fields = ['title', 'file'] + labels = { + 'title': 'Attachment name', + 'file': 'File' + } diff --git a/marine_mammal_incidents/templates/marine_mammal_incidents/create_incident.html b/marine_mammal_incidents/templates/marine_mammal_incidents/create_incident.html new file mode 100644 index 000000000..3e6961971 --- /dev/null +++ b/marine_mammal_incidents/templates/marine_mammal_incidents/create_incident.html @@ -0,0 +1,414 @@ +{% extends "base_wastd.html" %} +{% load static bootstrap4 %} + +{% block extra_style %} + {{ block.super }} + {{ form.media.css }} + + + + +{% endblock %} + +{% block breadcrumbs %} + +{% endblock %} + +{% block extra_head %} + {{ block.super }} + {{ form.media }} +{% endblock extra_head %} + +{% block page_content_inner %} +
Date | +Species | +Location | +Type | +
---|---|---|---|
{{ incident.incident_date }} | +{{ incident.species }} | +{{ incident.location_name }} | +{{ incident.get_incident_type_display }} | +
No incidents recorded yet. |