Start using django-recurrence for Events
This commit is contained in:
parent
be01304611
commit
74ee8e2d31
7 changed files with 45 additions and 3 deletions
|
@ -191,7 +191,7 @@ class TeamEventForm(forms.ModelForm):
|
||||||
class NewTeamEventForm(forms.ModelForm):
|
class NewTeamEventForm(forms.ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Event
|
model = Event
|
||||||
fields = ['name', 'start_time', 'end_time', 'summary']
|
fields = ['name', 'start_time', 'end_time', 'recurrences', 'summary']
|
||||||
widgets = {
|
widgets = {
|
||||||
'start_time': DateTimeWidget,
|
'start_time': DateTimeWidget,
|
||||||
'end_time': DateTimeWidget
|
'end_time': DateTimeWidget
|
||||||
|
|
30
events/migrations/0021_add_event_recurrence.py
Normal file
30
events/migrations/0021_add_event_recurrence.py
Normal file
File diff suppressed because one or more lines are too long
|
@ -7,7 +7,7 @@ from django.utils import timezone
|
||||||
|
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
from mptt.models import MPTTModel, TreeForeignKey
|
from mptt.models import MPTTModel, TreeForeignKey
|
||||||
|
from recurrence.fields import RecurrenceField
|
||||||
from imagekit.models import ImageSpecField
|
from imagekit.models import ImageSpecField
|
||||||
from imagekit.processors import ResizeToFill
|
from imagekit.processors import ResizeToFill
|
||||||
|
|
||||||
|
@ -61,6 +61,8 @@ class Event(models.Model):
|
||||||
|
|
||||||
start_time = models.DateTimeField(help_text=_('Date and time that the event starts'), verbose_name=_('Start Time'), db_index=True)
|
start_time = models.DateTimeField(help_text=_('Date and time that the event starts'), verbose_name=_('Start Time'), db_index=True)
|
||||||
end_time = models.DateTimeField(help_text=_('Date and time that the event ends'), verbose_name=_('End Time'), db_index=True)
|
end_time = models.DateTimeField(help_text=_('Date and time that the event ends'), verbose_name=_('End Time'), db_index=True)
|
||||||
|
recurrences = RecurrenceField(null=True)
|
||||||
|
|
||||||
summary = models.TextField(help_text=_('Summary of the Event'), blank=True, null=True)
|
summary = models.TextField(help_text=_('Summary of the Event'), blank=True, null=True)
|
||||||
|
|
||||||
place = models.ForeignKey(Place, blank=True, null=True, on_delete=models.CASCADE)
|
place = models.ForeignKey(Place, blank=True, null=True, on_delete=models.CASCADE)
|
||||||
|
|
|
@ -47,6 +47,7 @@ INSTALLED_APPS = [
|
||||||
'imagekit',
|
'imagekit',
|
||||||
'imagekit_cropper',
|
'imagekit_cropper',
|
||||||
'mptt',
|
'mptt',
|
||||||
|
'recurrence',
|
||||||
|
|
||||||
'get_together',
|
'get_together',
|
||||||
'events',
|
'events',
|
||||||
|
|
|
@ -1,9 +1,15 @@
|
||||||
{% extends "get_together/base.html" %}
|
{% extends "get_together/base.html" %}
|
||||||
|
{% load static %}
|
||||||
|
|
||||||
{% block extra_google_analytics %}
|
{% block extra_google_analytics %}
|
||||||
gtag('config', '{{settings.GOOGLE_ANALYTICS_ID}}', {'page_path': '/team/+create-event/'});
|
gtag('config', '{{settings.GOOGLE_ANALYTICS_ID}}', {'page_path': '/team/+create-event/'});
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block styles %}
|
||||||
|
<link rel="stylesheet" href="{% static 'recurrence/css/recurrence.css' %}">
|
||||||
|
<script src="{% static 'recurrence/js/recurrence.js' %}"></script>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>Plan a <strong>{{team.name}}</strong> get together</h2>
|
<h2>Plan a <strong>{{team.name}}</strong> get together</h2>
|
||||||
{% if event.parent %}<p class="text-muted">As part of <a href="{% url "show-common-event" event.parent.id event.parent.slug %}">{{ event.parent.name }}</a></p>{% endif %}
|
{% if event.parent %}<p class="text-muted">As part of <a href="{% url "show-common-event" event.parent.id event.parent.slug %}">{{ event.parent.name }}</a></p>{% endif %}
|
||||||
|
|
|
@ -42,7 +42,9 @@
|
||||||
<a href="{% url 'attend-event' event.id %}" class="btn btn-success btn-sm">Attend</a>
|
<a href="{% url 'attend-event' event.id %}" class="btn btn-success btn-sm">Attend</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<a href="{% url 'share-event' event.id %}" class="btn btn-primary btn-sm">Share</a>
|
<a href="{% url 'share-event' event.id %}" class="btn btn-primary btn-sm">Share</a>
|
||||||
</h2><p class="text-muted">Hosted by <a href="{% url "show-team" team.id %}">{{ team.name }}</a></p><hr/>
|
</h2>
|
||||||
|
<p class="text-muted">Hosted by <a href="{% url "show-team" team.id %}">{{ team.name }}</a></p>
|
||||||
|
<hr/>
|
||||||
|
|
||||||
<p>{{ event.summary|markdown }}</p>
|
<p>{{ event.summary|markdown }}</p>
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ django-imagekit==4.0.2
|
||||||
django-imagekit-cropper==1.16
|
django-imagekit-cropper==1.16
|
||||||
django-js-asset==1.0.0
|
django-js-asset==1.0.0
|
||||||
django-mptt==0.9.0
|
django-mptt==0.9.0
|
||||||
|
django-recurrence==1.5.0
|
||||||
django-settings-export==1.2.1
|
django-settings-export==1.2.1
|
||||||
djangorestframework==3.7.7
|
djangorestframework==3.7.7
|
||||||
future==0.16.0
|
future==0.16.0
|
||||||
|
|
Loading…
Reference in a new issue