change the default for link icons, move import for speakerproposalmodel earlier in dode, and add mark_as_rejected() method on eventproposal model

This commit is contained in:
Thomas Steen Rasmussen 2018-06-03 23:36:07 +02:00
parent 23c42985ae
commit 4ad58188b2

View file

@ -36,7 +36,7 @@ class UrlType(CreatedUpdatedModel):
icon = models.CharField( icon = models.CharField(
max_length=100, max_length=100,
default='link', default='fas fa-link',
help_text="Name of the fontawesome icon to use without the 'fa-' part" help_text="Name of the fontawesome icon to use without the 'fa-' part"
) )
@ -250,10 +250,10 @@ class SpeakerProposal(UserSubmittedModel):
def mark_as_approved(self, request): def mark_as_approved(self, request):
""" Marks a SpeakerProposal as approved, including creating/updating the related Speaker object """ """ Marks a SpeakerProposal as approved, including creating/updating the related Speaker object """
speakerproposalmodel = apps.get_model('program', 'speakerproposal')
# create a Speaker if we don't have one # create a Speaker if we don't have one
if not hasattr(self, 'speaker'): if not hasattr(self, 'speaker'):
speakermodel = apps.get_model('program', 'speaker') speakermodel = apps.get_model('program', 'speaker')
speakerproposalmodel = apps.get_model('program', 'speakerproposal')
speaker = speakermodel() speaker = speakermodel()
speaker.proposal = self speaker.proposal = self
else: else:
@ -395,6 +395,13 @@ class EventProposal(UserSubmittedModel):
messages.success(request, "Event object %s has been created" % event) messages.success(request, "Event object %s has been created" % event)
def mark_as_rejected(self, request):
eventproposalmodel = apps.get_model('program', 'eventproposal')
self.proposal_status = eventproposalmodel.PROPOSAL_REJECTED
self.save()
messages.success(request, "EventProposal %s has been rejected" % self.title)
############################################################################### ###############################################################################