Skip to content

Commit

Permalink
add userpage
Browse files Browse the repository at this point in the history
  • Loading branch information
gothack329 committed Feb 24, 2018
1 parent fc9bce6 commit c0b156e
Show file tree
Hide file tree
Showing 23 changed files with 63 additions and 6 deletions.
Binary file modified article/__pycache__/urls.cpython-36.pyc
Binary file not shown.
Binary file modified article/__pycache__/views.cpython-36.pyc
Binary file not shown.
5 changes: 3 additions & 2 deletions article/urls.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from django.contrib import admin
from django.urls import path
from article.views import *
from . import views

urlpatterns = [
path(r'', article),
path('', views.homepage),
path('<int:article_id>/', views.detail, name='detail'),
]
9 changes: 8 additions & 1 deletion article/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,12 @@

# Create your views here.

def article(request):
def homepage(request):
return HttpResponse('<p>Test</p>')


def detail(request, article_id):
return HttpResponse("You're looking at article %s." % article_id)

def vote(request, article_id):
return HttpResponse("You're voting on article %s." % article_id)
Binary file modified edconline/__pycache__/settings.cpython-36.pyc
Binary file not shown.
Binary file modified edconline/__pycache__/urls.cpython-36.pyc
Binary file not shown.
4 changes: 4 additions & 0 deletions edconline/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
'tinymce',

'article',
'userpage',
]

MIDDLEWARE = [
Expand Down Expand Up @@ -132,6 +133,9 @@

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR,'/static/')
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)


TINYMCE_DEFAULT_CONFIG = {
Expand Down
8 changes: 5 additions & 3 deletions edconline/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import xadmin
from xadmin.plugins import xversion
import article
import userpage
import tinymce

admin.autodiscover()
Expand All @@ -28,7 +29,8 @@

urlpatterns = [
path('admin/', admin.site.urls),
path(r'xadmin/', xadmin.site.urls),
path(r'tinymce/', include('tinymce.urls')),
path(r'article/', include('article.urls')),
path('xadmin/', xadmin.site.urls),
path('tinymce/', include('tinymce.urls')),
path('article/', include('article.urls')),
path('userpage/', include('userpage.urls')),
]
12 changes: 12 additions & 0 deletions templates/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
{% load staticfiles %}

<html>
<head>
<title>{% if title %}{{title}} - {% endif %}物志</title>
{% block header %}
{% endblock %}
</head>
<body>
</body>
</html>
Empty file added userpage/__init__.py
Empty file.
Binary file added userpage/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file added userpage/__pycache__/admin.cpython-36.pyc
Binary file not shown.
Binary file added userpage/__pycache__/models.cpython-36.pyc
Binary file not shown.
Binary file added userpage/__pycache__/urls.cpython-36.pyc
Binary file not shown.
Binary file added userpage/__pycache__/views.cpython-36.pyc
Binary file not shown.
3 changes: 3 additions & 0 deletions userpage/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
5 changes: 5 additions & 0 deletions userpage/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class UserpageConfig(AppConfig):
name = 'userpage'
Empty file added userpage/migrations/__init__.py
Empty file.
Binary file not shown.
3 changes: 3 additions & 0 deletions userpage/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.db import models

# Create your models here.
3 changes: 3 additions & 0 deletions userpage/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.
7 changes: 7 additions & 0 deletions userpage/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from django.contrib import admin
from django.urls import path
from . import views

urlpatterns = [
path('<int:user_id>/', views.homepage, name='homepage'),
]
10 changes: 10 additions & 0 deletions userpage/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from django.shortcuts import render
from django.http import HttpResponse,HttpResponseRedirect
from django.template import RequestContext,Template,Context,loader,defaultfilters
from django.shortcuts import render_to_response

# Create your views here.

def homepage(request, user_id):
return HttpResponse("You're looking at user %s." % user_id)

0 comments on commit c0b156e

Please sign in to comment.