diff --git a/RIGS/models.py b/RIGS/models.py index 1d797552..b67377f2 100644 --- a/RIGS/models.py +++ b/RIGS/models.py @@ -1,9 +1,11 @@ +import hashlib +import datetime + from django.db import models from django.contrib.auth.models import AbstractUser from django.conf import settings -import hashlib import reversion -import datetime + # Create your models here. @@ -18,6 +20,9 @@ class Profile(AbstractUser): url = "https://www.gravatar.com/avatar/" + hashlib.md5(self.email).hexdigest() + "?d=identicon&s=500" return url + @property + def name(self): + return self.get_full_name() + ' "' + self.initials + '"' class RevisionMixin(object): @property @@ -163,7 +168,7 @@ class Event(models.Model, RevisionMixin): ) name = models.CharField(max_length=255) - person = models.ForeignKey('Person') + person = models.ForeignKey('Person', null=True, blank=True) organisation = models.ForeignKey('Organisation', blank=True, null=True) venue = models.ForeignKey('Venue') description = models.TextField(blank=True, null=True) diff --git a/RIGS/templates/RIGS/event_form.html b/RIGS/templates/RIGS/event_form.html index a52b92b0..34435adc 100644 --- a/RIGS/templates/RIGS/event_form.html +++ b/RIGS/templates/RIGS/event_form.html @@ -76,74 +76,135 @@ {% include 'form_errors.html' %}
{% csrf_token %} {% render_field form.is_rig style="display: none" %} - {% if not object.pk %} -
-
-
+ {% if not object.pk %} +
+
+
-
- {% endif %} -
-
-
Contact Details
-
-
- +
+ {% endif %} +
+
+
Contact Details
+
+
+ -
-
- +
+
+ -
- + -
-
- -
+ data-sourceurl="{% url 'api_secure' model='person' %}" + data-target="{{ form.person.id_for_label }}"/> +
+
+
-
- +
+
+ -
-
- +
+
+ -
- + + data-sourceurl="{% url 'api_secure' model='organisation' %}" + data-target="{{ form.organisation.id_for_label }}"/> +
+
+ +
+
+
+
+
+
+
+
Event Description
+
+
+ + +
+ {% render_field form.description class+="form-control" %} +
+
+
+
+
+ + +
+
+
Event Details
+
+
+
+ + +
+ {% render_field form.name class+="form-control" %} +
+
+
+ + +
+
+ + +
+
-
-
-
-
Event Description
-
- + -
- {% render_field form.description class+="form-control" %} +
+ +
+
+ {% render_field form.start_time type="time" class+="form-control" %}
-
-
-
- +
+ -
-
-
Event Details
-
-
+
+ +
+
+ {% render_field form.end_time type="time" class+="form-control end_time" %} +
+
+
+ 23:00 + 02:00 +
+
+
+ + {# Rig only information #} +
- +
- {% render_field form.name class+="form-control" %} + {% render_field form.access_at type="datetime-local" class+="form-control" %}
- +
-
- - -
- -
-
- -
+ {% render_field form.meet_at type="datetime-local" class+="form-control" %} +
+
+
+
+
+
- + -
- -
-
- {% render_field form.start_time type="time" class+="form-control" %} +
+ {% render_field form.status class+="form-control" %}
- + -
- -
-
- {% render_field form.end_time type="time" class+="form-control end_time" %} -
-
-
- 23:00 - 02:00 -
+
+ + +
- - {# Rig only information #} -
+ {#% include 'RIGS/eventitem_table.html' %#} +
+
+
- - -
- {% render_field form.access_at type="datetime-local" class+="form-control" %} -
-
-
- - -
- {% render_field form.meet_at type="datetime-local" class+="form-control" %} -
-
-
-
-
- -
-
-
-
- - -
- {% render_field form.status class+="form-control" %} -
-
- {#% include 'RIGS/eventitem_table.html' %#} -
-
-
-
- -
+
+