deny changes to Speaker and Event proposals when call for speakers for the camp is not open
This commit is contained in:
parent
027e89e4ab
commit
5bc4edf991
|
@ -49,7 +49,6 @@ class CustomUrlStorage(FileSystemStorage):
|
|||
|
||||
storage = CustomUrlStorage()
|
||||
|
||||
|
||||
class UserSubmittedModel(CampRelatedModel):
|
||||
"""
|
||||
An abstract model containing the stuff that is shared
|
||||
|
@ -97,6 +96,22 @@ class UserSubmittedModel(CampRelatedModel):
|
|||
def __str__(self):
|
||||
return '%s (submitted by: %s, status: %s)' % (self.headline, self.user, self.proposal_status)
|
||||
|
||||
def save(self, **kwargs):
|
||||
if not self.camp.call_for_speakers_open:
|
||||
message = 'Call for speakers is not open'
|
||||
if hasattr(self, 'request'):
|
||||
messages.error(self.request, message)
|
||||
raise ValidationError(message)
|
||||
super().save(**kwargs)
|
||||
|
||||
def delete(self, **kwargs):
|
||||
if not self.camp.call_for_speakers_open:
|
||||
message = 'Call for speakers is not open'
|
||||
if hasattr(self, 'request'):
|
||||
messages.error(self.request, message)
|
||||
raise ValidationError(message)
|
||||
super().delete(**kwargs)
|
||||
|
||||
|
||||
def get_speakerproposal_picture_upload_path(instance, filename):
|
||||
""" We want speakerproposal pictures saved as MEDIA_ROOT/public/speakerproposals/camp-slug/proposal-uuid/filename """
|
||||
|
|
Loading…
Reference in a new issue