add missing import, remove unused import and minor changes

This commit is contained in:
Stephan Telling 2017-06-05 14:52:59 +02:00
parent 1e1008a582
commit 3141e8f588
No known key found for this signature in database
GPG key ID: D4892289F36ADA9B

View file

@ -1,11 +1,12 @@
import uuid, os
import uuid
import os
from datetime import timedelta
from django.contrib.postgres.fields import DateTimeRangeField
from django.contrib import messages
from django.db import models
from django.utils.text import slugify
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.core.exceptions import ValidationError
from django.core.urlresolvers import reverse_lazy
from django.core.files.storage import FileSystemStorage
@ -52,8 +53,10 @@ class CustomUrlStorage(FileSystemStorage):
return url
storage = CustomUrlStorage()
class UserSubmittedModel(CampRelatedModel):
"""
An abstract model containing the stuff that is shared
@ -126,6 +129,7 @@ def get_speakerproposal_picture_upload_path(instance, filename):
'filename': filename
}
def get_speakersubmission_picture_upload_path(instance, filename):
""" We want speakerproposal pictures saved as MEDIA_ROOT/public/speakerproposals/camp-slug/proposal-uuid/filename """
return 'public/speakerproposals/%(campslug)s/%(proposaluuid)s/%(filename)s' % {
@ -135,7 +139,6 @@ def get_speakersubmission_picture_upload_path(instance, filename):
}
class SpeakerProposal(UserSubmittedModel):
""" A speaker proposal """
@ -232,7 +235,10 @@ class EventProposal(UserSubmittedModel):
return self.title
def get_absolute_url(self):
return reverse_lazy('eventproposal_detail', kwargs={'camp_slug': self.camp.slug, 'pk': self.uuid})
return reverse_lazy(
'eventproposal_detail',
kwargs={'camp_slug': self.camp.slug, 'pk': self.uuid}
)
def mark_as_approved(self):
eventmodel = apps.get_model('program', 'event')
@ -253,7 +259,7 @@ class EventProposal(UserSubmittedModel):
self.save()
#############################################################################################
###############################################################################
class EventLocation(CampRelatedModel):
@ -464,9 +470,8 @@ class EventInstance(CampRelatedModel):
'url': str(self.event.get_absolute_url()),
'id': self.id,
'speakers': [
{ 'name': speaker.name
, 'url': str(speaker.get_absolute_url())
} for speaker in self.event.speakers.all()
{'name': speaker.name, 'url': str(speaker.get_absolute_url())}
for speaker in self.event.speakers.all()
],
'bg-color': self.event.event_type.color,
'fg-color': '#fff' if self.event.event_type.light_text else '#000',
@ -483,7 +488,6 @@ class EventInstance(CampRelatedModel):
return data
def get_speaker_picture_upload_path(instance, filename):
""" We want speaker pictures are saved as MEDIA_ROOT/public/speakers/camp-slug/speaker-slug/filename """
return 'public/speakers/%(campslug)s/%(speakerslug)s/%(filename)s' % {