示例#1
0
文件: urls.py 项目: Bouska/fognar
from django.conf.urls.defaults import patterns, url
from django.http import HttpResponse
from config.authentification import stop_anon
from course.views import CourseBone, WikiBone
from models import Course


def courses_for_the_market(request):
    already_added_courses = map(lambda x: x.app_id, request.user.profile.shortcut_set.filter(app="course"))
    courses = filter(lambda x: x["id"] not in already_added_courses, Course.objects.all().values())
    return HttpResponse(dumps(courses), mimetype="application/json")


urlpatterns = patterns('',
    url(r'^$',
        stop_anon(CourseBone.as_view()),
        name="course_bone"),

    url(r'^market/$',
        stop_anon(courses_for_the_market),
        name="course_bone"),

    url(r'^(?P<id>\d+)$',
        stop_anon(CourseBone.as_view()),
        name="course_bone_id"),

    url(r'^wiki/(?P<id>\d+)$',
        stop_anon(WikiBone.as_view()),
        name="wiki_bone_id"),
)
示例#2
0
文件: urls.py 项目: Bouska/fognar
# Copyright 2012, RespLab. All rights reserved.

from django.conf.urls.defaults import patterns, url
from config.authentification import stop_anon
from views import get_category


urlpatterns = patterns('',
    url(r'^get/(?P<object_id>[^/]+)$', stop_anon(get_category),
        name='category_get'),
)
示例#3
0
文件: urls.py 项目: ekatsah/fognar
# Copyright 2012, Cercle Informatique. All rights reserved.

from django.conf.urls.defaults import patterns, url
from config.authentification import stop_anon
from message.views import thread_bone, thread_typeid, message_bone

urlpatterns = patterns('',
    url(r'^t/$', 
        stop_anon(thread_bone.as_view()), 
        name="thread_bone"),

    url(r'^t/(?P<id>\d+)$', 
        stop_anon(thread_bone.as_view()), 
        name="thread_bone_id"),

    url(r'^r/(?P<type>course|group)/(?P<xid>\d+)$', 
        stop_anon(thread_typeid.as_view()), 
        name="thread_bone_type_id"),

    url(r'^m/(?P<tid>\d+)/$',
        stop_anon(message_bone.as_view()),
        name="message_bone"),

    url(r'^m/(?P<tid>\d+)/(?P<id>\d+)/$',
        stop_anon(message_bone.as_view()),
        name="message_bone_id"),
)
示例#4
0
文件: urls.py 项目: Bouska/fognar
# Copyright 2012, Cercle Informatique. All rights reserved.

from django.conf.urls.defaults import patterns, url
from config.authentification import stop_anon
from profile.views import ProfileBone


urlpatterns = patterns('',
    url(r'^(?P<id>\d+)',
        stop_anon(ProfileBone.as_view()),
        name="profile_bone_id"),
)
示例#5
0
文件: urls.py 项目: Bouska/fognar
def add_shortcut(request):
    form = NewShortcut(loads(request.raw_post_data))
    if not form.is_valid():
        return HttpResponse('<p>Bad data:</p>' + str(form.errors), status=400)

    max_position = Shortcut.objects.filter(user=request.user.profile).aggregate(Max('position'))['position__max']
    if not max_position:
        max_position = 1

    Shortcut.objects.create(user=request.user.profile,
        app=form.cleaned_data["app"],
        app_id=form.cleaned_data["app_id"],
        position=max_position + 1
    )
    return HttpResponse('success!')


urlpatterns = patterns('',
    url(r'^shortcuts/$',
        stop_anon(get_desktop_data),
        name="user_preference"),

    url(r'^shortcuts/remove/(?P<id>\d+)$',
        stop_anon(remove_shortcut),
        name="user_preference"),

    url(r'^shortcuts/add/$',
        stop_anon(add_shortcut),
        name="user_preference"),
)
示例#6
0
文件: urls.py 项目: ekatsah/fognar
# Copyright 2012, Cercle Informatique. All rights reserved.

from django.conf.urls.defaults import patterns, url
from config.authentification import stop_anon, uniq_post
from document.views import upload_file, upload_http, document_bone
from document.views import rate, document_typeid, page_bone

urlpatterns = patterns('',
    url(r'^d/$', 
        stop_anon(document_bone.as_view()), 
        name="document_bone"),

    url(r'^d/(?P<id>\d+)', 
        stop_anon(document_bone.as_view()), 
        name="document_bone_id"),

    url(r'^r/(?P<type>course|group)/(?P<cid>\d+)', 
        stop_anon(document_typeid.as_view()), 
        name="document_bone_type_id"),

    url(r'^p/(?P<did>\d+)/',
        stop_anon(page_bone.as_view()),
        name="document_page"),

    url(r'^upload_file', 
        stop_anon(uniq_post(upload_file)),
        name='document_upload_file'),

    url(r'^upload_http', 
        stop_anon(uniq_post(upload_http)),
        name='document_upload_http'),
示例#7
0
文件: urls.py 项目: ekatsah/fognar
# Copyright 2012, RespLab. All rights reserved.

from django.conf.urls.defaults import patterns, url
from config.authentification import stop_anon
from course.views import course_bone, wiki_bone

urlpatterns = patterns('',
    url(r'^$', 
        stop_anon(course_bone.as_view()), 
        name="course_bone"),

    url(r'^(?P<id>\d+)$', 
        stop_anon(course_bone.as_view()), 
        name="course_bone_id"),

    url(r'^wiki/(?P<id>\d+)$', 
        stop_anon(wiki_bone.as_view()), 
        name="wiki_bone_id"),
)
示例#8
0
文件: urls.py 项目: Bouska/fognar
# Copyright 2012, Cercle Informatique. All rights reserved.

from django.conf.urls.defaults import patterns, url
from config.authentification import stop_anon
from message.views import ThreadBone, ThreadBoneTypeId, MessageBone


urlpatterns = patterns('',
    url(r'^t/$',
        stop_anon(ThreadBone.as_view()),
        name="thread_bone"),

    url(r'^t/(?P<id>\d+)$',
        stop_anon(ThreadBone.as_view()),
        name="thread_bone_id"),

    url(r'^r/(?P<type>course|group)/(?P<xid>\d+)$',
        stop_anon(ThreadBoneTypeId.as_view()),
        name="thread_bone_type_id"),

    url(r'^m/$',
        stop_anon(MessageBone.as_view()),
        name="message_bone_all"),

    url(r'^m/(?P<tid>\d+)/$',
        stop_anon(MessageBone.as_view()),
        name="message_bone"),

    url(r'^m/(?P<tid>\d+)/(?P<id>\d+)/$',
        stop_anon(MessageBone.as_view()),
        name="message_bone_id"),
示例#9
0
文件: urls.py 项目: Bouska/fognar
# Copyright 2012, Cercle Informatique. All rights reserved.

from django.conf.urls.defaults import patterns, url
from config.authentification import stop_anon, uniq_post
from document.views import upload_file, upload_http, DocumentBone
from document.views import rate, DocumentBoneTypeId, PageBone


urlpatterns = patterns('',
    url(r'^d/$',
        stop_anon(DocumentBone.as_view()),
        name="document_bone"),

    url(r'^d/(?P<id>\d+)',
        stop_anon(DocumentBone.as_view()),
        name="document_bone_id"),

    url(r'^r/(?P<type>course|group)/(?P<cid>\d+)',
        stop_anon(DocumentBoneTypeId.as_view()),
        name="document_bone_type_id"),

    url(r'^p/(?P<did>\d+)/',
        stop_anon(PageBone.as_view()),
        name="document_page"),

    url(r'^upload_file',
        stop_anon(uniq_post(upload_file)),
        name='document_upload_file'),

    url(r'^upload_http',
        stop_anon(uniq_post(upload_http)),
示例#10
0
文件: urls.py 项目: Bouska/fognar
from django.conf.urls.defaults import patterns, url
from django.http import HttpResponse

from course.models import Course
from group.models import Group
from config.authentification import stop_anon


APPS_MODELS = {
    "course": Course,
    "group": Group,
}


def get_desktop_data(request):
    desktop = list(request.user.profile.shortcut_set.all().values())
    for shortcut in desktop:
        data = APPS_MODELS[shortcut["app"]].objects.get(id=shortcut["app_id"])
        shortcut["name"] = data.name
        shortcut["slug"] = data.slug
        shortcut["description"] = data.description
    return HttpResponse(dumps(desktop), mimetype="application/json")


urlpatterns = patterns('',
    url(r'^$',
        stop_anon(get_desktop_data),
        name="user_desktop"),
)
示例#11
0
文件: urls.py 项目: ekatsah/fognar
# Copyright 2012, Cercle Informatique. All rights reserved.

from django.conf.urls.defaults import patterns, url
from config.authentification import stop_anon
from profile.views import profile_bone


urlpatterns = patterns('',
    url(r'^(?P<id>\d+)', 
        stop_anon(profile_bone.as_view()), 
        name="profile_bone_id"),
)