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
Jean Michel Rouly
research-questions
Commits
6fa7f9d1
Commit
6fa7f9d1
authored
Dec 03, 2013
by
Jean Michel Rouly
Browse files
Made date fields localization aware.
parent
cebeadd3
Changes
1
Hide whitespace changes
Inline
Side-by-side
researchquestions/website/models.py
View file @
6fa7f9d1
from
django.db
import
models
from
django.utils
import
timezone
from
datetime
import
datetime
from
django.contrib.auth.models
import
User
# Create your models here.
class
Question
(
models
.
Model
):
user
=
models
.
ForeignKey
(
User
)
date
=
models
.
DateTimeField
(
default
=
datetim
e
.
now
())
date
=
models
.
DateTimeField
(
default
=
timezon
e
.
now
())
text
=
models
.
TextField
(
max_length
=
1000
)
rating
=
models
.
IntegerField
(
default
=
0
)
...
...
@@ -14,7 +15,7 @@ class Question( models.Model ):
class
Comment
(
models
.
Model
):
user
=
models
.
ForeignKey
(
User
)
date
=
models
.
DateTimeField
(
default
=
datetim
e
.
now
())
date
=
models
.
DateTimeField
(
default
=
timezon
e
.
now
())
text
=
models
.
TextField
()
parent
=
models
.
ForeignKey
(
'Question'
)
...
...
@@ -23,7 +24,7 @@ class Comment( models.Model ):
class
Reply
(
models
.
Model
):
user
=
models
.
ForeignKey
(
User
)
date
=
models
.
DateTimeField
(
default
=
datetim
e
.
now
())
date
=
models
.
DateTimeField
(
default
=
timezon
e
.
now
())
text
=
models
.
TextField
()
parent
=
models
.
ForeignKey
(
'Comment'
)
...
...
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