Пример #1
0
from django.template.defaultfilters import slugify
from django.utils.translation import ugettext

from ella.galleries.views import gallery_item_detail, items
from ella.galleries.models import Gallery
from ella.core.custom_urls import dispatcher

dispatcher.register_custom_detail(Gallery, gallery_item_detail)
dispatcher.register(slugify(ugettext('items')), items, model=Gallery)

Пример #2
0
Файл: urls.py Проект: whit/ella
from ella.core.custom_urls import dispatcher
from django.template.defaultfilters import slugify
from django.utils.translation import ugettext as _
from ella.discussions.models import Topic
from ella.discussions.views import topic, topicthread, create_thread, post_reply
from ella.oldcomments.views import CommentFormPreview
from ella.oldcomments.forms import CommentForm

def discussion_custom_urls(request, bits, context):
    if len(bits) == 3:
        if bits[1] == slugify(_('comments')) and bits[2] == slugify(_('preview')):
            comment_preview = CommentFormPreview(CommentForm)
            return comment_preview(request, context)
        elif bits[1] == slugify(_('comments')) and bits[2] == slugify(_('new')):
            return post_reply(request, context, reply = None, thread = bits[0])
    if len(bits) == 4:
        if bits[2] == slugify(_('reply')) and bits[3].isdigit():
            return post_reply(request, context, reply = int(bits[3]), thread = bits[0])

    return topicthread(request, bits, context)

#dispatcher.register(slugify(_('ask')), ask_question, model=Topic)
#dispatcher.register(slugify(_('question')), question, model=Topic)
dispatcher.register(slugify(_('create thread')), create_thread)
dispatcher.register_custom_detail(Topic, topic)
dispatcher.register(slugify(_('posts')), discussion_custom_urls)



Пример #3
0
Файл: urls.py Проект: Almad/ella
from ella.core.custom_urls import dispatcher
from django.template.defaultfilters import slugify
from django.utils.translation import ugettext as _
from ella.discussions.models import Topic
from ella.discussions.views import topic, topicthread, create_thread, post_reply
from ella.oldcomments.views import CommentFormPreview
from ella.oldcomments.forms import CommentForm


def discussion_custom_urls(request, bits, context):
    if len(bits) == 3:
        if bits[1] == slugify(_("comments")) and bits[2] == slugify(_("preview")):
            comment_preview = CommentFormPreview(CommentForm)
            return comment_preview(request, context)
        elif bits[1] == slugify(_("comments")) and bits[2] == slugify(_("new")):
            return post_reply(request, context, reply=None, thread=bits[0])
    if len(bits) == 4:
        if bits[2] == slugify(_("reply")) and bits[3].isdigit():
            return post_reply(request, context, reply=int(bits[3]), thread=bits[0])

    return topicthread(request, bits, context)


# dispatcher.register(slugify(_('ask')), ask_question, model=Topic)
# dispatcher.register(slugify(_('question')), question, model=Topic)
dispatcher.register(slugify(_("create thread")), create_thread)
dispatcher.register_custom_detail(Topic, topic)
dispatcher.register(slugify(_("posts")), discussion_custom_urls)
Пример #4
0
from django.utils.translation import ugettext
from django.template.defaultfilters import slugify

from ella.core.custom_urls import dispatcher
from ella.interviews.views import unanswered, reply, detail, QuestionForm, QuestionFormPreview
from ella.interviews.models import Interview

# add Interview-specific functionality
dispatcher.register(slugify(ugettext('unanswered')), unanswered, model=Interview)
dispatcher.register(slugify(ugettext('reply')), reply, model=Interview)
dispatcher.register(slugify(ugettext('ask')), QuestionFormPreview(QuestionForm),  model=Interview)

# override Interview's detail view
dispatcher.register_custom_detail(Interview, detail)
Пример #5
0
from django.conf.urls.defaults import *
from django.utils.translation import ugettext_lazy as _

from ella.polls.models import Contest, Quiz
from ella.polls.views import poll_vote, quiz, contest, custom_result_details, cont_result, conditions
from ella.core.custom_urls import dispatcher


urlpatterns = patterns(
    "",
    # POLL - vote to poll alt1
    url(r"^(?P<poll_id>\d+)/vote/$", poll_vote, name="polls_vote"),
    # POLL - vote to poll alt2
    url(r"^poll/(?P<poll_id>\d+)/vote/$", poll_vote, name="polls_poll_vote"),
    # CONTEST - vote to contest
    # url(r'^contest/(?P<contest_id>\d+)/vote/$', contest_vote, name="polls_contest_vote"),
    # QUIZ - votes to quiz
    # url(r'^quiz/(?P<quiz_id>\d+)/vote/$', quiz_vote, name="polls_quiz_vote"),
)


dispatcher.register_custom_detail(Quiz, quiz)
dispatcher.register_custom_detail(Contest, contest)
dispatcher.register(_("results"), custom_result_details, model=Quiz)
dispatcher.register(_("result"), cont_result, model=Contest)
dispatcher.register(_("conditions"), conditions, model=Contest)