Skip to content

Commit b000720

Browse files
committed
Renaming PyCon SpecialEvent to ScheduledEvent
This is intended to reduce the "special" nature of these objects, and encourage/enforce that they're for _any_ scheduled event! Summary of changes: - Renamed the model, view, and template names - Edited the url prefix to be `/event/` rather than `special_event` - Created the necessary migration by manually editing the output of Django's `makemigrations`
1 parent 3b2cc9c commit b000720

12 files changed

+54
-32
lines changed

docs/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Apps:
2222
sponsorship
2323
registration
2424
finaid
25-
special_events
25+
scheduled_events
2626
deploying
2727
translation
2828
api

docs/special_events.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ Add events to Menus
2626
To add an event to the site menus, go to the Django admin, find the
2727
site tree called "main" and open it, then add a new item. Set the
2828
URL to the event's URL, minus the hostname part - e.g. if the
29-
full URL is ``https://us.pycon.org/2017/special_events/bigbash/``,
30-
just include ``/2017/special_events/bigbash/``.
29+
full URL is ``https://us.pycon.org/2018/scheduled_events/bigbash/``,
30+
just include ``/2018/scheduled_events/bigbash/``.

pycon/admin.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from pycon.models import (PyConProposalCategory, PyConSponsorTutorialProposal,
77
PyConTalkProposal, PyConTutorialProposal,
88
PyConPosterProposal, PyConLightningTalkProposal,
9-
PyConOpenSpaceProposal, SpecialEvent, EduSummitTalkProposal)
9+
PyConOpenSpaceProposal, ScheduledEvent, EduSummitTalkProposal)
1010

1111

1212
class ProposalMarkEditAdmin(MarkEditAdmin):
@@ -136,7 +136,7 @@ class SponsorTutorialAdmin(ProposalMarkEditAdmin):
136136
]
137137

138138

139-
class SpecialEventAdmin(MarkEditAdmin):
139+
class ScheduledEventAdmin(MarkEditAdmin):
140140
list_display = [
141141
'name',
142142
'start',
@@ -171,7 +171,7 @@ class EduSummitTalkAdmin(ProposalMarkEditAdmin):
171171
admin.site.register(PyConSponsorTutorialProposal, SponsorTutorialAdmin)
172172
admin.site.register(PyConLightningTalkProposal, LightningTalkAdmin)
173173
admin.site.register(EduSummitTalkProposal, EduSummitTalkAdmin)
174-
admin.site.register(SpecialEvent, SpecialEventAdmin)
174+
admin.site.register(ScheduledEvent, ScheduledEventAdmin)
175175

176176

177177
from account.models import Account, EmailAddress
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# -*- coding: utf-8 -*-
2+
from __future__ import unicode_literals
3+
4+
from django.db import migrations, models
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
('pycon', '0009_auto_20161002_1710'),
11+
]
12+
13+
operations = [
14+
migrations.RenameModel(
15+
old_name='SpecialEvent',
16+
new_name='ScheduledEvent',
17+
),
18+
migrations.AlterModelOptions(
19+
name='scheduledevent',
20+
options={'verbose_name': 'PyCon Scheduled Event'},
21+
),
22+
]

pycon/models.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ class Meta:
333333
register_proposal_model('open-space', PyConOpenSpaceProposal, 'Open Spaces')
334334

335335

336-
class SpecialEvent(models.Model):
336+
class ScheduledEvent(models.Model):
337337
name = models.CharField(max_length=100)
338338
slug = models.SlugField()
339339
location = models.CharField(max_length=100)
@@ -343,7 +343,7 @@ class SpecialEvent(models.Model):
343343
published = models.BooleanField(default=False)
344344

345345
class Meta:
346-
verbose_name = "PyCon Special Event"
346+
verbose_name = "PyCon Scheduled Event"
347347

348348
def get_absolute_url(self):
349-
return reverse('special_event', kwargs={'slug': self.slug})
349+
return reverse('scheduled_event', kwargs={'slug': self.slug})

pycon/program_export.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from symposion.proposals.models import ProposalKind
1414
from symposion.schedule.models import Presentation, Schedule
15-
from pycon.models import SpecialEvent
15+
from pycon.models import ScheduledEvent
1616
from pycon.sponsorship.models import Sponsor, SponsorLevel
1717

1818
from django.core.urlresolvers import reverse
@@ -29,7 +29,7 @@ def export(pardir='program_export/'):
2929
SponsorsExporter(pardir).export()
3030
PresentationsExporter(pardir).export()
3131
ScheduleExporter(pardir).export()
32-
SpecialEventsExporter(pardir).export()
32+
ScheduledEventsExporter(pardir).export()
3333

3434

3535
def full_url(url):
@@ -212,9 +212,9 @@ def export(self):
212212
self.write(filename, presentations)
213213

214214

215-
class SpecialEventsExporter(BaseExporter):
215+
class ScheduledEventsExporter(BaseExporter):
216216
fields = ['name', 'location', 'day', 'time', 'description', 'url']
217-
basedir = 'special_events/'
217+
basedir = 'scheduled_events/'
218218
description_fields = ['description']
219219

220220
def prepare_url(self, event):
@@ -230,8 +230,8 @@ def prepare_time(self, event):
230230
)
231231

232232
def export(self):
233-
queryset = SpecialEvent.objects.filter(published=True).order_by('start', 'name')
234-
filename = 'special_events_schedule'
233+
queryset = ScheduledEvent.objects.filter(published=True).order_by('start', 'name')
234+
filename = 'scheduled_events_schedule'
235235
self.write(filename, queryset)
236236

237237

pycon/tests/factories.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
from pycon.models import PyConProposalCategory, PyConProposal, \
1212
PyConTalkProposal, PyConTutorialProposal, ThunderdomeGroup, PyConLightningTalkProposal, \
13-
SpecialEvent, EduSummitTalkProposal
13+
ScheduledEvent, EduSummitTalkProposal
1414

1515
from symposion.proposals.models import ProposalKind
1616
from symposion.proposals.tests.factories import ProposalBaseFactory
@@ -87,9 +87,9 @@ class Meta:
8787
audience = "audience"
8888

8989

90-
class SpecialEventFactory(factory.django.DjangoModelFactory):
90+
class ScheduledEventFactory(factory.django.DjangoModelFactory):
9191
class Meta:
92-
model = SpecialEvent
92+
model = ScheduledEvent
9393

9494
name = factory.fuzzy.FuzzyText()
9595
slug = factory.fuzzy.FuzzyText()

pycon/tests/test_export.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from django.utils.timezone import now
1111
from pycon.sponsorship.models import Benefit
1212
from pycon.sponsorship.tests.factories import SponsorFactory
13-
from pycon.tests.factories import PyConTutorialProposalFactory, SpecialEventFactory
13+
from pycon.tests.factories import PyConTutorialProposalFactory, ScheduledEventFactory
1414
from symposion.conference.models import Conference, current_conference, Section
1515
from symposion.proposals.models import ProposalKind
1616
from symposion.schedule.models import Schedule, Slot, Day, SlotKind
@@ -39,9 +39,9 @@ def setUp(self):
3939
section = Section.objects.get(conference=conference, slug=slug)
4040
Schedule.objects.get_or_create(section=section)
4141

42-
def test_special_events_export(self):
43-
self.unpublished_special = SpecialEventFactory(published=False)
44-
self.published_special = SpecialEventFactory(published=True)
42+
def test_scheduled_events_export(self):
43+
self.unpublished_special = ScheduledEventFactory(published=False)
44+
self.published_special = ScheduledEventFactory(published=True)
4545
rsp = self.client.get(self.url)
4646
self.assertEqual(OK, rsp.status_code)
4747
self.assertEqual('attachment; filename=program_export.zip', rsp['Content-Disposition'])
@@ -50,7 +50,7 @@ def test_special_events_export(self):
5050
# Check out the zip - testzip() returns None if no errors found
5151
self.assertIsNone(zipfile.testzip())
5252

53-
fname = "program_export/special_events/csv/special_events_schedule.csv"
53+
fname = "program_export/scheduled_events/csv/scheduled_events_schedule.csv"
5454
file_contents = zipfile.open(fname, "U").read().decode('utf-8')
5555
self.assertIn(self.published_special.name, file_contents)
5656
self.assertIn(self.published_special.description, file_contents)

pycon/tests/test_views.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
from pycon.finaid.tests.utils import TestMixin
1313
from pycon.models import EduSummitTalkProposal, PyConTalkProposal, PyConProposal
14-
from pycon.tests.factories import SpecialEventFactory, PyConProposalCategoryFactory, \
14+
from pycon.tests.factories import ScheduledEventFactory, PyConProposalCategoryFactory, \
1515
PyConEduSummitProposalFactory, PyConLightningTalkProposalFactory, PyConTalkProposalFactory
1616
from symposion.conference.models import Conference, current_conference, Section
1717
from symposion.proposals.kinds import get_proposal_model
@@ -24,10 +24,10 @@ def format_datetime(dt):
2424
return format(dt, settings.DATE_FORMAT) + ", " + time_format(dt, settings.TIME_FORMAT)
2525

2626

27-
class SpecialEventViewTest(TestCase):
27+
class ScheduledEventViewTest(TestCase):
2828
def setUp(self):
2929
Conference.objects.get_or_create(id=settings.CONFERENCE_ID)
30-
self.event = SpecialEventFactory()
30+
self.event = ScheduledEventFactory()
3131

3232
def test_view_event(self):
3333
rsp = self.client.get(self.event.get_absolute_url())

pycon/urls.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
urlpatterns = patterns(
77
'',
88
url('program_export/', views.program_export, name='program_export'),
9-
url(r'^special_event/(?P<slug>.*)/$', views.special_event, name='special_event'),
9+
url(r'^event/(?P<slug>.*)/$', views.scheduled_event, name='scheduled_event'),
1010
)

pycon/views.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from django.http import HttpResponse
88
from django.shortcuts import get_object_or_404, render
99

10-
from pycon.models import SpecialEvent
10+
from pycon.models import ScheduledEvent
1111
from pycon.program_export import export
1212

1313

@@ -33,10 +33,10 @@ def program_export(request):
3333
pass
3434

3535

36-
def special_event(request, slug):
37-
"""Special event detail page"""
38-
event = get_object_or_404(SpecialEvent, slug=slug, published=True)
39-
return render(request, "special_event.html", {
36+
def scheduled_event(request, slug):
37+
"""Scheduled event detail page"""
38+
event = get_object_or_404(ScheduledEvent, slug=slug, published=True)
39+
return render(request, "scheduled_event.html", {
4040
'event': event,
4141
'page': {
4242
'title': event.name,

0 commit comments

Comments
 (0)