Beispiel #1
0
 def get_context_data(self, **kwargs):
     context = super(BoardView, self).get_context_data(**kwargs)              
     context['rates'] = requests.get('https://bank.gov.ua/NBUStatService/v1/statdirectory/exchange?json').json()
     context['eur'] = context['rates'][32]
     context['usd'] = context['rates'][26]
     context['rub'] = context['rates'][18]
     context['qa_list'] = Post.objects.filter(topic=1)
     context['news'] = NewsListView.get_queryset(self)
     context['laws'] = LawsListView.get_queryset(self)
     return context
Beispiel #2
0
from django.contrib import admin
from django.urls import include, path
# from .views import ContactListView, ProfileView
from django.views.generic import TemplateView
from .views import BoardView, CurrencyRateView
from news.views import NewsListView, LawsListView

urlpatterns = [
    path('', BoardView.as_view(), name='dashboard'),
    path('rates', CurrencyRateView.as_view(), name='rates'),
    path('news', NewsListView.as_view(), name='news'),
    path('laws', LawsListView.as_view(), name='laws'),
    # path('profile/<int:pk>/', ProfileView.as_view(), name='profile'),
]
Beispiel #3
0
from django.conf.urls import patterns, url

from news.views import NewsDetailView, NewsListView

urlpatterns = patterns(
    '',
    url(r'^(?P<pk>\d+)/detail/$', NewsDetailView.as_view(),
        name='news_detail'),
    url(r'^list/$', NewsListView.as_view(), name='news_list'),
)
Beispiel #4
0
"""News URLs module."""

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

urlpatterns = [
    url(r"^$", NewsListView.as_view(), name="home"),
    url(r"^welcome/$", TemplateView.as_view(template_name="extras/welcome.html"), name="welcome"),
    url(r"^news/add/$", "news.views.add_new", name="add"),
    url(r"^news/vote_up/(?P<new_id>\d+)/$", "news.views.vote_up", name="vote-up"),
]
Beispiel #5
0
from django.conf.urls import url
from news.views import NewsListView, NewsDetailView

urlpatterns = [
    url(r'^$', NewsListView.as_view()),
    url(r'^(?P<new_slug>[\w\-]+)/$',
        NewsDetailView.as_view(),
        name="news_detail"),
]
Beispiel #6
0
from django.urls import path

from news.views import NewsCreateView, NewsListView, NewsUpdateView, NewsDeleteView

app_name = 'news'

urlpatterns = [
    path('create/', NewsCreateView.as_view(), name='create'),
    path('update/<int:pk>/', NewsUpdateView.as_view(), name='update'),
    path('delete/<int:pk>/', NewsDeleteView.as_view(), name='delete'),
    path('', NewsListView.as_view(), name='list'),
]
Beispiel #7
0
# __author__ = "MaRuiMin"
from django.urls import path

from news.views import NewsListView, post_news, NewsDeleteView, like, get_thread, post_reply, update_interactions

app_name = 'news'

urlpatterns = [
    path(r'', NewsListView.as_view(), name="list"),
    path('post-news/', post_news, name='post_news'),
    path('delete/<str:pk>', NewsDeleteView.as_view(), name='delete_news'),
    path('like/', like, name='like_post'),
    path('get-thread/', get_thread, name='get_thread'),
    path('post-comment/', post_reply, name='post_comments'),
    path('update-interactions/',
         update_interactions,
         name='update_interactions'),
]
Beispiel #8
0
from django.urls import re_path
from django.contrib.auth.decorators import permission_required
from news.views import NewsListView, NewDetailView, NewCreate, NewUpdate, NewDelete

urlpatterns = [
    re_path(r'^$', NewsListView.as_view(), name='news_index'),
    re_path(r'^(?P<pk>\d+)$', NewDetailView.as_view(), name='news_detail'),
    re_path(r'^add/$',
            permission_required('news.add_new')(NewCreate.as_view()),
            name='news_add'),
    re_path(r'^(?P<pk>\d+)/edit/$',
            permission_required('news.change_new')(NewUpdate.as_view()),
            name='news_edit'),
    re_path(r'^(?P<pk>\d+)/delete/$',
            permission_required('news.delete_new')(NewDelete.as_view()),
            name='news_delete'),
]
Beispiel #9
0
                         'customer.views.reservation'),
                        )

urlpatterns += patterns('',
                        # Product urls
                        (r'^store/details/(?P<pk>\d+)/$',
                         ProductsDetailView.as_view()),
                        (r'^store/$', 'store.views.main_index'),
                        (r'^store/category/(\d+)/$',
                         ProductsListView.as_view()),
                        (r'^store/info/$', 'store.views.info'),
                        )

urlpatterns += patterns('',
                        (r'^news/$', 'news.views.main_index'),
                        (r'^news/search/(\w+)/$', NewsListView.as_view()),
                        (r'^news/search/(\d{4})/(\d{1,2})/$',
                         NewsListView.as_view()),
                        (r'^news/details/(?P<pk>\d+)/$',
                         NewsDetailView.as_view()),
                        )

urlpatterns += patterns('',
                        (r'^static/(?P<path>.*)$',
                         'django.views.static.serve',
                         {'document_root': 'static/'}),
                        (r'^media/(?P<path>.*)$',
                         'django.views.static.serve',
                         {'document_root': 'media/'}),
                        )
from django.urls import path

from news.views import (
    NewsListView,
    # index_view,
    # edit_news,
    # news_detail,
    NewsDetailView,
    # add_news,
    NewsCreateView,
    # delete_news,
    NewsDeleteView,
    add_comment,
    NewsUpdateView,
)

urlpatterns = [
    path('', NewsListView.as_view(), name='index'),
    path('edit/<slug:slug>/', NewsUpdateView.as_view(), name='edit_news'),
    path('news/<slug:slug>/', NewsDetailView.as_view(), name='detail_news'),
    path('add-news/', NewsCreateView.as_view(), name='add_news'),
    path('delete-news/<slug:slug>',
         NewsDeleteView.as_view(),
         name='delete_news'),
    path('add-comment/<slug:slug>', add_comment, name='add_comment'),
]
Beispiel #11
0
from django.urls import path

from news.views import NewsListView, NewsDetailView

app_name = 'news'

urlpatterns = [
    path('', NewsListView.as_view(), name='list'),
    path('category/<int:pk>', NewsListView.as_view(), name='category'),
    path('news/<int:pk>', NewsDetailView.as_view(), name='detail')
]
Beispiel #12
0
from django.urls import path
from django.conf.urls import url
from news.views import NewsListView, NewsView, SubmitArticleView, simple_upload

urlpatterns = [
    path('', NewsListView.as_view(), name='news_list'),
    path('<str:tag>', NewsListView.as_view(), name='news_list'),
    path('article/<slug:slug>/', NewsView.as_view(), name='news'),
    path('submit-new/', SubmitArticleView.as_view(), name='submit-news'),
    url(r'^upload-image/', simple_upload, name='upload-image'),
]
Beispiel #13
0
from main.views import RulesView
from django.contrib import admin
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.contrib.flatpages import views
from django.views.generic.base import TemplateView

from news.views import NewsListView

urlpatterns = patterns(
    '',
    url(r'^$', NewsListView.as_view(), name='index'),
    url(r'^rules/$', RulesView.as_view(), name='rules'),
    url(r'^tourney/', include('tourney.urls')),

    # Uncomment the next line to enable the admin:
    url(r'^admin/', include(admin.site.urls)),
    url(r'^news/', include('news.urls')),
    url(r'^ckeditor/', include('ckeditor_uploader.urls')),
    url(r'^med/', include('media.urls')))

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

urlpatterns += [
    url(r'^translation/$',
        views.flatpage, {'url': '/translation/'},
        name='translation'),
]
Beispiel #14
0
from django.urls import path

from news.views import (
    RegisterUser, NewsListView, NewsDetailsView, Logout, AuthView, UserProfileView, NewsCreateFormView,
)

urlpatterns = [
    path('', NewsListView.as_view(), name='main'),
    path('interfax/', NewsListView.as_view(), name='interfax'),
    path('interfax/<int:pk>/', NewsDetailsView.as_view(), name='news_details'),
    path('interfax/create_news/', NewsCreateFormView.as_view(), name='create_news'),
    path('registration/', RegisterUser.as_view(), name='registration'),
    path('logout/', Logout.as_view(), name='logout'),
    path('login/', AuthView.as_view(), name='login'),
    path('interfax/profile/<int:pk>/', UserProfileView.as_view(), name='profile'),
    path('interfax/news_list_by_tag/', NewsListView.as_view(), name='news_list_by_tag'),
]
Beispiel #15
0
from django.contrib import admin
from django.conf import settings
from django.conf.urls.static import static

import forumapp.urls  # My Import
import profiles.urls
import accounts.urls
import assignment.urls
from . import views

# Check out news app for the definiton
from news.views import NewsListView

urlpatterns = [
    # Added for the news content at the home page
    url(r'^$', NewsListView.as_view(), name='home'),

    # url(r'^$', views.HomePage.as_view(), name='home'),
    url(r'^about/$', views.AboutPage.as_view(), name='about'),
    url(r'^users/', include(profiles.urls, namespace='profiles')),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^', include(accounts.urls, namespace='accounts')),

    # My App
    url(r'forumapp/', include(forumapp.urls, namespace='forumapp')),
    url(r'sharing/', include(assignment.urls, namespace='assignment')),

    # Google Auth
    url(r'^auth/', include('social_django.urls', namespace='social')),

    # Contact Us
Beispiel #16
0
from django.conf.urls import *
from news.views import block_news, news
from news.models import News
from news.views import NewsListView
from django.views.generic import DetailView

urlpatterns = patterns('',
    url(r'^$', NewsListView.as_view(queryset=News.objects.all(), template_name='news_list.html')),
    url(r'^(?P<pk>\d+)$', DetailView.as_view(model=News, template_name='news_detail.html')),
)
Beispiel #17
0
from django.contrib.admin.views.decorators import staff_member_required

from news.views import NewsDetailView, NewsListView
from user.views import UserDetailView, UserSignup, UserLogin, StaffListView, UserLogout
from main.views import ContactView, MainView
from api.views import GetNews

urlpatterns = [
    # Examples:
    # url(r'^$', 'EnerWat.views.home', name='home'),
    # url(r'^blog/', include('blog.urls')),

    url(r'^admin/', include(admin.site.urls)),
    url(r'^$', MainView.as_view(), name='home'),
    url(r'contact/?', ContactView.as_view(), name='contact'),

    # User views
    url(r'^signup/?', staff_member_required(UserSignup.as_view(), login_url='user_login'), name='user_signup'),
    url(r'^login/?', UserLogin.as_view(), name='user_login'),
    url(r'^staff/?', StaffListView.as_view(), name='user_staff'),
    url(r'^logout/?', UserLogout.as_view(), name='user_logout'),
    url(r'^profile/?', login_required(UserDetailView.as_view()), name='user_detail'),

    # API views
    url(r'^api/get-news/(?P<news_id>\d+)', GetNews.as_view(), name='api_get_news'),

    # News views
    url(r'^news/(?P<pk>\d+)', NewsDetailView.as_view(), name='news_detail'),
    url(r'^news/?$', NewsListView.as_view(), name='news_list'),
]
Beispiel #18
0
"""hypernews 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 import settings
from django.conf.urls.static import static
from news.views import RootView, NewsAddView, NewsItemView, NewsListView

urlpatterns = [
    path("news/create/", NewsAddView.as_view()),
    path("news/<int:news_id>/", NewsItemView.as_view()),
    path("news/", NewsListView.as_view()),
    path("", RootView.as_view()),
    path("admin/", admin.site.urls)
]
urlpatterns += static(settings.STATIC_URL)
Beispiel #19
0
from django.conf.urls import url

from news.views import NewsListView, NewsDetailView

urlpatterns = [
    url(r'^$', NewsListView.as_view(), name='news-list'),
    url(r'^category/(?P<category_slug>[\w-]+)/$',
        NewsListView.as_view(),
        name='news-list'),
    url(r'^author/(?P<author_slug>[\w-]+)/$',
        NewsListView.as_view(),
        name='news-list'),
    url(r'^tag/(?P<tag_slug>[\w-]+)/$',
        NewsListView.as_view(),
        name='news-list'),
    url(r'^(?P<slug>[\w-]+)/$', NewsDetailView.as_view(), name='news-detail'),
]
Beispiel #20
0
from django.conf.urls import patterns, url
from django.contrib.auth.decorators import permission_required

from news.views import NewsListView, NewDetailView, NewCreate, NewUpdate, NewDelete

urlpatterns = patterns('',
                       url(r'^$', NewsListView.as_view(), name="news_index"),
                       url(r'^(?P<pk>\d+)/$', NewDetailView.as_view(), name="news_detail"),
                       url(r'^add/$', permission_required("news.add_new")(NewCreate.as_view()), name="news_add"),
                       url(r'^(?P<pk>\d+)/edit/$', permission_required("news.change_new")(NewUpdate.as_view()),
                           name="news_edit"),
                       url(r'^(?P<pk>\d+)/delete/$', permission_required("news.delete_new")(NewDelete.as_view()),
                           name="news_delete"),

                       )
Beispiel #21
0
from django.contrib.auth.views import LogoutView
from django.urls import path

from news.views import (NewsCreateView, NewsDetailView, NewsListView,
                        NewsStatisticsView, LoginView)

urlpatterns = [
    path('', NewsListView.as_view(), name='all_news'),
    path('<int:pk>/', NewsDetailView.as_view(), name='news_detail'),
    path('create/', NewsCreateView.as_view(), name='create_news'),
    path('statistics/', NewsStatisticsView.as_view(), name='news_statistics'),
    path('login/', LoginView.as_view(), name='login'),
    path('logout/', LogoutView.as_view(), name='logout'),
]
Beispiel #22
0
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
from news.views import NewsListView, NewView


urlpatterns = patterns('',
    url(r'^news$', NewsListView.as_view(), name='news'),
    url(r'^new/(?P<pk>\d+)$', NewView.as_view(), name='new'),
)
Beispiel #23
0
from django.urls import path

from news.views import NewsListView
from news.views_api import NewsAPIView

api_urls = [path('news/', NewsAPIView.as_view(), name='news')]

app_name = 'news'
urlpatterns = [
    path('', NewsListView.as_view(), name='news-list'),
    path('<int:page>/', NewsListView.as_view(), name='news-list')
]
Beispiel #24
0
from django.contrib.auth.decorators import permission_required
from news.views import NewsListView, NewDetailView, NewCreate, NewUpdate, NewDelete
from django.conf.urls import url

urlpatterns = [
    url(r"^$", NewsListView.as_view(), name="news_index"),
    url(r"^(?P<pk>\d+)/$", NewDetailView.as_view(), name="news_detail"),
    url(r"^add/$", permission_required("news.add_new")(NewCreate.as_view()), name="news_add"),
    url(r"^(?P<pk>\d+)/edit/$", permission_required("news.change_new")(NewUpdate.as_view()), name="news_edit"),
    url(r"^(?P<pk>\d+)/delete/$", permission_required("news.delete_new")(NewDelete.as_view()), name="news_delete"),
]
Beispiel #25
0
from django.conf.urls import url
from news.views import NewsListView, NewDetailView, NewCreate, NewUpdate, NewDelete
from django.contrib.auth.decorators import user_passes_test


urlpatterns = [
    url(r'^$', NewsListView.as_view(), name="news_index"),
    url(r'^(?P<pk>\d+)/$', NewDetailView.as_view(), name="news_detail"),
    url(r'^add/$', user_passes_test(lambda u: u.is_superuser)(NewCreate.as_view()), name="new_add"),
    url(r'^(?P<pk>\d+)/edit/$', user_passes_test(lambda u: u.is_superuser)(NewUpdate.as_view()), name="news_edit"),
    url(r'^(?P<pk>\d+)/delete/$', NewDelete.as_view(), name="news_delete"),
]
Beispiel #26
0
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url

from news.views import NewsListView, NewsDetailView
from news.models import News

urlpatterns = patterns('',
url(r'^$', NewsListView.as_view(queryset=News.objects.order_by('-date_create')), name='list'), # то есть по URL http://имя_сайта/blog/
                                               # будет выводиться список постов
url(r'^(?P<pk>\d+)/$', NewsDetailView.as_view()), # а по URL http://имя_сайта/blog/число/
                                              # будет выводиться пост с определенным номером

)
Beispiel #27
0
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 url, include
from django.conf.urls.static import static
from django.contrib import admin

from adverts.views import AdvertListView, copy_items
from companies.views import CompaniesListView
from fermanew import settings
from news.views import NewsListView

urlpatterns = [
    url(r'^jet/', include('jet.urls', 'jet')),
    url(r'^admin/', admin.site.urls),
    # url(r'^search/', include('jet.urls', 'jet')),
    url(r'^ad/', include('adverts.urls', namespace='ad')),
    url(r'^$', AdvertListView.as_view(), name='main'),
    url(r'^copy_items/', copy_items, name='copy_items'),
    url(r'^news/', NewsListView.as_view(), name='news'),
    url(r'^companies/', CompaniesListView.as_view(), name='companies'),
    url(r'^ckeditor/', include('ckeditor_uploader.urls')),
    # url(r'^search_results/$', AdvertListView.as_view, name='search')
]
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Beispiel #28
0
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 url, include
from django.contrib import admin
from main import views
from news.views import NewsListView

from django.conf import settings
from django.conf.urls.static import static


urlpatterns = [

    url(r'^$',views.index,name='index'),
    url(r'^main/',include("main.urls", namespace='main')),
    url(r'^admin/', admin.site.urls),
    url(r'^news/$', NewsListView.as_view())
]

if settings.DEBUG:
    urlpatterns = urlpatterns + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
    urlpatterns = urlpatterns + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Beispiel #29
0
"""hypernews 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, re_path
from django.views.generic import RedirectView
from news.views import WelcomeView, NewsView, NewsListView, NewsCreateView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', WelcomeView.as_view()),
    path('news/', NewsListView.as_view()),
    path('news/create/', NewsCreateView.as_view()),
    re_path(r'news/(?P<news_id>\w+)', NewsView.as_view())
]
Beispiel #30
0
# coding=utf-8
from django.conf.urls import patterns, url
from news.views import NewsListView, NewsCategoryView, NewsYearArchiveView, NewsMonthArchiveView, NewsDayArchiveView, NewsItemView

urlpatterns = patterns('news',
   url(r'^$', NewsListView.as_view(), name='news_index'),
   url(r'^category/(?P<category_id>\d+)/$', NewsCategoryView.as_view(), name='news_category_list'),
   url(r'^(?P<year>\d{4})/$', NewsYearArchiveView.as_view(), name='news_archive_year'),
   url(r'^(?P<year>\d{4})/(?P<month>\d{2})/$', NewsMonthArchiveView.as_view(), name='news_archive_month'),
   url(r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/$', NewsDayArchiveView.as_view(), name='news_archive_day'),
   url(r'^(?P<pk>\d+)-(?P<day>\d{2})(?P<month>\d{2})(?P<year>\d{4})/$', NewsItemView.as_view(), name='news_item'),
)
Beispiel #31
0
    NewsListView,
    NewsDetailView,
    UserProfileDetailView,
    UserProfileUpdateView,
    NewsLinkCreateView,
    NewsLinkUpdateView,
    NewsLinkDeleteView,
    VoteFormView
)
admin.autodiscover()

urlpatterns = patterns(
    '',
    url(r'^admin/', include(admin.site.urls)),
    url(r'^comments/', include('django.contrib.comments.urls')),
    url(r'^$', NewsListView.as_view(), name='home'),
    url(r'^accounts/', include('registration.backends.simple.urls')),
    url(r'^users/(?P<slug>\w+)/$', UserProfileDetailView.as_view(),
        name='profile'),
    url(r'^update-profile/$', login_required(UserProfileUpdateView.as_view()),
        name='update_profile'),
    url(r'^news/create/$', login_required(NewsLinkCreateView.as_view()),
        name='news_create'),
    url(r'^news/(?P<pk>\d+)/$', NewsDetailView.as_view(),
        name='news_detail'),
    url(r"^news/update/(?P<pk>\d+)/$", login_required(
        NewsLinkUpdateView.as_view()),
        name="news_update"),
    url(r"^news/delete/(?P<pk>\d+)/$", login_required(
        NewsLinkDeleteView.as_view()),
        name="news_delete"),
Beispiel #32
0
# coding=utf-8
from __future__ import unicode_literals  # u'' strings by default # Awesome :)
from django.conf.urls import patterns, url
from manager.views import ManageTeamApplyList
from news.views import NotificationView, NewsListView, NewsDetailView
from django.utils.translation import ugettext_lazy as _

urlpatterns = patterns('',
                       url(_(r'^notification/(?P<slug>.+)/$'), NotificationView.as_view(), name='notification'),

                       url(r'^$', NewsListView.as_view(), name='news_list'),
                       url(r'^(?P<pk>\d+)/$', NewsListView.as_view(), name='news_list'),
                       url(r'^(?P<pk>\d+)/(?P<slug>.+)/$', NewsDetailView.as_view(), name='news'),
                       url(r'^(?P<slug>.+)/$', NewsDetailView.as_view(), name='news'),
)