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 @@
  • Change password
  • - {% url 'logout' as url %} + {% url 'account_logout' as url %}
  • Logout
  • @@ -154,7 +154,7 @@
  • Change password
  • - {% url 'logout' as url %} + {% url 'account_logout' as url %}
  • Logout
  • diff --git a/systers_portal/templates/meetup/meetup.html b/systers_portal/templates/meetup/meetup.html index a6b66df7..5bb3a5cd 100644 --- a/systers_portal/templates/meetup/meetup.html +++ b/systers_portal/templates/meetup/meetup.html @@ -11,6 +11,11 @@

    {{ meetup.title }}

    Venue: {{ meetup.venue }}

    +

    + Start Time: {{ meetup.start_time }} +   + End Time: {{ meetup.end_time }} +


    {{ meetup.description|safe }}

    diff --git a/systers_portal/templates/meetup/upcoming_meetups.html b/systers_portal/templates/meetup/upcoming_meetups.html index 7e69a397..cda0b14b 100644 --- a/systers_portal/templates/meetup/upcoming_meetups.html +++ b/systers_portal/templates/meetup/upcoming_meetups.html @@ -17,6 +17,8 @@

    Date: {{ meetup.date }} Time: {{ meetup.time|time:"H:i"|default:"TBA" }} Venue: {{ meetup.venue|default:"TBA" }} + Start Time: {{ meetup.start_time|default:"TBA" }} + End Time: {{ meetup.end_time|default:"TBA" }}

    {{ meetup.description|safe|truncatewords:30 }}