Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Issues/412 ability to clear sections/instance web/api #522

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,16 @@ def read_file(filename):
'django-subdomain-instances >= 1.0',
'easy-thumbnails >= 2.1',
'unicode-slugify == 0.1.1',
'requests',
'lxml',
dateutil,
] + ssl,
extras_require={
'test': [
'selenium < 3',
'mock',
'django-nose == 1.4.2',
'Mutagen',
'lxml',
dateutil,
'requests_cache',
],
'develop': [
Expand Down
7 changes: 4 additions & 3 deletions speeches/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ class Section(AuditedModel, InstanceMixin):
_('session'), blank=True, help_text=_('Legislative session'))
parent = models.ForeignKey(
'self', verbose_name=_('parent'), null=True, blank=True,
related_name='children')
related_name='children', on_delete=models.CASCADE)
slug = SluggableField(
_('slug'), unique_with=('parent', 'instance'), populate_from='title', always_update=True)
source_url = models.TextField(_('source URL'), blank=True)
Expand Down Expand Up @@ -590,8 +590,8 @@ class Speech(InstanceMixin, AudioMP3Mixin, AuditedModel):
# The section that this speech is part of
section = models.ForeignKey(
Section, verbose_name=_('Section'), blank=True, null=True,
on_delete=models.SET_NULL,
help_text=('The section that this speech is contained in'),)
on_delete=models.CASCADE,
help_text=('The section that this speech is contained in'))
num = models.TextField(
_('number'), blank=True,
help_text=_('The number of the speech, if relevant'))
Expand Down Expand Up @@ -888,3 +888,4 @@ def create_or_update_speeches(self, instance):
timestamp.save()

return created_speeches

3 changes: 3 additions & 0 deletions speeches/templates/speeches/section_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ <h1>{% trans "Add a section" %}</h1>

<div class="form-actions">
<input type="submit" id="section_submit" class="button" value="{{ submit }}">
{% if form.instance.id %}
<a href="{{ section.get_delete_url }}" class="button secondary">{% trans "Delete section" %}</a>
{% endif %}
</div>

</form>
Expand Down
1 change: 1 addition & 0 deletions speeches/templatetags/pagination_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,5 +135,6 @@ def paginate(context, window=DEFAULT_WINDOW, hashtag=''):
except (KeyError, AttributeError):
return {}


register.inclusion_tag('pagination/pagination.html', takes_context=True)(
paginate)