def test_templatetags(self):
        self.compile_bundles("webpack.config.simple.js")
        self.compile_bundles("webpack.config.app2.js")
        view = TemplateView.as_view(template_name="home.html")
        request = self.factory.get("/")
        result = view(request)
        self.assertIn(
            '<link type="text/css" href="/static/bundles/styles.css" rel="stylesheet"/>', result.rendered_content
        )
        self.assertIn('<script type="text/javascript" src="/static/bundles/main.js"></script>', result.rendered_content)

        self.assertIn(
            '<link type="text/css" href="/static/bundles/styles-app2.css" rel="stylesheet"/>', result.rendered_content
        )
        self.assertIn('<script type="text/javascript" src="/static/bundles/app2.js"></script>', result.rendered_content)
        self.assertIn('<img src="/static/my-image.png"/>', result.rendered_content)

        view = TemplateView.as_view(template_name="only_files.html")
        result = view(request)
        self.assertIn("var contentCss = '/static/bundles/styles.css'", result.rendered_content)
        self.assertIn("var contentJS = '/static/bundles/main.js'", result.rendered_content)

        self.compile_bundles("webpack.config.publicPath.js")
        view = TemplateView.as_view(template_name="home.html")
        request = self.factory.get("/")
        result = view(request)
        self.assertIn('<img src="http://custom-static-host.com/my-image.png"/>', result.rendered_content)
 def define_urls(self):
     return (
         url(r'^users/$',
             self.decorate(TemplateView.as_view(template_name='advreport_examples/users.html')),
             name='users'),
         url(r'^examples/$',
             self.decorate(TemplateView.as_view(template_name='advreport_examples/examples.html')),
             name='examples'),
     )
示例#3
0
    def get_context_data(self, **kwargs):
        context = TemplateView.get_context_data(self, **kwargs)
        assignment_id = self.kwargs['assignment_id']
        assignment = get_object_or_404(models.Assignment, identifier=assignment_id)
        question_id = self.kwargs['question_id']
        question = get_object_or_404(models.Question, id=question_id)

        # Limit number of rationales shown to a number between [0, AnswerAdmin.list_per_page]
        perpage = self.request.GET.get('perpage')
        try:
            perpage = int(perpage)
        except (TypeError, ValueError):
            perpage = None
        if (perpage is None) or (perpage <= 0) or (perpage > AnswerAdmin.list_per_page):
            perpage = AnswerAdmin.list_per_page

        sums, rationale_data = get_question_rationale_aggregates(assignment, question, perpage)
        context.update(
            assignment=assignment,
            question=question,
            summary_data=self.prepare_summary_data(sums),
            rationale_data=self.prepare_rationale_data(rationale_data),
            perpage=perpage,
        )
        return context
示例#4
0
    def get_context_data(self, **kwargs):
        context = TemplateView.get_context_data(self, **kwargs)
        try:
            related_project_list = []
            for related_project in Project.objects.exclude(id=kwargs.get('id')).order_by('?'):
                if not related_project.is_expired():
                    related_project_list.append(related_project)
            project = Project.objects.get(id=kwargs.get('id'))
            context['project'] = project
            # context['related_projects'] = Project.objects.exclude(id=kwargs.get('id').order_by('?'))[:3]
            context['related_projects'] = related_project_list[:3]
            context['pledges'] = Pledge.objects.filter(project=project).all()
            user = self.request.user
            if user.is_authenticated() and Pledge.objects.filter(project=project, user=user).exists():
                # starts here
                context['user_pledge'] = pledge = Pledge.objects.filter(project=project, user=user).first()
                if project.is_expired():
                    # Below code is used if campaign expired and achieved its goal, to help user fulfill pledge
                    payment_temp = PaymentTemp.objects.create(amount=pledge.amount, email_address=pledge.user.email,
                                flex_field="Fulfillment of pledge " + str(pledge.id),
                                referrer_url=self.request.get_full_path(), pledge_id=pledge.id)
                    form = PaymentTempForm(instance=payment_temp)
                    context['form'] = form
                    context['pt_id'] = payment_temp.id
                    # ends here
        except (Project.DoesNotExist, ValueError):
            raise Http404

        return context
示例#5
0
 def get_context_data(self, **kwargs):
     context = TemplateView.get_context_data(self, **kwargs)
     members = {}
     for member in I4pProfile.objects.filter(motto__isnull=False).exclude(motto__exact='').order_by("?"):
         members[member.get_full_name_or_username] = member.motto.replace('"', '').capitalize()
     context["members"] = members
     return context
示例#6
0
 def get_context_data(self, **kwargs):
     context = TemplateView.get_context_data(self, **kwargs)
     if self.mode == 'create':
         context['form'] = ProjectForm()
         context['mode'] = 'create'
     else:
         try:
             project_id = int(kwargs.get('id', ''))
             project = Project.objects.get(id=project_id)
             form = ProjectForm(instance=project)
             # logic for conditional editing
             # Google - How to make read only fields within Django form instance
             if project.is_expired():
                 form.fields['title'].widget.attrs['readonly'] = True
                 form.fields['summary'].widget.attrs['readonly'] = True
                 form.fields['goal'].widget.attrs['readonly'] = True
                 form.fields['period'].widget.attrs['readonly'] = True
                 form.fields['description'].widget.attrs['readonly'] = True
                 form.fields['team'].widget.attrs['readonly'] = True
                 form.fields['risks_and_challenges'].widget.attrs['readonly'] = True
             else:
                 form.fields['title'].widget.attrs['readonly'] = True
                 form.fields['summary'].widget.attrs['readonly'] = True
                 form.fields['goal'].widget.attrs['readonly'] = True
                 form.fields['period'].widget.attrs['readonly'] = True
             context['form'] = form
             context['mode'] = 'edit'
             context['id'] = project.id
             if project.author != self.request.user:
                 raise Http404
         except (Project.DoesNotExist, ValueError):
             raise Http404
     context['mode'] = self.mode
     return context
示例#7
0
文件: views.py 项目: cmjatai/cmj
    def get_context_data(self, **kwargs):

        if self.referencia:
            self.template_name = 'path/path_imagem.html'
            context = TemplateView.get_context_data(self, **kwargs)
            context['object'] = self.referencia

        elif self.documento:
            context = self.get_context_data_documento(**kwargs)
        elif self.classe:
            context = self.get_context_data_classe(**kwargs)
        else:
            context = TemplateView.get_context_data(self, **kwargs)
        context['path'] = '-path'

        return context
示例#8
0
文件: index.py 项目: gstrat/synenosis
    def get_context_data(self, **kwargs):
        context = TemplateView.get_context_data(self, **kwargs)
        context['title'] = 'Dashboard'
        context['title_icon'] = 'home'

        context['accounts'] = {
            'winbank': BankAccount.objects \
                .filter(institution__short_name='PIRBGRAA').count(),
            'nbg': BankAccount.objects \
                .filter(institution__short_name='ETHNGRAA').count(),
            'paypal': WalletAccount.objects \
                .filter(institution__short_name='PAYPAL').count(),
            'all': Account.objects.all(),
            'total': Account.objects.aggregate(Sum('balance'))
        }

        transactions = list(Transaction.objects.order_by('-posted').all())
        for trans in transactions:
            for account in context['accounts']['all']:
                if account.account_id == trans.this_account and \
                        account.account_type == trans.this_account_type:
                    trans.account = account
                    break
        context['transactions'] = transactions

        return context
    def test_request_blocking(self):
        # FIXME: This will work 99% time but there is no garauntee with the
        # 4 second thing. Need a better way to detect if request was blocked on
        # not.
        wait_for = 3
        view = TemplateView.as_view(template_name='home.html')

        with self.settings(DEBUG=True):
            open(settings.WEBPACK_LOADER['STATS_FILE'], 'w').write(json.dumps({'status': 'compiling'}))
            then = time.time()
            request = self.factory.get('/')
            result = view(request)
            t = Thread(target=self.compile_bundles, args=('webpack.config.simple.js', wait_for))
            t.start()
            result.rendered_content
            elapsed = time.time() - then
            t.join()
            self.assertTrue(elapsed > wait_for)

        with self.settings(DEBUG=False):
            self.compile_bundles('webpack.config.simple.js')
            then = time.time()
            request = self.factory.get('/')
            result = view(request)
            result.rendered_content
            elapsed = time.time() - then
            self.assertTrue(elapsed < wait_for)
示例#10
0
 def get_context_data(self, **kwargs):
     c = TemplateView.get_context_data(self, **kwargs)
     
     today = datetime.date.today()
     c['today'] = today # Added to the context so we can use it in the template
     
     # Query all tasks for the user, only parents, for this month
     c['tasks'] = Task.objects.filter(date__month=today.month,
                                      user=self.request.user,
                                      father__isnull=True)
     
     # Query all events for the user, for this month
     events = Event.objects.filter(date__month=today.month,
                                   user=self.request.user)
     
     # I need to put them under the correct day, so I create an ordered dict, using
     # the days of the month for as keys, and appending the events to the days
     # when the day of the event matches 
     c['events'] = OrderedDict()
     (_, last_day) = calendar.monthrange(today.year, today.month) # First argument discouraged
     
     # Initialize the OrderedDict
     for i in range(0, last_day):
         c['events'][datetime.date(today.year, today.month, i + 1)] = []
     
     # Fill the dict with events
     for event in events:
         c['events'][event.date].append(event)
     
     # returning the context
     return c
示例#11
0
 def get_root_urls(self):
     urlpatterns = [
         url('^$',
             self.article_view_class.as_view(),
             name='root',
             kwargs={'path': ''}),
         url('^create-root/$',
             article.CreateRootView.as_view(),
             name='root_create'),
         url('^missing-root/$',
             article.MissingRootView.as_view(),
             name='root_missing'),
         url('^_search/$',
             get_class_from_str(self.search_view_class).as_view(),
             name='search'),
         url('^_revision/diff/(?P<revision_id>\d+)/$',
             self.article_diff_view,
             name='diff'),
         url('^_revision/padlist/$',
             TemplateView.as_view(template_name="wiki/padlist.html",
                                  content_type='text/html'),
             name='padlist'),
         # url('^articlelist$',
         #     TemplateView.as_view(template_name="angular/templates/articlelist.html",
         #                          content_type='text/html'),
         #     name='articlelist'),
         # url('^article_view$',
         #     TemplateView.as_view(template_name="angular/templates/article_view.html",
         #                          content_type='text/html'),
         #     name='article_view'),
         #url('^ng$', 'wiki.views.ng.index',
         #    name='ng_article_view'),
     ]
     return urlpatterns
示例#12
0
    def get_context_data(self, **kwargs):
	context = TemplateView.get_context_data(self, **kwargs)
	
	context["data"] = get_all_data()
	context["authors"] = get_all_authors()

	return context
示例#13
0
 def dispatch(self, request, key):
     verification_key_object = get_object_or_404(VerificationKey, key=key)
     if not verification_key_object.is_valid:
         msg = u'Данная ссылка уже использовалась, попробуйте получить новую.'
         return {'message': msg}
     return TemplateView.dispatch(
         self, request, verification_key_object=verification_key_object)
    def test_jinja2(self):
        self.compile_bundles("webpack.config.simple.js")
        self.compile_bundles("webpack.config.app2.js")
        view = TemplateView.as_view(template_name="home.jinja")

        if django.VERSION >= (1, 8):
            settings = {
                "TEMPLATES": [
                    {
                        "BACKEND": "django_jinja.backend.Jinja2",
                        "APP_DIRS": True,
                        "OPTIONS": {
                            "match_extension": ".jinja",
                            "extensions": DEFAULT_EXTENSIONS + ["webpack_loader.contrib.jinja2ext.WebpackExtension"],
                        },
                    }
                ]
            }
        else:
            settings = {"TEMPLATE_LOADERS": ("django_jinja.loaders.FileSystemLoader", "django_jinja.loaders.AppLoader")}
        with self.settings(**settings):
            request = self.factory.get("/")
            result = view(request)
            self.assertIn(
                '<link type="text/css" href="/static/bundles/styles.css" rel="stylesheet"/>', result.rendered_content
            )
            self.assertIn(
                '<script type="text/javascript" src="/static/bundles/main.js"></script>', result.rendered_content
            )
    def test_request_blocking(self):
        # FIXME: This will work 99% time but there is no garauntee with the
        # 4 second thing. Need a better way to detect if request was blocked on
        # not.
        wait_for = 3
        view = TemplateView.as_view(template_name="home.html")

        with self.settings(DEBUG=True):
            open(settings.WEBPACK_LOADER[DEFAULT_CONFIG]["STATS_FILE"], "w").write(json.dumps({"status": "compiling"}))
            then = time.time()
            request = self.factory.get("/")
            result = view(request)
            t = Thread(target=self.compile_bundles, args=("webpack.config.simple.js", wait_for))
            t2 = Thread(target=self.compile_bundles, args=("webpack.config.app2.js", wait_for))
            t.start()
            t2.start()
            result.rendered_content
            elapsed = time.time() - then
            t.join()
            t2.join()
            self.assertTrue(elapsed > wait_for)

        with self.settings(DEBUG=False):
            self.compile_bundles("webpack.config.simple.js")
            self.compile_bundles("webpack.config.app2.js")
            then = time.time()
            request = self.factory.get("/")
            result = view(request)
            result.rendered_content
            elapsed = time.time() - then
            self.assertTrue(elapsed < wait_for)
示例#16
0
 def get_context_data(self, **kwargs):
     data = TemplateView.get_context_data(self, **kwargs)
     data['model_token'] = settings.BIMSYNC_TOKEN
     if self.request.method == 'GET' and 'bim_only' in self.request.GET:
         data['bim_only'] = True
     else:
         data['bim_only'] = False
     return data
示例#17
0
 def get_context_data(self, **kwargs):
     context = TemplateView.get_context_data(self, **kwargs)
     id = kwargs.get('id', '')
     try:
     	project = Project.objects.get(id=id)
     except Project.DoesNotExist:
     	raise Http404
     context['project'] = project
     return context
示例#18
0
 def get_context_data(self, **kwargs):
     context = TemplateView.get_context_data(self, **kwargs)
     form = AttributionAnalysisFilterForm(data=self.request.GET)
     if form.is_valid() and self.request.GET:
         context['username_data'], context['country_data'] = self.get_aggregates(
             form.cleaned_data.copy()
         )
     context.update(form=form)
     return context
示例#19
0
def mylogin(request):

  if request.method == 'POST':
    user = authenticate(username=request.POST['username'], password=request.POST['password'])
    if user is not None:
      if user.is_active:
        login(request, user)
        # success
	#return direct_to_template(request, 'aules/index.html')
        return HttpResponseRedirect('/')
      else:
        # disabled account
        #return direct_to_template(request, 'aules/inactive_account.html')
        return TemplateView.as_view(template_name='aules/inactive_account.html')
    else:
      # invalid login
      #return direct_to_template(request, 'aules/invalid_login.html')
	return TemplateView.as_view(template_name='aules/invalid_login.html')
示例#20
0
 def get_context_data(self, **kwargs):
     context = TemplateView.get_context_data(self, **kwargs)
     try:
         project_id = int(kwargs.get('id', ''))
         project = Project.objects.get(id=project_id)
     except (Project.DoesNotExist, ValueError):
         raise Http404
     context['project'] = project
     return context
示例#21
0
 def dispatch(self, request, *args, **kwargs):
     self.status = "closed"
     if "status" in request.GET and request.GET['status'] in ("*", "open", "closed"):
         self.status = request.GET['status']
         
     self.tracker = None
     if "tracker" in request.GET and request.GET['tracker'] in ("1", "2"):
         self.tracker = request.GET['tracker']
     
     return TemplateView.dispatch(self, request, *args, **kwargs)
示例#22
0
 def get_context_data(self, **kwargs):
     context = TemplateView.get_context_data(self, **kwargs)
     context["cubesviewer_cubes_url"] = settings.CUBESVIEWER_CUBES_URL
     context["cubesviewer_backend_url"] = settings.CUBESVIEWER_BACKEND_URL
     context["view_config"] = ''
     try:
         query = unquote(self.request.META['QUERY_STRING'])
         context["view_config"] = json_dumps(json_loads(query))
     except ValueError, e:
         pass
示例#23
0
文件: views.py 项目: cmjatai/cmj
    def get_context_data(self, **kwargs):
        context = TemplateView.get_context_data(self, **kwargs)
        context['path'] = '-path'

        np = self.get_noticias_dos_parlamentares()

        context['noticias_dos_parlamentares'] = np

        context['noticias_da_procuradoria'] = self.get_noticias_da_procuradoria()

        return context
示例#24
0
def register(request,template_name='register/p_register.html'):
    
    if request.user.is_authenticated():
        return HttpResponseRedirect(reverse('views.home'))
    
    template_var={}
    form = RegistrationForm()    
    if request.method == 'POST':
        form = RegistrationForm(request.POST.copy())
        if form.is_valid():
            username = form.cleaned_data['username']
            email = form.cleaned_data['email']
            password = form.cleaned_data['password']
            user = User.objects.create_user(username,email,password)
            if accounts_settings.USER_ACTIVE_BY_EMAIL == True:
                user.is_active = False
            user.save()
            if accounts_settings.USER_ACTIVE_BY_EMAIL == False:
                #if it's unnecessary to active by email, login directly.
                _login(request, email, password) 
                return HttpResponseRedirect(reverse('views.home'))
            else:
                """
                Generates a one-use only link for activation and sends to the user
                """
                from django.core.mail import send_mail
                email_template_name = 'register/activation_email.html'
                current_site = get_current_site(request)
                site_name = current_site.name
                domain = current_site.domain
                use_https = False
               
                t = loader.get_template(email_template_name)
                c = {
                    'email': user.email,
                    'domain': domain,
                    'site_name': site_name,
                    'uid': int_to_base36(user.id),
                    'user': user,
                    'token': default_token_generator.make_token(user),
                    'protocol': use_https and 'https' or 'http',
                    }
                
                try:
                    send_mail(_(u'%s:激活账户') % site_name,
                              t.render(Context(c)), None, [user.email])
                    return HttpResponseRedirect(reverse('accounts.views.register_complete'))
                except:
                    user.delete()
                    return TemplateView.as_view(template_name='register/register_fail.html')
                    
            
    template_var['form'] = form
    return render_to_response(template_name, template_var, context_instance=RequestContext(request))
示例#25
0
文件: views.py 项目: jponf/PCnstein
    def render_to_response(self, context):
        format = self.request.GET.get('format', 'html')

        if format.lower() == 'json':
            return JSONResponseMixin.render_to_response(self, context)
        elif format.lower() == 'xml':
            return XMLResponseMixin.render_to_response(self, context)
        elif format.lower() == 'html':
            return TemplateView.render_to_response(self, context)
        else:
            return HttpResponseBadRequest()
示例#26
0
文件: views.py 项目: wilsonc86/ledger
    def get_context_data(self, **kwargs):
        kwargs['form'] = ReportForm()
        kwargs['payments_form'] = PaymentsReportForm()
        kwargs['actions'] = {
            'applications': reverse('wl_reports:applications_report'),
            'licences': reverse('wl_reports:licences_report'),
            'returns': reverse('wl_reports:returns_report'),
            'payments': reverse('wl_payments:payments_report'),
        }

        return TemplateView.get_context_data(self, **kwargs)
示例#27
0
 def get_context_data(self, **kwargs):
     _context = TemplateView.get_context_data(self, **kwargs)
     _date_str = self.kwargs.get('date')
     _current_date = parser.parse(_date_str)
     
     _result = Devotional.objects.filter(month = _current_date.month, day = _current_date.day)
     
     if len(_result) > 0:
         _context.setdefault('object', _result[0])
 
     return _context
示例#28
0
文件: views.py 项目: cmjatai/cmj
    def dispatch(self, request, *args, **kwargs):

        slug = kwargs.get('slug', '')

        if not slug:
            raise Http404()

        result = self._pre_dispatch(request, *args, **kwargs)
        if result:
            return result

        return TemplateView.dispatch(self, request, *args, **kwargs)
示例#29
0
 def dispatch(self, request, key):
     try:
         verification_key_object = VerificationKey.objects.get(key=key)
     except VerificationKey.DoesNotExist:
         messages.error(request, u'Данная ссылка недействительна')
         return HttpResponseRedirect(reverse('reset_password_request'))
     if not verification_key_object.is_valid:
         msg = u'Данная ссылка уже использовалась, попробуйте получить новую.'
         messages.error(request, msg)
         return HttpResponseRedirect(reverse('reset_password_request'))
     return TemplateView.dispatch(
         self, request, verification_key_object=verification_key_object)
示例#30
0
 def get_context_data(self, **kwargs):
     context = TemplateView.get_context_data(self, **kwargs)
     self.assignment_id = self.kwargs['assignment_id']
     assignment = get_object_or_404(models.Assignment, identifier=self.assignment_id)
     sums, question_data = get_assignment_aggregates(assignment)
     switch_columns = sorted(k[1] for k in sums if isinstance(k, tuple) and k[0] == 'switches')
     context.update(
         assignment=assignment,
         assignment_data=self.prepare_assignment_data(sums, switch_columns),
         question_data=self.prepare_question_data(question_data, switch_columns),
     )
     return context
示例#31
0
from django.conf.urls.static import static
from django.contrib import admin
from django.views.generic.base import RedirectView, TemplateView

from readthedocs.core.urls import core_urls
from readthedocs.core.views import HomepageView, SupportView, do_not_track, server_error_500
from readthedocs.search.api import PageSearchAPIView
from readthedocs.search.views import SearchView

admin.autodiscover()

handler500 = server_error_500

basic_urls = [
    url(r'^$', HomepageView.as_view(), name='homepage'),
    url(r'^security/', TemplateView.as_view(template_name='security.html')),
    url(
        r'^\.well-known/security.txt$',
        TemplateView.as_view(template_name='security.txt',
                             content_type='text/plain'),
    ),
    url(r'^support/$', SupportView.as_view(), name='support'),
    # These are redirected to from the support form
    url(r'^support/success/$',
        TemplateView.as_view(template_name='support/success.html'),
        name='support_success'),
    url(r'^support/error/$',
        TemplateView.as_view(template_name='support/error.html'),
        name='support_error'),
]
示例#32
0
"""gitsearch URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from django.conf.urls import url, include
from django.views.generic.base import TemplateView

urlpatterns = [
    url(r'^admin/reports/$',
        TemplateView.as_view(template_name='admin/reports/reports.html')),
    path('admin/', admin.site.urls),
    url(r'^api/v1/user/', include('user.urls')),
]
示例#33
0
from django.urls import re_path
from django.http import HttpResponsePermanentRedirect as perma_redirect
from django.urls import reverse
from django.views.generic.base import TemplateView

from olympia.amo.views import frontend_view

urlpatterns = [
    re_path(
        r'^about$',
        frontend_view,
        name='pages.about',
    ),
    re_path(
        r'^google1f3e37b7351799a5\.html$',
        TemplateView.as_view(template_name='pages/google_webmaster_verification.html'),
    ),
    re_path(
        r'^google231a41e803e464e9\.html$',
        TemplateView.as_view(template_name='pages/google_search_console.html'),
    ),
    re_path(
        r'^review_guide$',
        frontend_view,
        name='pages.review_guide',
    ),
    re_path(
        r'^shield-study-2/',
        lambda req: perma_redirect(settings.SHIELD_STUDIES_SUPPORT_URL),
    ),
    re_path(
示例#34
0
"""GarageProject URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.0/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.urls import path, include
from django.contrib import admin
from django.views.generic.base import TemplateView

urlpatterns = [
    path('doors/', include('GarageControllerApp.urls')),
    path('admin/', admin.site.urls),
    path('accounts/', include('accounts.urls')),
    path('accounts/', include('django.contrib.auth.urls')),
    path('', TemplateView.as_view(template_name='home.html'), name='home'),
]
示例#35
0
 def get_context_data(self, **kwargs):
     context = TemplateView.get_context_data(self, **kwargs)
     context["cubesviewer_cubes_url"] = settings.CUBESVIEWER_CUBES_URL
     context["cubesviewer_backend_url"] = settings.CUBESVIEWER_BACKEND_URL
     return context
示例#36
0
from . import views

urlpatterns = [
    re_path(r'^jet/', include(('jet.urls', 'jet'))),
    re_path(r'^jet/dashboard/',
            include('jet.dashboard.urls', namespace='jet-dashboard')),
    path('admin/', admin.site.urls),
    path('', views.post_list, name='post_list'),
    path('post/<int:pk>/', views.post_detail, name='post_detail'),
    path('post/new', views.post_new, name='post_new'),
    path('post/<int:pk>/edit/', views.post_edit, name='post_edit'),
    path('post/<pk>/publish/', views.post_publish, name='post_publish'),
    path('drafts/', views.post_draft_list, name='post_draft_list'),
    path('post/<pk>/remove/', views.post_remove, name='post_remove'),
    path('accounts/', include('django.contrib.auth.urls')),  # new
    path('', TemplateView.as_view(template_name='base.html'), name='base'),
    url(
        r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/'
        r'(?P<post>[-\w]+)/$',
        views.post_detail,
        name='post_detail'),
    url(r'^about/$', views.about, name='about'),
    url('registration/register', views.register, name='register'),
    url(r'^search/$', views.search, name='search'),
    path('comment/<int:pk>/approve/',
         views.comment_approve,
         name='comment_approve'),
    path('comment/<int:pk>/remove/',
         views.comment_remove,
         name='comment_remove'),
    path('post/<int:pk>/comment/',
示例#37
0
from django.contrib import admin
from django.urls import path
from django.urls import include, path
from django.conf.urls.static import static
from django.conf import settings
from django.views.generic.base import TemplateView

urlpatterns = [
    path(r'', TemplateView.as_view(template_name="base.html")),
    path('admin/', admin.site.urls),
    path('api/v1/', include('lending.urls')),
    path('api-auth/', include('rest_framework.urls',
                              namespace='rest_framework')),
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
示例#38
0
    # Override email confirm to use allauth's HTML view instead of rest_auth's API view
    path("rest-auth/registration/account-confirm-email/<str:key>/", confirm_email),
    path("rest-auth/registration/", include("rest_auth.registration.urls")),
]

admin.site.site_header = "Rough Breeze"
admin.site.site_title = "Rough Breeze Admin Portal"
admin.site.index_title = "Rough Breeze Admin"

# swagger
api_info = openapi.Info(
    title="Rough Breeze API",
    default_version="v1",
    description="API documentation for Rough Breeze App",
)

schema_view = get_schema_view(
    api_info,
    public=True,
    permission_classes=(permissions.IsAuthenticated,),
)

urlpatterns += [
    path("api-docs/", schema_view.with_ui("swagger", cache_timeout=0), name="api_docs")
]


urlpatterns += [path("", TemplateView.as_view(template_name='index.html'))]
urlpatterns += [re_path(r"^(?:.*)/?$",
                TemplateView.as_view(template_name='index.html'))]
示例#39
0
文件: urls.py 项目: qdn2/project
The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.conf.urls import url, include
    2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import include, url
from django.contrib import admin
from django.contrib.auth import views as auth_views
from django.views.generic.base import TemplateView

## The following code is to direct url's to the correct html page note the following
## http://127.0.0.1:8000/home_page takes you to the home page of the web application
##	http://127.0.0.1:8000/database/search_restaurants takes you to the restaurants search engine
##	http://127.0.0.1:8000/database/search_recipes takes you to the recipes search engine

urlpatterns = [
    url(r'home_page',
        TemplateView.as_view(template_name='home_page.html'),
        name='home_page'),
    url(r'^database/', include('database.urls')),
    url(r'^admin/', admin.site.urls),
]
示例#40
0
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

# for some reason include('django.contrib.auth.urls') wouldn't work with {% url ... %} aka reverse() 
from django.contrib.auth import views as auth_views

urlpatterns = patterns('',
	url(r'^shib_login/$', 'accounts.shib_views.shib_login', name='shib_login'),
	url(r'^shib_hello/$', 'accounts.shib_views.shib_hello', name='shib_hello'),
	url(r'^login/$', auth_views.login, {'template_name': 'registration/login.html'}, name='login'),
	url(r'^logout/$', auth_views.logout_then_login, name='logout'),
	url(r'^change/$', 'accounts.views.change', name='registration_change'),
	url(r'^view/$', 'accounts.views.view', name='registration_view'),
	url(r'^password/change/$', auth_views.password_change, name='password_change'),
	url(r'^password/change/done/$', auth_views.password_change_done, name='password_change_done'),
	url(r'^password/reset/$', auth_views.password_reset, name='password_reset'),
        url(r'^password/reset/confirm/(?P<uidb36>[0-9A-Za-z]{1,13})-(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
           'django.contrib.auth.views.password_reset_confirm_uidb36'),
        url(r'^password/reset/confirm/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
            'django.contrib.auth.views.password_reset_confirm',
            name='password_reset_confirm'),
	url(r'^password/reset/complete/$', auth_views.password_reset_complete, name='password_reset_complete'),
	url(r'^password/reset/done/$', auth_views.password_reset_done, name='password_reset_done'),
	url(r'^register/$', 'accounts.views.register', name='registration_register'),
	url(r'^register/complete/$', TemplateView.as_view(template_name='registration/registration_complete.html'), name='registration_complete'),
	url(r'^register/allow/(?P<user_id>\d+)/$', 'accounts.views.activation_allow', name='activation_allow'),
	url(r'^activate/(?P<activation_key>.+)/$', 'accounts.views.activate', name='registration_activate'),
)

示例#41
0
 * email_change_done: the page after success email change
"""

app_name = 'auth'
urlpatterns = [
    # Log in, log out
    url(r'^login/$', views.login, name='login'),
    url(r'^logout/$', views.logout, name='logout'),
    url(r'^logout/successful/$',
        views.logout_successful,
        name='logout_successful'),

    # Registration
    url(r'^registration/$', views.registration, name='registration_register'),
    url(r'^activation/required/$',
        TemplateView.as_view(template_name='account/activation_required.html'),
        name='activation_required'),
    url(r'^registration/complete/$',
        TemplateView.as_view(
            template_name='account/registration_complete.html'),
        name='registration_complete'),

    # Password management
    url(r'^password/reset/$', views.password_reset, name='password_reset'),
    url(r'^password/change/$', views.password_change, name='password_change'),
    url(r'^password/change/done/$',
        views.password_change_done,
        name='password_change_done'),

    # Email management
    url(r'^email/change/$', views.email_change, name='email_change'),
示例#42
0
from cas import views as cas_views

from django.conf import settings
from django.conf.urls import url, include
from django.contrib import admin
from django.contrib.auth import views as auth_views
from django.contrib.auth.forms import PasswordResetForm
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.views.generic.base import TemplateView

urlpatterns = [
    url(r'^$', TemplateView.as_view(template_name='index.html'), name='home'),
    url(r'^about/$',
        TemplateView.as_view(template_name='index.html'),
        name='about'),
    url(r'^contact/sent/$',
        TemplateView.as_view(
            template_name='contact_form/contact_form_sent.html'),
        name='contact_form_sent'),
    url(r'^invalid-request$',
        TemplateView.as_view(template_name='invalid_request.html'),
        name='invalid_request'),
    url(r'^accounts/password/reset/$',
        auth_views.password_reset, {
            'template_name': 'accounts/password_reset_form.html',
            'password_reset_form': PasswordResetForm
        },
        name='password_reset'),
    url(r'^accounts/password/reset/done/$',
        auth_views.password_reset_done,
        {'template_name': 'accounts/password_reset_done.html'},
示例#43
0
    url(r'^api_v1/token-auth/',
        'rest_framework.authtoken.views.obtain_auth_token'),
    url(r'^api_doc/', include('rest_framework_swagger.urls')),
    url(r'^autocomplete/', include('autocomplete_light.urls')),
    url(r'^package_monitor/',
        include('package_monitor.urls', namespace='package_monitor')),
    url(r'^robots\.txt$', include('robots.urls')),
    url(r'^favicon.ico$',
        RedirectView.as_view(url=settings.STATIC_URL + 'icons/favicon.ico')),
    url(r'^sitemap\.xml$', 'django.contrib.sitemaps.views.index',
        {'sitemaps': sitemaps}),
    url(r'^sitemap-(?P<section>.+)\.xml$',
        'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps}),
    url(r'^news-sitemaps/', include('news_sitemaps.urls')),
    url(r'^__debug__/', include(debug_toolbar.urls)),
    url(r'^donate/$', views.DonationFormView.as_view(), name='donate'),
    url(r'^donate/thanks/$',
        views.DonationThanksView.as_view(),
        name='donate-thanks'),
    url(r'^landing/$', views.LandingView.as_view(), name='landing'),
)

if settings.DEBUG:
    urlpatterns += patterns(
        '',
        url(r'^media/(?P<path>.*)$', 'django.views.static.serve',
            {'document_root': settings.MEDIA_ROOT}),
        url(r'^500/$', TemplateView.as_view(template_name='500.html')),
        url(r'^404/$', TemplateView.as_view(template_name='404.html')),
    )
示例#44
0
from django.conf import settings
from django.conf.urls.i18n import i18n_patterns
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import include, path
from django.views.generic.base import TemplateView
from django.views.i18n import JavaScriptCatalog

admin.autodiscover()

urlpatterns = i18n_patterns(
    path("", include("accounts.urls")),
    path("", TemplateView.as_view(template_name="home.html"), name="home"),
    path("jsi18n/", JavaScriptCatalog.as_view(), name="javascript-catalog"),
    path("adminpanel/", admin.site.urls),
    path("filer/", include("filer.urls")),
    # CMS urls should be handled last to avoid possible conflicts
    path("cms/", include("cms.urls")),
)

urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

if not settings.DEBUG:
    handler500 = "tonis_piip_org.views.server_error"
    handler404 = "tonis_piip_org.views.page_not_found"

if settings.DEBUG:
    try:
        import debug_toolbar
示例#45
0
"""backend URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from django.conf.urls import include
from django.views.generic.base import TemplateView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('api/', include('backend.app.urls')),
    path('', TemplateView.as_view(template_name="index.html"), name="index")
]
示例#46
0
from .views import home, my_logout, HomePageView, MyView
from django.views.generic.base import TemplateView
from django.urls import path

urlpatterns = [
    path('', home, name="home"),
    path('logout/', my_logout, name="logout"),
    path('home2/', TemplateView.as_view(template_name='home2.html')),
    path(
        'home3/',
        HomePageView.as_view(),
    ),
    path('hello/', MyView.as_view())
]
示例#47
0
 url(
     regex='^topics/(?P<topic_slug>[-\w]+)/$',
     view=cache_page(STANDARD_CACHE_TIME)(TopicView.as_view()),
     kwargs={},
     name='topic_detail',
 ),
 url(
     regex='^examples/(?P<example_slug>[-\w]+)/$',
     view=cache_page(STANDARD_CACHE_TIME)(ExampleView.as_view()),
     kwargs={},
     name='example_detail',
 ),
 url(
     regex='^glossary/$',
     view=cache_page(STANDARD_CACHE_TIME)(
         TemplateView.as_view(template_name="glossary.html")),
     kwargs={},
     name='glossary',
 ),
 url(
     regex='^locate/$',
     view=cache_page(STANDARD_CACHE_TIME)(
         TemplateView.as_view(template_name="locate/locate.html")),
     kwargs={},
     name='locate',
 ),
 url(
     regex='^healthcheck$',
     view=HealthcheckView.as_view(),
     kwargs={},
     name='healthcheck',
示例#48
0
from django.conf import settings
from django.conf.urls.static import static
from django.urls import include, path
from django.views.generic.base import TemplateView

# Uncomment the next two lines to enable the admin:
from django.contrib import admin

admin.autodiscover()

urlpatterns = [
    path("", include("store.urls", namespace="store")),
    path("admin/", admin.site.urls),
    path("robots.txt",
         TemplateView.as_view(template_name="robots.txt",
                              content_type="text/plain"),
         name="robots"),
]

urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
示例#49
0
# -*- coding:utf-8 -*-
from django.conf.urls import patterns, url
from django.core.urlresolvers import reverse_lazy
from django.views.generic.base import TemplateView

from libs.decorators import login_required_for, EMPLOYEE, EMPLOYER
from . import views

urlpatterns = patterns('',
    url( r'^$',
        login_required_for((EMPLOYEE, EMPLOYER))(
        views.MembershipFormView.as_view()),
        name='home'),
    url(r'^coupon_validation/$',
        login_required_for((EMPLOYEE, EMPLOYER))(
        views.CouponValidationView.as_view()),
        name='coupon_validation'),
    url(r'^employee/current_plan/$',
        login_required_for(EMPLOYEE)(
        TemplateView.as_view(
            template_name='membership/employee_current_plan.html')),
        name='employee_current_plan'),
    url(r'^employer/current_plan/$',
        login_required_for(EMPLOYER)(
        TemplateView.as_view(
            template_name='membership/employer_current_plan.html')),
        name='employer_current_plan'),
)
示例#50
0
from django.views.generic.base import TemplateView, RedirectView

import JJDLP.views
import api.views
import library.views
import notebooks.views
import manuscripts.views
import texts.views

# static solely for developement:
from django.conf import settings

urlpatterns = patterns(
    '',
    url(r'^$',
        TemplateView.as_view(template_name='JJDLP/base.html'),
        name='home'),
    url(
        r'^favicon\.ico$',
        RedirectView.as_view(url='static/JJDLP/images/favicon.ico',
                             permanent=True)),
    url(r'^about/$',
        login_required(TemplateView.as_view(template_name='JJDLP/about.html')),
        name='about'),
    url(r'^bibliography/$',
        login_required(
            TemplateView.as_view(template_name='JJDLP/bibliography.html')),
        name='bibliography'),
    url(r'^stats/$',
        login_required(JJDLP.views.StatsView.as_view()),
        name='stats'),
示例#51
0
文件: urls.py 项目: Dengovskaya/kurs
"""
URLconf for registration and activation, using django-registration's
HMAC activation workflow.

"""

from django.conf.urls import include, url
from django.views.generic.base import TemplateView

from registration.backends.hmac.views import ActivationView, RegistrationView


urlpatterns = [
    url(r'^activate/complete/$',
        TemplateView.as_view(
            template_name='registration/activation_complete.html'
        ),
        name='registration_activation_complete'),
    # The activation key can make use of any character from the
    # URL-safe base64 alphabet, plus the colon as a separator.
    url(r'^activate/(?P<activation_key>[-:\w]+)/$',
        ActivationView.as_view(),
        name='registration_activate'),
    url(r'^register/$',
        RegistrationView.as_view(),
        name='registration_register'),
    url(r'^register/complete/$',
        TemplateView.as_view(
            template_name='registration/registration_complete.html'
        ),
        name='registration_complete'),
示例#52
0
"""nferoot URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Add an import:  from blog import urls as blog_urls
    2. Add a URL to urlpatterns:  url(r'^blog/', include(blog_urls))
"""
from django.conf.urls import include, url
from django.contrib import admin
from django.views.generic.base import TemplateView

urlpatterns = [
    url(r'^admin/', include(admin.site.urls)),
    url(r'^o/', include('oauth2_provider.urls', namespace='oauth2_provider')),
    url(r'^api/', include('api.urls')),
    url(r'^accounts/', include('registration.backends.default.urls')),
    url(r'^$', TemplateView.as_view(template_name='index.html'), name='index'),
]
示例#53
0
文件: urls.py 项目: shawnp/agiliq
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.conf import settings

from django.contrib import admin
from django.contrib.auth.views import login
from django.views.generic.base import TemplateView

admin.autodiscover()

#handler500 = 'agiliqpages.views.server_error'
handler500 = TemplateView.as_view(template_name="500.html")

urlpatterns = patterns(
    '',
    url(r'^', include('agiliqpages.urls')),
    url(r'^blog/', include('blogango.urls')),
    url(r'^login/$', login, name='dinette_login'),
    url(r'^demo/graphos/', include('graphosdemo.urls')),
    url(r'^demo/merchant/', include('app.urls')),
    url(r'^demo/dinette/', include('dinette.urls')),
    url(r'^demo/parsley/', include('parsleydemo.urls')),
    url(r'^team/leaves/', include('leave_tracker.urls')),
    url(r'^team/expensify/', include('exapp.urls')),
    url(r'^admin/', include(admin.site.urls)),
    url('^404$',
        TemplateView.as_view(template_name="404.html"),
        name='agiliqcom_notfound'),
    url('^500$',
        TemplateView.as_view(template_name="500.html"),
        name='agiliqcom_error'),
示例#54
0
        r'^package/(?P<package_name>[\w\-\+]+)/',
        include([
            url(r'^config$',
                PackageConfigView.as_view(),
                name="settings-package-config"),
        ])),
    url(r'^packages/new$',
        NewPackageView.as_view(),
        name="settings-packages-new"),
    url(r'^packages$', PackageSettingsView.as_view(),
        name="settings-packages"),
    url(r'^languages$',
        LanguagesSettingsView.as_view(),
        name="settings-languages"),
    url(r'^notification$',
        TemplateView.as_view(template_name="settings/notification.html"),
        name="settings-notification"),
    url(r'^jobs$',
        login_required(
            TemplateView.as_view(template_name="settings/jobs.html"),
            login_url="admin:index"),
        name="settings-jobs"),
    url(r'^graph-rules/new$',
        NewGraphRuleView.as_view(),
        name="settings-graph-rules-new"),
    url(r'^graph-rules$',
        GraphRulesSettingsView.as_view(),
        name="settings-graph-rules"),
    url(r'^logs$', LogsSettingsView.as_view(), name="settings-logs"),
]
示例#55
0
    url(r'^api/remove_weak_link',
        RemoveWeakLinkView.as_view(),
        name='remove_weak_link'),
    url(r'^api/geocoding_address_search_token',
        GeocodingAddressSearchTokenView.as_view(),
        name='geocoding_address_search_token'),
    url(r'^api/system_preference',
        SystemPreferenceView.as_view(),
        name='system_preference'),
    url(r'^api/', include(router.urls))
]

# URL Patterns
urlpatterns = [
    url(r'contact-us/$',
        TemplateView.as_view(
            template_name="wildlifecompliance/contact_us.html"),
        name='wc_contact'),
    url(r'further-info/$',
        RedirectView.as_view(
            url=
            'https://www.dpaw.wa.gov.au/plants-and-animals/licences-and-permits'
        ),
        name='wc_further_info'),
    url(r'^admin/', wildlifecompliance_admin_site.urls),
    url(r'^ledger/admin/', admin.site.urls, name='ledger_admin'),
    url(r'^chaining/', include('smart_selects.urls')),
    url(r'', include(api_patterns)),
    url(r'^$', views.WildlifeComplianceRoutingView.as_view(), name='wc_home'),
    url(r'^internal/', views.InternalView.as_view(), name='internal'),
    url(r'^external/', views.ExternalView.as_view(), name='external'),
    url(r'^external/application/(?P<application_pk>\d+)/$',
示例#56
0
"""mikou_test URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
from django.views.generic.base import TemplateView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('accounts/', include('django.contrib.auth.urls')),
    path('', TemplateView.as_view(template_name='index.html'), name='index'),
    path(r'^oauth/', include('social_django.urls', namespace='social')),
    path('', include('blogs.urls')),
    path('api/', include('api.urls')),
]
示例#57
0
    path("reset_password/",
         auth_views.PasswordResetView.as_view(
             template_name="password_management/password_reset.html"),
         name="reset_password"),
    path("password_reset/done/",
         auth_views.PasswordResetDoneView.as_view(
             template_name="password_management/password_reset_sent.html"),
         name="password_reset_done"),
    path("reset/<uidb64>/<token>/",
         auth_views.PasswordResetConfirmView.as_view(
             template_name="password_management/password_reset_form.html"),
         name="password_reset_confirm"),
    path('reset/done/',
         auth_views.PasswordResetCompleteView.as_view(
             template_name="password_management/password_reset_complete.html"),
         name="password_reset_complete"),
    path("", include("django.contrib.auth.urls")),
    path("", include("gifts.urls")),
    path("oauth/", include("social_django.urls", namespace="social")),
    path(
        "robots.txt",
        TemplateView.as_view(template_name="gifts/robots.txt",
                             content_type="text/plain"),
    ),
    path(
        "sitemap.xml",
        TemplateView.as_view(template_name="gifts/sitemaps.xml",
                             content_type="text/xml"),
    ),
]
示例#58
0
from django.conf.urls import patterns, include, url
from django.contrib.auth import admin
from django.views.generic.base import TemplateView

urlpatterns = patterns(
    '',
    url(r'^$', TemplateView.as_view(template_name='home.html'), name='home'),
    url(r'^api/feng/', include('feng.api.urls')),
    url(r'^api/accounts/', include('accounts.api.urls')),
)
    path("home/", include("home.urls")),
]

admin.site.site_header = "Engage School of Impact"
admin.site.site_title = "Engage School of Impact Admin Portal"
admin.site.index_title = "Engage School of Impact Admin"

# swagger
api_info = openapi.Info(
    title="Engage School of Impact API",
    default_version="v1",
    description="API documentation for Engage School of Impact App",
)

schema_view = get_schema_view(
    api_info,
    public=True,
    permission_classes=(permissions.IsAuthenticated, ),
)

urlpatterns += [
    path("api-docs/",
         schema_view.with_ui("swagger", cache_timeout=0),
         name="api_docs")
]

urlpatterns += [path("", TemplateView.as_view(template_name="index.html"))]
urlpatterns += [
    re_path(r"^(?:.*)/?$", TemplateView.as_view(template_name="index.html"))
]
示例#60
0
    # Admin URLs.
    url(r'^admin/', include(admin.site.urls)),
    url(r'^_autocomplete/', include('autocomplete_light.urls')),
    url(r'^jsi18n/$',
        allow_public(cache_page(60 * 60 * 24 * 365)(javascript_catalog)), {
            'domain': 'javascript',
            'packages': ['mozillians']
        },
        name='jsi18n'),
)

# In DEBUG mode, serve media files through Django, and serve error pages
# via predictable routes. Add in qunit tests.
if settings.DEBUG:
    # Remove leading and trailing slashes so the regex matches.
    media_url = settings.MEDIA_URL.lstrip('/').rstrip('/')
    urlpatterns += patterns(
        '',
        (r'^%s/(?P<path>.*)' % media_url, 'django.views.static.serve', {
            'document_root': settings.MEDIA_ROOT
        }),
        # Add the 404, 500, and csrf pages for testing
        (r'^404/$', handler404),
        (r'^500/$', handler500),
        (r'^csrf/$', handler_csrf),
        url(r'^test/qunit/$',
            TemplateView.as_view(template_name='qunit.html'),
            name="qunit_test"),
    )