Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
D
django-url-follower
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nikolaos S. Papaspyrou
django-url-follower
Commits
eb3596a7
Commit
eb3596a7
authored
Jun 15, 2015
by
Nikolaos S. Papaspyrou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add part 3, use built-in user model
parent
f4b661c7
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
9 deletions
+33
-9
README.md
README.md
+8
-0
admin.py
urlapp/admin.py
+1
-2
0002_auto_20150615_0853.py
urlapp/migrations/0002_auto_20150615_0853.py
+23
-0
models.py
urlapp/models.py
+1
-7
No files found.
README.md
View file @
eb3596a7
...
@@ -81,3 +81,11 @@ Create admin user:
...
@@ -81,3 +81,11 @@ Create admin user:
Edit
`urlapp/admin.py`
to allow modifications to the app.
Edit
`urlapp/admin.py`
to allow modifications to the app.
Part 3
------
Remove the
`User`
model and replace with that in
`django.contrib.auth.models`
.
python manage.py makemigrations urlapp
python manage.py migrate
urlapp/admin.py
View file @
eb3596a7
...
@@ -2,7 +2,6 @@ from django.contrib import admin
...
@@ -2,7 +2,6 @@ from django.contrib import admin
# Register your models here.
# Register your models here.
from
.models
import
U
ser
,
U
rl
from
.models
import
Url
admin
.
site
.
register
(
User
)
admin
.
site
.
register
(
Url
)
admin
.
site
.
register
(
Url
)
urlapp/migrations/0002_auto_20150615_0853.py
0 → 100644
View file @
eb3596a7
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
models
,
migrations
from
django.conf
import
settings
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'urlapp'
,
'0001_initial'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'url'
,
name
=
'user'
,
field
=
models
.
ForeignKey
(
to
=
settings
.
AUTH_USER_MODEL
),
),
migrations
.
DeleteModel
(
name
=
'User'
,
),
]
urlapp/models.py
View file @
eb3596a7
from
django.contrib.auth.models
import
User
from
django.db
import
models
from
django.db
import
models
# Create your models here.
# Create your models here.
class
User
(
models
.
Model
):
username
=
models
.
CharField
(
max_length
=
32
)
password
=
models
.
CharField
(
max_length
=
128
)
def
__unicode__
(
self
):
return
self
.
username
class
Url
(
models
.
Model
):
class
Url
(
models
.
Model
):
user
=
models
.
ForeignKey
(
User
)
user
=
models
.
ForeignKey
(
User
)
target
=
models
.
CharField
(
max_length
=
256
)
target
=
models
.
CharField
(
max_length
=
256
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment