Exemplo n.º 1
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('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())
]
Exemplo n.º 2
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)
Exemplo n.º 3
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.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path
from django.views.generic import RedirectView
from news.views import ArticleView, MainPageView, CreateArticleView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', RedirectView.as_view(url='/news/')),
    path('news/', MainPageView.as_view()),
    path('news/<int:id_article>/', ArticleView.as_view()),
    path('news/create/', CreateArticleView.as_view()),
]

urlpatterns += static(settings.STATIC_URL)
Exemplo n.º 4
0
from django.urls import path

from news.views import ArticleUpdate, ArticleView, ArticleCreate, ArticleList, ArticleDelete, EventList, EventCreate, \
    EventDelete, EventUpdate, EventView, DraftList

urlpatterns = [
    path('article/<int:pk>/', ArticleView.as_view(), name='article'),
    path('articles/', ArticleList.as_view(), name='articles'),
    path('article/new/', ArticleCreate.as_view(), name='article-create'),
    path('article/<int:pk>/update/',
         ArticleUpdate.as_view(),
         name='article-update'),
    path('article/<int:pk>/delete/',
         ArticleDelete.as_view(),
         name='article-delete'),
    path('event/<int:pk>/', EventView.as_view(), name='event'),
    path('events/', EventList.as_view(), name='events'),
    path('event/new/', EventCreate.as_view(), name='event-create'),
    path('event/<int:pk>/update/', EventUpdate.as_view(), name='event-update'),
    path('event/<int:pk>/delete/', EventDelete.as_view(), name='event-delete'),
    path('events/drafts/', DraftList.as_view(), name='drafts')
]
Exemplo n.º 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 news.views import home, MainView, ArticleView, CreateArticle

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', home),
    path('news/', MainView.as_view()),
    path('news/create/', CreateArticle.as_view()),
    re_path("news/(?P<link>[^/]*)/?", ArticleView.as_view()),
]
Exemplo n.º 6
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 MainPageView, ArticleView, ComingSoonView, CreateNewsView

urlpatterns = [
    path('admin/', admin.site.urls),
    re_path(r'news/(?P<link>\d+)', ArticleView.as_view()),
    re_path('news/create', CreateNewsView.as_view()),
    re_path('news', MainPageView.as_view()),
    path('', ComingSoonView.as_view()),
]
Exemplo n.º 7
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('article/', include('article.urls'))
"""
from django.contrib import admin
from django.urls import path, re_path
from news.views import NewsView, MainPageView, ArticleView, CreateView

urlpatterns = [
    path('news/', MainPageView.as_view()),
    path('news/create/', CreateView.as_view()),
    re_path("news/(?P<article_id>[^/]*)/?", ArticleView.as_view(), name='news'),
    path('', NewsView.as_view()),
]
Exemplo n.º 8
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.conf import settings
from django.conf.urls.static import static
from django.urls import path, re_path
from news.views import ComingSoonView, NewsView, ArticleView, CreateArticleView

urlpatterns = [
    path('', ComingSoonView.as_view()),
    path('news/', NewsView.as_view()),
    path('news/create/', CreateArticleView.as_view()),
    re_path('news/(?P<article_id>\d+)/?', ArticleView.as_view())
]

urlpatterns += static(settings.STATIC_URL)