diff --git a/systers_portal/common/tests/test_views.py b/systers_portal/common/tests/test_views.py index 8b913a64..8976302f 100644 --- a/systers_portal/common/tests/test_views.py +++ b/systers_portal/common/tests/test_views.py @@ -38,7 +38,7 @@ def test_login_logout(self): # Log in the user self.client.login(username=u.username, password=u.password) # Check response code for logout - response = self.client.get(reverse('logout')) + response = self.client.get(reverse('account_logout')) self.assertEqual(response.status_code, 302) # Log out the user self.client.logout() diff --git a/systers_portal/meetup/forms.py b/systers_portal/meetup/forms.py index 753aff62..3c11006f 100644 --- a/systers_portal/meetup/forms.py +++ b/systers_portal/meetup/forms.py @@ -91,9 +91,12 @@ class AddMeetupForm(ModelFormWithHelper): """ class Meta: model = Meetup - fields = ('title', 'slug', 'date', 'time', 'venue', 'description', 'meetup_picture') + fields = ('title', 'slug', 'date', 'time', 'start_time', 'end_time', 'venue', 'description', + 'meetup_picture') widgets = {'date': forms.DateInput(attrs={'type': 'text', 'class': 'datepicker'}), - 'time': forms.TimeInput(attrs={'type': 'text', 'class': 'timepicker'})} + 'time': forms.TimeInput(attrs={'type': 'text', 'class': 'timepicker'}), + 'start_time': forms.TimeInput(attrs={'type': 'text', 'class': 'timepicker'}), + 'end_time': forms.TimeInput(attrs={'type': 'text', 'class': 'timepicker'})} helper_class = SubmitCancelFormHelper helper_cancel_href = "{% url 'about_meetup_location' meetup_location.slug %}" @@ -136,9 +139,11 @@ class EditMeetupForm(ModelFormWithHelper): """Form to edit Meetup""" class Meta: model = Meetup - fields = ('title', 'slug', 'date', 'time', 'description', 'venue') + fields = ('title', 'slug', 'date', 'time', 'start_time', 'end_time', 'description', 'venue') widgets = {'date': forms.DateInput(attrs={'type': 'date', 'class': 'datepicker'}), - 'time': forms.TimeInput(attrs={'type': 'time', 'class': 'timepicker'})} + 'time': forms.TimeInput(attrs={'type': 'time', 'class': 'timepicker'}), + 'start_time': forms.TimeInput(attrs={'type': 'time', 'class': 'timepicker'}), + 'end_time': forms.TimeInput(attrs={'type': 'time', 'class': 'timepicker'})} helper_class = SubmitCancelFormHelper helper_cancel_href = "{% url 'view_meetup' meetup_location.slug meetup.slug %}" diff --git a/systers_portal/meetup/migrations/0003_meetup_start_time.py b/systers_portal/meetup/migrations/0003_meetup_start_time.py new file mode 100644 index 00000000..78293b3c --- /dev/null +++ b/systers_portal/meetup/migrations/0003_meetup_start_time.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.6 on 2020-04-16 06:44 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('meetup', '0002_meetup_meetup_picture'), + ] + + operations = [ + migrations.AddField( + model_name='meetup', + name='start_time', + field=models.TimeField(null=True, verbose_name=b'Start Time'), + ), + ] diff --git a/systers_portal/meetup/models.py b/systers_portal/meetup/models.py index e26ff3a3..1b78a907 100644 --- a/systers_portal/meetup/models.py +++ b/systers_portal/meetup/models.py @@ -94,6 +94,7 @@ class Meetup(models.Model): date = models.DateField(verbose_name="Date") end_date = models.DateField(verbose_name="End Date", null=True) time = models.TimeField(verbose_name="Time", blank=True) + start_time = models.TimeField(verbose_name="Start Time", null=True) end_time = models.TimeField(verbose_name="End Time", null=True) venue = models.CharField(max_length=512, verbose_name="Venue", blank=True) description = models.TextField(verbose_name="Description") diff --git a/systers_portal/meetup/tests/test_forms.py b/systers_portal/meetup/tests/test_forms.py index d9edaac9..d8b91c78 100644 --- a/systers_portal/meetup/tests/test_forms.py +++ b/systers_portal/meetup/tests/test_forms.py @@ -126,7 +126,10 @@ def test_add_meetup_form(self): date = (timezone.now() + timedelta(2)).date() time = timezone.now().time() + start_time = timezone.now().time() + end_time = timezone.now().time() data = {'title': 'Foo', 'slug': 'foo', 'date': date, 'time': time, + 'start_time': start_time, 'end_time': end_time, 'description': "It's a test meetup."} form = AddMeetupForm(data=data, created_by=self.user, meetup_location=self.meetup_location) @@ -175,8 +178,11 @@ def test_edit_meetup_form(self): date = (timezone.now() + timedelta(2)).date() time = timezone.now().time() + start_time = timezone.now().time() + end_time = timezone.now().time() data = {'slug': 'foobar', 'title': 'Foo Bar', 'date': date, 'time': time, + 'start_time': start_time, 'end_time': end_time, 'description': "It's a test meetup.", 'venue': 'test address'} form = EditMeetupForm(instance=self.meetup, data=data) self.assertTrue(form.is_valid()) diff --git a/systers_portal/meetup/tests/test_views.py b/systers_portal/meetup/tests/test_views.py index 54527d45..e9b20fbe 100644 --- a/systers_portal/meetup/tests/test_views.py +++ b/systers_portal/meetup/tests/test_views.py @@ -189,7 +189,10 @@ def test_post_add_meetup_view(self): self.client.login(username='foo', password='foobar') date = (timezone.now() + timezone.timedelta(2)).date() time = timezone.now().time() + start_time = timezone.now().time() + end_time = timezone.now().time() data = {'title': 'BarTest', 'slug': 'bartest', 'date': date, 'time': time, + 'start_time': start_time, 'end_time': end_time, 'description': "It's a test meetup."} response = self.client.post(url, data=data) self.assertEqual(response.status_code, 302) @@ -481,7 +484,10 @@ def test_post_edit_meetup_view(self): date = (timezone.now() + timezone.timedelta(2)).date() time = timezone.now().time() + start_time = timezone.now().time() + end_time = timezone.now().time() data = {'title': 'BarTes', 'slug': 'bartes', 'date': date, 'time': time, + 'start_time': start_time, 'end_time': end_time, 'description': "It's a edit test meetup."} self.client.login(username='foo', password='foobar') response = self.client.post(url, data=data) diff --git a/systers_portal/templates/base.html b/systers_portal/templates/base.html index 69ea2af5..8b40e5f7 100644 --- a/systers_portal/templates/base.html +++ b/systers_portal/templates/base.html @@ -121,7 +121,7 @@
Venue: {{ meetup.venue }}
++ Start Time: {{ meetup.start_time }} + + End Time: {{ meetup.end_time }} +
{{ meetup.description|safe|truncatewords:30 }}