Skip to content
This repository has been archived by the owner on Jan 26, 2021. It is now read-only.

Commit

Permalink
Added start time and an end time in Meetup.
Browse files Browse the repository at this point in the history
  • Loading branch information
satya7289 committed Apr 16, 2020
1 parent 7b75f61 commit ad68c11
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 7 deletions.
2 changes: 1 addition & 1 deletion systers_portal/common/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
13 changes: 9 additions & 4 deletions systers_portal/meetup/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}"

Expand Down Expand Up @@ -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 %}"

Expand Down
20 changes: 20 additions & 0 deletions systers_portal/meetup/migrations/0003_meetup_start_time.py
Original file line number Diff line number Diff line change
@@ -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'),
),
]
1 change: 1 addition & 0 deletions systers_portal/meetup/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
6 changes: 6 additions & 0 deletions systers_portal/meetup/tests/test_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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())
Expand Down
6 changes: 6 additions & 0 deletions systers_portal/meetup/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions systers_portal/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
<li {% if url == request.path %}class="active"{% endif %}>
<a role="menuitem" href="{{ url }}">Change password</a>
</li>
{% url 'logout' as url %}
{% url 'account_logout' as url %}
<li {% if url == request.path %}class="active"{% endif %}>
<a role="menuitem" href="{{ url }}">Logout</a>
</li>
Expand Down Expand Up @@ -154,7 +154,7 @@
<li {% if url == request.path %}class="active"{% endif %}>
<a href="{{ url }}">Change password</a>
</li>
{% url 'logout' as url %}
{% url 'account_logout' as url %}
<li {% if url == request.path %}class="active"{% endif %}>
<a id="log-btn" href="{{ url }}">Logout</a>
</li>
Expand Down
5 changes: 5 additions & 0 deletions systers_portal/templates/meetup/meetup.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ <h2 id="meetup-title">{{ meetup.title }}</h2>
<p>
<b> Venue: </b> {{ meetup.venue }}
</p>
<p>
<b> Start Time: </b> {{ meetup.start_time }}
&nbsp;
<b>End Time: </b> {{ meetup.end_time }}
</p>
<hr>
{{ meetup.description|safe }} <br/>
<hr>
Expand Down
2 changes: 2 additions & 0 deletions systers_portal/templates/meetup/upcoming_meetups.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ <h3>
<span><strong>Date:</strong> {{ meetup.date }}</span>
<span><strong>Time:</strong> {{ meetup.time|time:"H:i"|default:"TBA" }}</span>
<span><strong>Venue:</strong> {{ meetup.venue|default:"TBA" }}</span>
<span><strong>Start Time:</strong> {{ meetup.start_time|default:"TBA" }}</span>
<span><strong>End Time:</strong> {{ meetup.end_time|default:"TBA" }}</span>
</p>
<p>
{{ meetup.description|safe|truncatewords:30 }}
Expand Down

0 comments on commit ad68c11

Please sign in to comment.