예제 #1
0
from django.conf import settings
from django.conf.urls.static import static
from hashtags.views import HashTagView
from accounts.views import UserRegisterView
from tweets.api.views import SearchTweetAPIView
from hashtags.api.views import TagTweetAPIView
from tweets.views import TweetListView
from .views import home, SearchView

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^$', TweetListView.as_view(), name='home'),
    url(r'^search/$', SearchView.as_view(), name='search'),
    url(r'^api/search/$', SearchTweetAPIView.as_view(), name='search-api'),
    url(r'^api/tags/(?P<hashtag>.*)/$',
        TagTweetAPIView.as_view(),
        name='tag-tweet-api'),
    url(r'^tweet/', include('tweets.urls', namespace='tweet')),
    url(r'^tags/(?P<hashtag>.*)/$', HashTagView.as_view(), name='hashtag'),
    url(r'^api/tweet/', include('tweets.api.urls', namespace='tweet-api')),
    url(r'^', include('django.contrib.auth.urls')),
    url(r'^register/$', UserRegisterView.as_view(), name='register'),
    url(r'^accounts/', include('accounts.passwords.urls')),
    url(r'^api/', include('accounts.api.urls', namespace='profiles-api')),
    url(r'^', include('accounts.urls', namespace='profiles')),
]

if settings.DEBUG:
    urlpatterns += (static(settings.STATIC_URL,
                           document_root=settings.STATIC_ROOT))
예제 #2
0
from django.conf import settings
from django.conf.urls.static import static

from accounts.views import UserRegisterView
from hashtags.api.views import TagTweetAPIView
from hashtags.views import HashTagView
from tweets.api.views import SearchTweetAPIView
from tweets.views import TweetListView
from .views import home, SearchView

urlpatterns = [
    path('', TweetListView.as_view(), name="home"),
    path('search/', SearchView.as_view(), name="search"),
    path('admin/', admin.site.urls),
    path('api/tweet/', include('tweets.api.urls')),
    path('api/tags/<slug:hashtag>/',
         TagTweetAPIView.as_view(),
         name="tag-tweet-api"),
    path('api/search/', SearchTweetAPIView.as_view(), name="search-api"),
    path('api/', include('accounts.api.urls')),
    path('tags/<slug:hashtag>/', HashTagView.as_view(), name="hashtag"),
    path('tweet/', include('tweets.urls')),
    path('register/', UserRegisterView.as_view(), name="register"),
    path('', include('django.contrib.auth.urls')),
    path('', include('accounts.urls')),
]

if settings.DEBUG:
    urlpatterns += (static(settings.STATIC_URL,
                           document_root=settings.STATIC_ROOT))
예제 #3
0
파일: urls.py 프로젝트: MdStart/Tweetme
from django.contrib import admin

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

from accounts.views import UserRegisterView

from hashtags.api.views import TagTweetAPIView
from hashtags.views import HashTagView
from tweets.api.views import SearchTweetAPIView
from tweets.views import TweetListView
from .views import home, SearchView

urlpatterns = [
    url(r'^admin/', admin.site.urls), #admin/
    url(r'^$', TweetListView.as_view(), name='home'), #/
    url(r'^search/$', SearchView.as_view(), name='search'), #/
    url(r'^tags/(?P<hashtag>.*)/$', HashTagView.as_view(), name='hashtag'),
    url(r'^tweet/', include('tweets.urls', namespace='tweet')),
    url(r'^api/tags/(?P<hashtag>.*)/$', TagTweetAPIView.as_view(), name='tag-tweet-api'), 
    url(r'^api/search/$', SearchTweetAPIView.as_view(), name='search-api'), 
    url(r'^api/tweet/', include('tweets.api.urls', namespace='tweet-api')),
    url(r'^api/', include('accounts.api.urls', namespace='profiles-api')),
    url(r'^register/$', UserRegisterView.as_view(), name='register'), #/
    url(r'^', include('django.contrib.auth.urls')),
    url(r'^', include('accounts.urls', namespace='profiles')),
]


if settings.DEBUG:
    urlpatterns += (static(settings.STATIC_URL, document_root=settings.STATIC_ROOT))
예제 #4
0
from django.urls import path

from hashtags.views import HashTagView
from . import views
from .views import (
    HomeView,
    DetailMessageView,
    CreateMessageView,
    UpdateMessageView,
    DeleteMessageView,
    ListMessageView,
    RegisterView,
    LoginView,
    RetweetView,
)

urlpatterns = [
    path("", RegisterView.as_view(), name="register"),
    path("login", LoginView.as_view(), name="login"),
    path("logout", views.logout_view, name="logout"),

    # Base Message CRUD Views
    path("home/", HomeView.as_view(), name="home"),
    path("create", CreateMessageView.as_view(), name="create"),
    path("detail/<uuid:pk>", DetailMessageView.as_view(), name="detail"),
    path("update/<uuid:pk>", UpdateMessageView.as_view(), name="update"),
    path("delete/<uuid:pk>", DeleteMessageView.as_view(), name="delete"),
    path("list/", ListMessageView.as_view(), name="list"),
    path("tags/<str:hashtag>/", HashTagView.as_view(), name="hashtag"),
    path("retweet/<int:pk>/", RetweetView.as_view(), name="retweet"),
]
예제 #5
0
파일: urls.py 프로젝트: GolouHamady/tweet
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static

from hashtags.views import HashTagView
from hashtags.api.views import TagTweetAPIView
from tweets.api.views import SearchTweetAPIView
from tweets.views import TweetListView
from .views import home, SearchView
from accounts.views import UserRegisterView

urlpatterns = [
    path('admin/', admin.site.urls),
    path(r'', TweetListView.as_view(), name='list'),
    path(r'search/', SearchView.as_view(), name='search'),
    path(r'profiles/', include('accounts.urls', namespace='profiles')),
    path(r'tags/<str:hashtag>/', HashTagView.as_view(), name='hashtag'),
    path(r'tweets/', include('tweets.urls', namespace='tweets')),
    path(r'api/tweet/', include('tweets.api.urls', namespace='tweets-api')),
    path(r'api/', include('accounts.api.urls', namespace='profiles-api')),
    path(r'api/search/', SearchTweetAPIView.as_view(), name='search-api'),
    path(r'api/tags/<str:hashtag>/',
         TagTweetAPIView.as_view(),
         name='tag-tweet-api'),
    path(r'', include('django.contrib.auth.urls')),
    path(r'register/', UserRegisterView.as_view(), name='register'),
]

if settings.DEBUG:
    urlpatterns += (static(settings.STATIC_URL,
                           document_root=settings.STATIC_ROOT))
예제 #6
0
from accounts.views import UserRegisterView
from tweets.api.views import SearchTweetAPIView
from hashtags.views import HashTagView, HashTagListView
from hashtags.api.views import TagTweetAPIView
from django.conf import settings
from django.conf.urls.static import static
from .views import home_page, SearchView
from tweets.views import TweetListView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', TweetListView.as_view(), name='home'),
    path('register/', UserRegisterView.as_view(), name='register'),
    path('search/', SearchView.as_view(), name='search'),
    path('tags/', HashTagListView.as_view(), name='hashtaglist'),
    path('tags/<hashtag>/', HashTagView.as_view(), name='hashtag'),
    path('api/search/', SearchTweetAPIView.as_view(), name='search-api'),
    path('api/tags/<hashtag>/',
         TagTweetAPIView.as_view(),
         name='tag-tweet-api'),
    path('tweet/', include('tweets.urls', namespace='tweets')),
    path('api/tweet/', include('tweets.api.urls', namespace='tweet-api')),
    path('api/', include('accounts.api.urls', namespace='profiles-api')),
    path('', include('django.contrib.auth.urls')),
    path('', include('accounts.urls', namespace='profiles')),
]

if settings.DEBUG:
    urlpatterns = urlpatterns + static(settings.STATIC_URL,
                                       document_root=settings.STATIC_ROOT)
    urlpatterns = urlpatterns + static(settings.MEDIA_URL,
예제 #7
0
# from accounts.views import UserRegisterView
from sculpts.views import SculptListView  #1
from hashtags.api.views import TagSculptAPIView
from hashtags.views import HashTagView

from .views import home, SearchView
from sculpts.api.views import SearchSculptAPIView

urlpatterns = [
    re_path(r'^admin/', admin.site.urls),
    re_path(r'^$', SculptListView.as_view(), name='home'),
    re_path(r'^search/$', SearchView.as_view(), name='search'),
    re_path(r'^api/search/$', SearchSculptAPIView.as_view(),
            name='search-api'),
    re_path(r'^tags/(?P<hashtag>.*)/$', HashTagView.as_view(),
            name='hashtag'),  # url for hashtags app. 
    re_path(r'^sculpt/', include(('sculpts.urls', 'sculpt'),
                                 namespace='sculpt')),  # url for sculpts app. 
    re_path(r'^api/tags/(?P<hashtag>.*)/$',
            TagSculptAPIView.as_view(),
            name='tag-sculpt-api'),
    re_path(
        r'^api/sculpt/',
        include(('sculpts.api.urls', 'sculpt-api'),
                namespace='sculpt-api')),  #url for api
    re_path(
        r'^api/',
        include(('accounts.api.urls', 'profiles-api'),
                namespace='profiles-api')),  #url for api
    re_path(r'^notifications/', include('notify.urls', 'notifications')),
예제 #8
0
    2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
"""
from django.conf import settings
from django.conf.urls import url, include
from django.conf.urls.static import static
from django.contrib import admin

from accounts.views import UserRegisterView
from hashtags.api.views import TagTweetAPIView
from hashtags.views import HashTagView
from tweetme.views import SearchView
from tweets.views import TweetListView

urlpatterns = [
    url(r'^$', TweetListView.as_view(), name='home'),
    url(r'^tag/(?P<hashtag>.*/$)', HashTagView.as_view(), name='hashtag'),
    url(r'^search/$', SearchView.as_view(), name='search'),
    url(r'^tweet/', include("tweets.urls", namespace='tweet')),
    url(r'^api/tags/(?P<hashtag>.*/$)',
        TagTweetAPIView.as_view(),
        name="tag-api"),
    url(r'^api/tweet/', include("tweets.api.urls", namespace='tweet-api')),
    url(r'^api', include("accounts.api.urls", namespace='profile-api')),
    url(r'^admin/', admin.site.urls),
    url(r'^profile/', include("accounts.urls", namespace='profile')),
    url(r'^register/$', UserRegisterView.as_view(), name='register'),
    url(r'^', include("django.contrib.auth.urls", namespace='auth')),
]

if settings.DEBUG:
    urlpatterns += (static(settings.STATIC_URL,
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, include
from django.contrib.auth.decorators import login_required
from hashtags.views import HashTagView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include('user_registration.urls')),
    path('post/', include('posts.urls', namespace='post')),
    path('tags/<hashtag>/',
         login_required(HashTagView.as_view()),
         name='post-hashtags'),
    path('api-auth/', include('rest_framework.urls')),
    path('post/api/', include('posts.api.urls', namespace='post-api')),
    path('profile/api/',
         include('user_registration.api.urls', namespace='user-api')),
    path('tags/<hashtag>/api/',
         include('hashtags.api.urls', namespace='hashtag-api'))
]
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
예제 #10
0
from django.urls import path, include
from django.contrib.auth.decorators import login_required
from hashtags.views import HashTagView

from oauth2_provider.views.generic import ProtectedResourceView
from django.http import HttpResponse,JsonResponse
from rest_framework.views import APIView
class ApiEndpoint(APIView):
    def get(self, request, *args, **kwargs):
        print(request.user.username)
        return JsonResponse({'email':request.user.email,'first_name':request.user.get_short_name(),'last_name':request.user.last_name})
        if request.user.is_authenticated: 
            return HttpResponse('Hello there! You are acting on behalf of '+str(request.user))
        else:
            return HttpResponse('Hello! I do not recognize you\n')

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include('user_registration.urls')),
    path('post/', include('posts.urls', namespace='post')),
    path('tags/<hashtag>/', login_required(HashTagView.as_view()), name='post-hashtags'),
    path('api-auth/', include('rest_framework.urls')),
    path('post/api/', include('posts.api.urls', namespace='post-api')),
    path('profile/api/', include('user_registration.api.urls', namespace='user-api')),
    path('tags/<hashtag>/api/', include('hashtags.api.urls', namespace='hashtag-api')),
    path('o/', include('oauth2_provider.urls', namespace='oauth2_provider')),
    path('api/hello/', ApiEndpoint.as_view()), 
]
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)