Skip to content

Commit 771ceb6

Browse files
author
yangxueguang
committed
创建用户模块,登录和注册视图函数及模板文件。
1 parent 7f87ba4 commit 771ceb6

File tree

13 files changed

+86
-1
lines changed

13 files changed

+86
-1
lines changed

blog_project/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
'django.contrib.messages',
3737
'django.contrib.staticfiles',
3838
'blog',
39+
'usera',
3940
]
4041

4142
MIDDLEWARE_CLASSES = [

blog_project/urls.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@
1919

2020
urlpatterns = [
2121
url(r'^admin/', admin.site.urls),
22-
url(r'', include('blog.urls', namespace='blog', app_name='blog'))
22+
url(r'', include('blog.urls', namespace='blog', app_name='blog')),
23+
url(r'', include('usera.urls', namespace='usera', app_name='usera'))
2324
]

usera/__init__.py

Whitespace-only changes.

usera/admin.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.contrib import admin
2+
3+
# Register your models here.

usera/apps.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from django.apps import AppConfig
2+
3+
4+
class UseraConfig(AppConfig):
5+
name = 'usera'

usera/forms.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from django import forms
2+
from django.forms import ModelForm
3+
4+
5+
class SignUpForm(ModelForm):
6+
pass
7+
8+
9+
class SignInForm(forms):
10+
pass

usera/migrations/__init__.py

Whitespace-only changes.

usera/models.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.db import models
2+
3+
# Create your models here.

usera/template/usera/signin.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Title</title>
6+
</head>
7+
<body>
8+
<form action="{% url 'usera:signin' %}" method="post">
9+
{% csrf_token %}
10+
{{ form.as_p }}
11+
<input type="submit" value="登录"/>
12+
</form>
13+
</body>
14+
</html>

usera/template/usera/signup.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Title</title>
6+
</head>
7+
<body>
8+
<form action="{% url 'usera:signup' %}" method="post">
9+
{% csrf_token %}
10+
{{ form.as_p }}
11+
<input type="submit" value="注册"/>
12+
</form>
13+
</body>
14+
</html>

0 commit comments

Comments
 (0)