コード例 #1
0
def test_news_access(test_user):
    test_thread_name = "ThreadName"
    thread = NewsThread(thread_name=test_thread_name)
    thread.save()

    test_title = "TestNews"
    test_content = "TestContent"

    news = News(title=test_title,
                pub_date=timezone.now(),
                content=test_content,
                thread=thread)
    news.save()

    subscription = NewsSubscription(user=test_user, thread=thread)
    subscription.save()

    request = HttpRequest()
    request.META['HTTP_HOST'] = 'localhost'
    request.method = "get"
    request.user = test_user

    view = NewsView.as_view()
    response = view(request)

    assert test_thread_name in response.content.decode('utf-8')
    assert test_title in response.content.decode('utf-8')

    subscription.delete()
    news.delete()
    thread.delete()
    test_user.delete()
コード例 #2
0
ファイル: urls.py プロジェクト: siyovush-bek/hypernews-portal
"""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('article/', include('article.urls'))
"""
from django.contrib import admin
from django.urls import path, re_path
from news.views import NewsView, ArticleView, ComingSoonView, CreateArticleView

urlpatterns = [
    path('news/', NewsView.as_view()),
    path("news/<int:article_id>/", ArticleView.as_view()),
    path('', ComingSoonView.as_view()),
    path('news/create/', CreateArticleView.as_view())
]
コード例 #3
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 news.views import AllNewsView, NewsView, MainView

urlpatterns = [
    path("", MainView.as_view()),
    path("news/", AllNewsView.as_view()),
    path("news/<int:news_id>/", NewsView.as_view()),
]
コード例 #4
0
ファイル: urls.py プロジェクト: stardrewer/NewsPage
"""NewsPage URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.9/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. Import the include() function: from django.conf.urls import url, include
    3. Add a URL to urlpatterns:  url(r'^blog/', include(blog_urls))
"""
from django.conf.urls import url
from django.contrib import admin
from news.views import NewsView, ProjectView
from django.views.generic.base import RedirectView

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^$', NewsView.as_view(), name='datenews'),
    url(r'^(?P<date>.*)/$', NewsView.as_view(), name='news'),
    url(r'^projects$', ProjectView.as_view(), name='projects'),
    url(r'^favicon.ico$',
        RedirectView.as_view(url=r'static/images/favicon.ico')),
]
コード例 #5
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.conf import settings
from django.conf.urls.static  import static 
from news.views import CreateNewsView, MainPageView, NewsBaseView ,NewsView


urlpatterns = [
    path('', MainPageView.as_view()),
    path('admin/', admin.site.urls),
    path('news/', NewsBaseView.as_view()),
    re_path('news/(?P<link>\d+)/?', NewsView.as_view()),
    path('news/create/', CreateNewsView.as_view())
]
urlpatterns += static(settings.STATIC_URL)
コード例 #6
0
ファイル: urls.py プロジェクト: boogiiieee/Victoria
# -*- coding: utf-8 -*-

from django.conf.urls import *

from news.views import NewsList, NewsView

urlpatterns = patterns(
    'news.views',
    url(r'^$', NewsList.as_view(), name='news_list_url'),
    url(r'^(?P<slug>[-_\w]+)/$', NewsView.as_view(), name='news_url'),
)
コード例 #7
0
ファイル: urls.py プロジェクト: genakoganovich/hypernews
"""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.urls import path, re_path
from news.views import BaseView, NewsView, MainView, ComingSoonView, CreateView

urlpatterns = [
    path('', ComingSoonView.as_view()),
    path('base/', BaseView.as_view()),
    path('news/', MainView.as_view()),
    path('news/create/', CreateView.as_view()),
    re_path('news/(?P<link>[^/]*)/?', NewsView.as_view()),
]
コード例 #8
0
ファイル: urls.py プロジェクト: Iriday/JBA_HyperNews-Portal
"""HyperNews_Portal URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.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, re_path
from news.views import MainView, NewsArticleView, NewsView, CreateNewsArticleView
from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
    path('admin/', admin.site.urls),
    path('news/', NewsView.as_view()),
    path('news/create/', CreateNewsArticleView.as_view()),
    re_path('news/[?]q=(?P<q>[^/]+)/?', NewsView.as_view()),
    re_path('news/(?P<link>[0-9]+)/?', NewsArticleView.as_view()),
    path('', MainView.as_view())
]
urlpatterns += static(settings.STATIC_URL)
コード例 #9
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 news.views import MainPageView, FirstPageView, NewsView
from news import views

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', MainPageView.as_view()),
    path("news/", FirstPageView.as_view()),
    path("news/<int:link>/", NewsView.as_view()),
    path("news/create/", views.create),
]
コード例 #10
0
ファイル: urls.py プロジェクト: yuriiZherebukh/test_blog
"""
URL Routes to News app
"""

from django.conf.urls import url

from news.views import NewsView

urlpatterns = [
    url(r'^$', NewsView.as_view()),
    url(r'^(?P<news_id>\d+)/$', NewsView.as_view()),
]
コード例 #11
0
ファイル: urls.py プロジェクト: eekstunt/Hyper-News-Portal
"""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.base import RedirectView
from news.views import MainPageView, NewsView, AllNewsView, CreateNewsView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', RedirectView.as_view(url='news')),
    path('news/', AllNewsView.as_view()),
    path('news/create/', CreateNewsView.as_view()),
    path('news/create', CreateNewsView.as_view()),
    re_path('^news/(?P<news_id>\w+)/?$', NewsView.as_view()),
]
コード例 #12
0
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 news.views import NewsView, MainView, to_main_view, CreateView
from django.conf import settings
from django.conf.urls.static import static


urlpatterns = [
    path('admin/', admin.site.urls),
    path('', to_main_view),
    path('news/', MainView.as_view()),
    path('news/<int:news_id>/', NewsView.as_view()),
    path('news/create/', CreateView.as_view()),
]

urlpatterns += static(settings.STATIC_URL)
コード例 #13
0
ファイル: urls.py プロジェクト: jeffordray92/pylp-website
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'),
]
コード例 #14
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 news.views import MainPageView, NewsView, AllNewsPage, CreateNews
from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
    path('admin/', admin.site.urls),
    path("", MainPageView.as_view()),
    path("news/", AllNewsPage.as_view()),
    path("news/<int:link_number>/", NewsView.as_view()),
    path("news/create/", CreateNews.as_view()),
]

urlpatterns += static(settings.STATIC_URL)
コード例 #15
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 news.views import MainView, NewsView, NewsList, CreateView

urlpatterns = [
    path('admin/', admin.site.urls),
    re_path("news/(?P<n_chapter>\d+)/", NewsView.as_view()),
    path("news/", NewsList.as_view()),
    path("news/create/", CreateView.as_view()),
    path("", MainView.as_view())
]
コード例 #16
0
ファイル: urls.py プロジェクト: PengchuanC/financial_news
"""financial_news URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.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.contrib import admin
from django.urls import path

from news.views import NewsView, NewsCategoryView

urlpatterns = [
    path("admin/", admin.site.urls),
    path("api/news/", NewsView.as_view({"get": "list"})),
    path("api/news/category/", NewsCategoryView.as_view()),
]
コード例 #17
0
from django.conf.urls import patterns, include, url
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from annotator.admin import learner_admin
from Corpus.views import Index, Search, Statistics, PopUp, download_file, DownloadSearch
from news.views import NewsView, SectionView


urlpatterns = patterns('',
    url(r'^$', SectionView.as_view(), name='start_page'),

    url(r'^admin/', include(learner_admin.urls)),

    url(r'^download_file/(?P<doc_id>[\w\-]+)/(?P<doc_type>ann|tokens|text)$', download_file, name='download_file'),

    url(r'^document-annotations', include('annotator.urls', namespace='annotations')),

    url(r'^(help|rulec|jrfllc|conference)$', Index.as_view(), name='main.static'),

    url(r'^news$', NewsView.as_view(), name='news'),

    url(r'^search/$', Search.as_view(), name='main.search'),
    url(r'^search/download/$', DownloadSearch.as_view(), name='main.search.download'),
    url(r'^search/(gramsel|lex|errsel)$', PopUp.as_view(), name='popup'),

    url(r'^stats/$', Statistics.as_view(), name='main.stats'),

    (r'^i18n/', include('django.conf.urls.i18n')),
    )

urlpatterns += staticfiles_urlpatterns()
コード例 #18
0
from django.contrib import admin

from ozna.views import MainView

from contact.views import ContactView
from contact.views import ThanksView
from news.views import NewsView
from about.views import AboutView
from product.views import ProductView
from product.views import KtpView
from product.views import productdetail, ktpview, IndexView

from gear.views import GearView

from contact.views import contact, rssview

urlpatterns = [
    url(r'^pkf/', admin.site.urls),
    url(r'^$', IndexView.as_view(), name="main"),
    url(r'^contacts/$', ContactView.as_view(), name="contacts"),
    url(r'^news/$', NewsView.as_view(), name="news"),
    url(r'^about/$', AboutView.as_view(), name="about"),
    url(r'^product/$', ProductView.as_view(), name="product"),
    url(r'^product/(?P<service_id>\d+)/$', ktpview, name="ktp"),
    url(r'^gear/$', GearView.as_view(), name="gear"),
    url(r'^form/$', contact, name="form"),
    url(r'^thanks/$', ThanksView.as_view(), name="thanks"),
    url(r'^product/(?P<alias>[^/]+)/$', productdetail, name='productdetail'),
    url(r'^rss/$', MainView, name='rss'),
]
コード例 #19
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 BaseView, NewsView, ArticleView, CreateView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', BaseView.as_view(), name='Base'),
    path('news/', NewsView.as_view(), name='News'),
    path('news/<int:link_id>/', ArticleView.as_view(), name='Article'),
    path('news/create/', CreateView.as_view(), name='Create')
]

urlpatterns += static(settings.STATIC_URL)
コード例 #20
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 news.views import MainView, NewsView, CreateView
from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
    path('', MainView.as_view()),
    path('news/', MainView.as_view()),
    path('news/<int:post_id>/', NewsView.as_view()),
    path('news/create/', CreateView.as_view()),
    path('admin/', admin.site.urls),
]

urlpatterns += static(settings.STATIC_URL)
コード例 #21
0
from django.contrib import admin
from django.urls import path, re_path
from django.conf.urls.static import static
from django.conf import settings

from news.views import MainView, NewsView, ListView, CreateView

urlpatterns = [
    path("", MainView.as_view()),
    path("news/", ListView.as_view()),
    path("news/create/", CreateView.as_view()),
    re_path("news/(?P<number>[0-9]+)/?", NewsView.as_view()),
]

urlpatterns += static(settings.STATIC_URL)
コード例 #22
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 news.views import WelcomeView, NewsView, MainNewsView, CreateNewsView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('news/create/', CreateNewsView.as_view()),
    re_path('news/(?P<news_id>\d+)', NewsView.as_view()),
    path('news/', MainNewsView.as_view()),
    path('', WelcomeView.as_view())
]
コード例 #23
0
from django.urls import path
from news.views import NewsView

app_name = "news"

urlpatterns = [
    path(r'', NewsView.as_view()),
]
コード例 #24
0
from django.contrib import admin
from django.urls import path, include

from news.views import NewsView

urlpatterns = [
    path('', NewsView.as_view(), name='news-view'),
    path('admin/', admin.site.urls),
]
コード例 #25
0
ファイル: urls.py プロジェクト: zejiran/kittens-news
"""kittens_news 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 news.views import HomeView, NewsView, redirect_home, NewsCreateView
from django.shortcuts import redirect

urlpatterns = [
    path('', redirect_home),
    path('news/', HomeView.as_view()),
    path('news/create/', NewsCreateView.as_view()),
    path('news/<link>/', NewsView.as_view())
]
コード例 #26
0
ファイル: urls.py プロジェクト: elmiram/constructicon
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.conf.urls.i18n import i18n_patterns
from django.utils.translation import ugettext_lazy as _
from TestCorpus.views import Index, Search, Statistics, PopUp, download_file
from news.views import NewsView, SectionView
from annotator.admin import learner_admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns

urlpatterns = patterns(
    '',
    url(r'^admin/', include(learner_admin.urls)),
    url(r'^(help|rulec)$', Index.as_view(), name='main.static'),
    url(r'^(search)/$', Search.as_view(), name='main.search'),
    url(r'^(news)$', NewsView.as_view(), name='news'),
    url(r'^$', SectionView.as_view(), name='start_page'),
    url(r'^search/(gramsel|lex|errsel)$', PopUp.as_view(), name='popup'),
    url(r'^(stats)/$', Statistics.as_view(), name='main.stats'),
    url(r'^(download_file)/(?P<doc_id>[\w\-]+)/(?P<doc_type>ann|tokens|text)$',
        download_file,
        name='download_file'),
    url(r'^document-annotations', include('annotator.urls')),
    (r'^i18n/', include('django.conf.urls.i18n')),
)
# urlpatterns += i18n_patterns('',
#     url(r'^(stats)/$', Statistics.as_view(), name='main.stats'),
# )

urlpatterns += staticfiles_urlpatterns()
コード例 #27
0
ファイル: urls.py プロジェクト: flukehermit/HyperNews-Portal
"""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 HomeView, NewsView, HypernewsView, CreateView

urlpatterns = [
    path('', HomeView.as_view()),
    path('news/', HypernewsView.as_view()),
    path('news/<int:link>/', NewsView.as_view()),
    path('news/create/', CreateView.as_view()),
    path('admin/', admin.site.urls)
]

urlpatterns += static(settings.STATIC_URL)
コード例 #28
0
ファイル: urls.py プロジェクト: studentisgss/booking
"""activities 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 news.views import NewsView

app_name = "news"

urlpatterns = [
    url(r'^$', NewsView.as_view(), name="news")
]
コード例 #29
0
ファイル: urls.py プロジェクト: wolfpakk92/hypernewsproject
"""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, include
from news.views import MainPageView, NewsView, CreateNewsView
from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
    path('', MainPageView.as_view(), name='news-home'),
    path('create/', CreateNewsView.as_view(), name='news-create'),
    path('<str:post_id>' + '/', NewsView.as_view())
]

urlpatterns += static(settings.STATIC_URL)
コード例 #30
0
ファイル: urls.py プロジェクト: elmiram/ASD_children_corpus
from django.conf.urls import patterns, include, url
from django.contrib import admin
from TestCorpus.views import Index, Search, Statistics, PopUp
from news.views import NewsView, SectionView
from annotator.admin import learner_admin

urlpatterns = patterns('',
    # Examples:
    # url(r'^$', 'learner_corpus.views.home', name='home'),
    # url(r'^blog/', include('blog.urls')),
    # url(r'^myadmin/', include(learner_admin.urls)),

    url(r'^admin/', include(learner_admin.urls)),
    url(r'^(news)$', NewsView.as_view(), name='news'),
    url(r'^(search)/$', Search.as_view(), name='main.search'),
    url(r'^(help)$', Index.as_view(), name='main.static'),
    url(r'^$', SectionView.as_view(), name='start_page'),
    url(r'^search/(gramsel|lex|errsel)$', PopUp.as_view(), name='popup'),
    url(r'^(stats)/$', Statistics.as_view(), name='main.stats'),
    url(r'^document-annotations', include('annotator.urls')),
    (r'^i18n/', include('django.conf.urls.i18n')),
    )
コード例 #31
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())
]
コード例 #32
0
ファイル: urls.py プロジェクト: Levalife/petsterr2.0
# -*- coding: utf-8 -*-
from django.urls import path
from django.utils.translation import ugettext_lazy as _

from news.views import NewsView

app_name = 'news'

urlpatterns = [path('news/', NewsView.as_view(), name='news_page')]