diff --git a/maraudes/forms.py b/maraudes/forms.py index afc1359..fce4cc5 100644 --- a/maraudes/forms.py +++ b/maraudes/forms.py @@ -3,7 +3,7 @@ from django.forms import inlineformset_factory from notes.forms import NoteForm # Models from .models import Maraude, Rencontre -from .notes import Observation +from .notes import Observation, Signalement class MaraudeAutoDateForm(forms.ModelForm): @@ -24,6 +24,12 @@ class RencontreForm(forms.ModelForm): fields = ['lieu', 'heure_debut', 'duree'] +class SignalementForm(NoteForm): + + class Meta: + model = Signalement + fields = ['source', 'created_date', 'created_time', 'sujet', 'text'] + ObservationInlineFormSet = inlineformset_factory( Rencontre, Observation, form=NoteForm, diff --git a/maraudes/notes.py b/maraudes/notes.py index 3651443..1cfafc0 100644 --- a/maraudes/notes.py +++ b/maraudes/notes.py @@ -28,4 +28,9 @@ class Observation(Note): def note_bg_colors(self): return ("info", "info") +class Signalement(Note): + source = models.CharField('Source', max_length=128) + + def note_labels(self): return [self.source] + def note_bg_colors(self): return ('warning', 'alert') diff --git a/maraudes/templates/maraudes/index.html b/maraudes/templates/maraudes/index.html index 12a1407..2abbc74 100644 --- a/maraudes/templates/maraudes/index.html +++ b/maraudes/templates/maraudes/index.html @@ -17,6 +17,8 @@ {% include 'maraudes/panel_dernieres_maraudes.html' %} +{% include 'maraudes/panel_signalement.html' %} + {% if user.is_superuser %}