Update to Django=1.6

This commit is contained in:
Volodymyr Hotsyk 2014-07-05 16:11:43 +03:00
parent d9ba22d6b6
commit 7596729ec1
11 changed files with 96 additions and 59 deletions

View file

@ -1,6 +1,7 @@
from django.conf.urls.defaults import url, patterns
from django.conf.urls import url, patterns
urlpatterns = patterns("symposion.boxes.views",
urlpatterns = patterns(
"symposion.boxes.views",
url(r"^([-\w]+)/edit/$", "box_edit", name="box_edit"),
)
)

View file

@ -1,8 +1,9 @@
from django.conf.urls.defaults import url, patterns
from django.conf.urls import url, patterns
PAGE_RE = r"(([\w-]{1,})(/[\w-]{1,})*)/"
urlpatterns = patterns("symposion.cms.views",
urlpatterns = patterns(
"symposion.cms.views",
url(r"^files/$", "file_index", name="file_index"),
url(r"^files/create/$", "file_create", name="file_create"),
url(r"^files/(\d+)/([^/]+)$", "file_download", name="file_download"),

View file

@ -1,6 +1,7 @@
from django.conf.urls.defaults import *
from django.conf.urls import patterns, url
urlpatterns = patterns("symposion.conference.views",
urlpatterns = patterns(
"symposion.conference.views",
url(r"^users/$", "user_list", name="user_list"),
)

View file

@ -1,18 +1,26 @@
from django.conf.urls.defaults import *
from django.conf.urls import patterns, url
urlpatterns = patterns("symposion.proposals.views",
urlpatterns = patterns(
"symposion.proposals.views",
url(r"^submit/$", "proposal_submit", name="proposal_submit"),
url(r"^submit/([\w\-]+)/$", "proposal_submit_kind", name="proposal_submit_kind"),
url(r"^submit/([\w\-]+)/$", "proposal_submit_kind",
name="proposal_submit_kind"),
url(r"^(\d+)/$", "proposal_detail", name="proposal_detail"),
url(r"^(\d+)/edit/$", "proposal_edit", name="proposal_edit"),
url(r"^(\d+)/speakers/$", "proposal_speaker_manage", name="proposal_speaker_manage"),
url(r"^(\d+)/speakers/$", "proposal_speaker_manage",
name="proposal_speaker_manage"),
url(r"^(\d+)/cancel/$", "proposal_cancel", name="proposal_cancel"),
url(r"^(\d+)/leave/$", "proposal_leave", name="proposal_leave"),
url(r"^(\d+)/join/$", "proposal_pending_join", name="proposal_pending_join"),
url(r"^(\d+)/decline/$", "proposal_pending_decline", name="proposal_pending_decline"),
url(r"^(\d+)/document/create/$", "document_create", name="proposal_document_create"),
url(r"^document/(\d+)/delete/$", "document_delete", name="proposal_document_delete"),
url(r"^document/(\d+)/([^/]+)$", "document_download", name="proposal_document_download"),
url(r"^(\d+)/join/$", "proposal_pending_join",
name="proposal_pending_join"),
url(r"^(\d+)/decline/$", "proposal_pending_decline",
name="proposal_pending_decline"),
url(r"^(\d+)/document/create/$", "document_create",
name="proposal_document_create"),
url(r"^document/(\d+)/delete/$", "document_delete",
name="proposal_document_delete"),
url(r"^document/(\d+)/([^/]+)$", "document_download",
name="proposal_document_download"),
)

View file

@ -1,23 +1,37 @@
from django.conf.urls.defaults import patterns, url
from django.conf.urls import patterns, url
urlpatterns = patterns("symposion.reviews.views",
url(r"^section/(?P<section_slug>[\w\-]+)/all/$", "review_section", {"reviewed": "all"}, name="review_section"),
url(r"^section/(?P<section_slug>[\w\-]+)/reviewed/$", "review_section", {"reviewed": "reviewed"}, name="user_reviewed"),
url(r"^section/(?P<section_slug>[\w\-]+)/not_reviewed/$", "review_section", {"reviewed": "not_reviewed"}, name="user_not_reviewed"),
url(r"^section/(?P<section_slug>[\w\-]+)/assignments/$", "review_section", {"assigned": True}, name="review_section_assignments"),
url(r"^section/(?P<section_slug>[\w\-]+)/status/$", "review_status", name="review_status"),
url(r"^section/(?P<section_slug>[\w\-]+)/status/(?P<key>\w+)/$", "review_status", name="review_status"),
url(r"^section/(?P<section_slug>[\w\-]+)/list/(?P<user_pk>\d+)/$", "review_list", name="review_list_user"),
url(r"^section/(?P<section_slug>[\w\-]+)/admin/$", "review_admin", name="review_admin"),
url(r"^section/(?P<section_slug>[\w\-]+)/admin/accept/$", "review_bulk_accept", name="review_bulk_accept"),
url(r"^section/(?P<section_slug>[\w\-]+)/notification/(?P<status>\w+)/$", "result_notification", name="result_notification"),
url(r"^section/(?P<section_slug>[\w\-]+)/notification/(?P<status>\w+)/prepare/$", "result_notification_prepare", name="result_notification_prepare"),
url(r"^section/(?P<section_slug>[\w\-]+)/notification/(?P<status>\w+)/send/$", "result_notification_send", name="result_notification_send"),
urlpatterns = patterns(
"symposion.reviews.views",
url(r"^section/(?P<section_slug>[\w\-]+)/all/$", "review_section",
{"reviewed": "all"}, name="review_section"),
url(r"^section/(?P<section_slug>[\w\-]+)/reviewed/$", "review_section",
{"reviewed": "reviewed"}, name="user_reviewed"),
url(r"^section/(?P<section_slug>[\w\-]+)/not_reviewed/$", "review_section",
{"reviewed": "not_reviewed"}, name="user_not_reviewed"),
url(r"^section/(?P<section_slug>[\w\-]+)/assignments/$", "review_section",
{"assigned": True}, name="review_section_assignments"),
url(r"^section/(?P<section_slug>[\w\-]+)/status/$", "review_status",
name="review_status"),
url(r"^section/(?P<section_slug>[\w\-]+)/status/(?P<key>\w+)/$",
"review_status", name="review_status"),
url(r"^section/(?P<section_slug>[\w\-]+)/list/(?P<user_pk>\d+)/$",
"review_list", name="review_list_user"),
url(r"^section/(?P<section_slug>[\w\-]+)/admin/$", "review_admin",
name="review_admin"),
url(r"^section/(?P<section_slug>[\w\-]+)/admin/accept/$",
"review_bulk_accept", name="review_bulk_accept"),
url(r"^section/(?P<section_slug>[\w\-]+)/notification/(?P<status>\w+)/$",
"result_notification", name="result_notification"),
url(r"^section/(?P<section_slug>[\w\-]+)/notification/(?P<status>\w+)/prepare/$",
"result_notification_prepare", name="result_notification_prepare"),
url(r"^section/(?P<section_slug>[\w\-]+)/notification/(?P<status>\w+)/send/$",
"result_notification_send", name="result_notification_send"),
url(r"^review/(?P<pk>\d+)/$", "review_detail", name="review_detail"),
url(r"^(?P<pk>\d+)/delete/$", "review_delete", name="review_delete"),
url(r"^assignments/$", "review_assignments", name="review_assignments"),
url(r"^assignment/(?P<pk>\d+)/opt-out/$", "review_assignment_opt_out", name="review_assignment_opt_out"),
url(r"^assignment/(?P<pk>\d+)/opt-out/$", "review_assignment_opt_out",
name="review_assignment_opt_out"),
)

View file

@ -1,15 +1,19 @@
from django.conf.urls.defaults import url, patterns
from django.conf.urls import url, patterns
urlpatterns = patterns("symposion.schedule.views",
urlpatterns = patterns(
"symposion.schedule.views",
url(r"^$", "schedule_conference", name="schedule_conference"),
url(r"^edit/$", "schedule_edit", name="schedule_edit"),
url(r"^list/$", "schedule_list", name="schedule_list"),
url(r"^presentations.csv$", "schedule_list_csv", name="schedule_list_csv"),
url(r"^presentation/(\d+)/$", "schedule_presentation_detail", name="schedule_presentation_detail"),
url(r"^presentation/(\d+)/$", "schedule_presentation_detail",
name="schedule_presentation_detail"),
url(r"^([\w\-]+)/$", "schedule_detail", name="schedule_detail"),
url(r"^([\w\-]+)/edit/$", "schedule_edit", name="schedule_edit"),
url(r"^([\w\-]+)/list/$", "schedule_list", name="schedule_list"),
url(r"^([\w\-]+)/presentations.csv$", "schedule_list_csv", name="schedule_list_csv"),
url(r"^([\w\-]+)/edit/slot/(\d+)/", "schedule_slot_edit", name="schedule_slot_edit"),
url(r"^([\w\-]+)/presentations.csv$", "schedule_list_csv",
name="schedule_list_csv"),
url(r"^([\w\-]+)/edit/slot/(\d+)/", "schedule_slot_edit",
name="schedule_slot_edit"),
)

View file

@ -1,10 +1,13 @@
from django.conf.urls.defaults import *
from django.conf.urls import patterns, url
urlpatterns = patterns("symposion.speakers.views",
urlpatterns = patterns(
"symposion.speakers.views",
url(r"^create/$", "speaker_create", name="speaker_create"),
url(r"^create/(\w+)/$", "speaker_create_token", name="speaker_create_token"),
url(r"^create/(\w+)/$", "speaker_create_token",
name="speaker_create_token"),
url(r"^edit/(?:(?P<pk>\d+)/)?$", "speaker_edit", name="speaker_edit"),
url(r"^profile/(?P<pk>\d+)/$", "speaker_profile", name="speaker_profile"),
url(r"^staff/create/(\d+)/$", "speaker_create_staff", name="speaker_create_staff"),
url(r"^staff/create/(\d+)/$", "speaker_create_staff",
name="speaker_create_staff"),
)

View file

@ -1,9 +1,11 @@
from django.conf.urls.defaults import patterns, url
from django.views.generic.simple import direct_to_template
from django.conf.urls import patterns, url
from django.views.generic import TemplateView
urlpatterns = patterns("symposion.sponsorship.views",
url(r"^$", direct_to_template, {"template": "sponsorship/list.html"}, name="sponsor_list"),
urlpatterns = patterns(
"symposion.sponsorship.views",
url(r"^$", TemplateView.as_view(template_name="sponsorship/list.html"),
name="sponsor_list"),
url(r"^apply/$", "sponsor_apply", name="sponsor_apply"),
url(r"^add/$", "sponsor_add", name="sponsor_add"),
url(r"^(?P<pk>\d+)/$", "sponsor_detail", name="sponsor_detail"),

View file

@ -1,13 +1,14 @@
from django.conf.urls.defaults import *
from django.conf.urls import patterns, url
urlpatterns = patterns("symposion.teams.views",
urlpatterns = patterns(
"symposion.teams.views",
# team specific
url(r"^(?P<slug>[\w\-]+)/$", "team_detail", name="team_detail"),
url(r"^(?P<slug>[\w\-]+)/join/$", "team_join", name="team_join"),
url(r"^(?P<slug>[\w\-]+)/leave/$", "team_leave", name="team_leave"),
url(r"^(?P<slug>[\w\-]+)/apply/$", "team_apply", name="team_apply"),
# membership specific
url(r"^promote/(?P<pk>\d+)/$", "team_promote", name="team_promote"),
url(r"^demote/(?P<pk>\d+)/$", "team_demote", name="team_demote"),

View file

@ -7,9 +7,9 @@ from django.contrib.sites.models import Site
def send_email(to, kind, **kwargs):
current_site = Site.objects.get_current()
ctx = {
"current_site": current_site,
"STATIC_URL": settings.STATIC_URL,
@ -19,12 +19,12 @@ def send_email(to, kind, **kwargs):
current_site.name,
render_to_string("emails/%s/subject.txt" % kind, ctx).strip()
)
message_html = render_to_string("emails/%s/message.html" % kind, ctx)
message_plaintext = strip_tags(message_html)
from_email = settings.DEFAULT_FROM_EMAIL
email = EmailMultiAlternatives(subject, message_plaintext, from_email, to)
email.attach_alternative(message_html, "text/html")
email.send()

View file

@ -12,18 +12,19 @@ import symposion.forms
class SignupView(account.views.SignupView):
form_class = symposion.forms.SignupForm
form_kwargs = {
"prefix": "signup",
}
def create_user(self, form, commit=True):
user_kwargs = {
"first_name": form.cleaned_data["first_name"],
"last_name": form.cleaned_data["last_name"]
}
return super(SignupView, self).create_user(form, commit=commit, **user_kwargs)
return super(SignupView, self).create_user(form, commit=commit,
**user_kwargs)
def generate_username(self, form):
def random_username():
@ -51,5 +52,6 @@ class LoginView(account.views.LoginView):
@login_required
def dashboard(request):
if request.session.get("pending-token"):
return redirect("speaker_create_token", request.session["pending-token"])
return redirect("speaker_create_token",
request.session["pending-token"])
return render(request, "dashboard.html")