Example #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('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)
Example #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, 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)
Example #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 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()),
]
Example #4
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, CreateNewsView
from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
    path("", MainView.as_view()),
    path("news/", AllNewsView.as_view()),
    path("news/create/", CreateNewsView.as_view()),
    path("news/<int:news_id>/", NewsView.as_view()),
]

urlpatterns += static(settings.STATIC_URL)
Example #5
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, re_path
from django.conf.urls.static import static
from django.conf import settings
from news.views import (WelcomePageView, NewsStoryView, MainPageView,
                        CreateNewsView)

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', WelcomePageView.as_view()),
    re_path(r'news\/(?P<link_number>\d+)', NewsStoryView.as_view()),
    # path('news/', MainPageView.as_view()),
    re_path(r'news\/?$', MainPageView.as_view()),
    re_path(r'news/create\/?$', CreateNewsView.as_view()),
]

urlpatterns += static(settings.STATIC_URL)