Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
go
Commits
c8158785
Commit
c8158785
authored
Jan 31, 2014
by
Jean Michel Rouly
Browse files
Added docs to models
parent
b63e7c4d
Changes
1
Hide whitespace changes
Inline
Side-by-side
go/go/models.py
View file @
c8158785
from
django.db
import
models
from
django.contrib.auth.models
import
User
from
django.utils
import
timezone
import
random
,
string
# Create your models here.
class
URL
(
models
.
Model
):
"""
This model represents a stored URL redirection rule. Each URL has an
owner, target url, short identifier, click counter, and expiration
date.
"""
owner
=
models
.
ForeignKey
(
User
)
date_created
=
models
.
DateTimeField
(
default
=
timezone
.
now
()
)
...
...
@@ -34,16 +39,24 @@ class URL( models.Model ):
if
tries
>
100
:
return
None
class
RegisteredUser
(
models
.
Model
):
"""
This is simply a wrapper model which, if an object exists, indicates
that that user is registered.
"""
username
=
models
.
CharField
(
blank
=
False
,
max_length
=
30
,
primary_key
=
True
)
full_name
=
models
.
CharField
(
blank
=
False
,
max_length
=
100
,
)
description
=
models
.
TextField
(
blank
=
True
)
def
__unicode__
(
self
):
...
...
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