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

Commit

Permalink
Add slug field to EventBase via mixin
Browse files Browse the repository at this point in the history
  • Loading branch information
jmurty committed Oct 17, 2016
1 parent 4b387f8 commit 6458673
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
36 changes: 36 additions & 0 deletions icekit_events/migrations/0018_auto_20161017_1312.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion
import icekit_events.models


class Migration(migrations.Migration):

dependencies = [
('icekit_events', '0017_rename_event_to_eventbase'),
]

operations = [
migrations.AlterModelOptions(
name='eventbase',
options={'ordering': ('title', 'pk'), 'verbose_name': 'Event'},
),
migrations.AddField(
model_name='eventbase',
name='slug',
field=models.SlugField(default='', max_length=255),
preserve_default=False,
),
migrations.AlterField(
model_name='eventrepeatsgenerator',
name='end',
field=models.DateTimeField(default=icekit_events.models.default_ends, verbose_name=b'first end', db_index=True),
),
migrations.AlterField(
model_name='eventrepeatsgenerator',
name='start',
field=models.DateTimeField(default=icekit_events.models.default_starts, verbose_name=b'first start', db_index=True),
),
]
3 changes: 2 additions & 1 deletion icekit_events/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ def __str__(self):


@encoding.python_2_unicode_compatible
class EventBase(PolymorphicModel, AbstractBaseModel, PublishingModel):
class EventBase(PolymorphicModel, AbstractBaseModel, PublishingModel,
SlugMixin):
"""
A polymorphic event model with all basic event features.
Expand Down
1 change: 1 addition & 0 deletions icekit_events/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def test_create_event(self):
# Fill in and submit actual Event admin add form
form = response.forms[0]
form['title'].value = u"Test Event"
form['slug'].value = 'test-event'
response = form.submit()
self.assertEqual(302, response.status_code)
response = response.follow()
Expand Down

0 comments on commit 6458673

Please sign in to comment.