diff --git a/setup.py b/setup.py index 6efe6476..8122f890 100644 --- a/setup.py +++ b/setup.py @@ -52,6 +52,9 @@ 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': [ @@ -59,8 +62,6 @@ def read_file(filename): 'mock', 'django-nose == 1.4.2', 'Mutagen', - 'lxml', - dateutil, 'requests_cache', ], 'develop': [ diff --git a/speeches/models.py b/speeches/models.py index a7183f1c..cabf734c 100644 --- a/speeches/models.py +++ b/speeches/models.py @@ -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) @@ -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')) @@ -888,3 +888,4 @@ def create_or_update_speeches(self, instance): timestamp.save() return created_speeches + diff --git a/speeches/templates/speeches/section_form.html b/speeches/templates/speeches/section_form.html index a5b80425..1bfcc667 100644 --- a/speeches/templates/speeches/section_form.html +++ b/speeches/templates/speeches/section_form.html @@ -68,6 +68,9 @@