"""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, SpecificNewsView, CreateView
from django.conf import settings
from django.conf.urls.static import static


urlpatterns = [
    path('', MainView.as_view()),
    path('news/', NewsView.as_view()),
    path('news/create/', CreateView.as_view()),
    re_path('news/(?P<link>[^/]*)/?', SpecificNewsView.as_view()),
]

urlpatterns += static(settings.STATIC_URL)
Beispiel #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)
Beispiel #3
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)
Beispiel #4
0
from django.urls import path
from django.conf.urls import handler404
from rest_framework.schemas import get_schema_view
from news.views import scrape, CreateView, ListHeadlineView, HeadlineDetail, custom404

handler404 = custom404

urlpatterns = [
    path('scrape/', scrape, name="scrape"),
    path('news/', ListHeadlineView.as_view(), name="list"),
    path('news/add', CreateView.as_view(), name="create"),
    path('news/<int:pk>', HeadlineDetail.as_view(), name="detail"),
    path(
        '',
        get_schema_view(
            title="News Scraper API",
            description=
            "API for scraping news headlines, to show all list headlines, edit the details headline and delete the headlines",
            version="1.0.0"),
        name='openapi-schema'),
]