Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
project_questboard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Aedin Hunter A. Clay
project_questboard
Commits
834b656a
Commit
834b656a
authored
Apr 09, 2021
by
Aedin Hunter A. Clay
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added forms and models for quest and questboard
parent
e2f57ed9
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
5 deletions
+50
-5
forms.py
board/forms.py
+16
-0
models.py
board/models.py
+31
-1
models.py
homepage/models.py
+0
-3
views.py
homepage/views.py
+3
-1
No files found.
board/forms.py
0 → 100644
View file @
834b656a
from
django
import
forms
from
.models
import
Questboard
,
Quest
class
QuestboardForm
(
forms
.
ModelForm
):
class
Meta
:
model
=
Questboard
fields
=
[
'name'
,
'description'
,
'required_stars'
]
class
QuestForm
(
forms
.
ModelForm
):
class
Meta
:
model
=
Quest
fields
=
[
'name'
,
'description'
,
'stars'
,
'for_everyone'
,
'board_pk'
,
'student1'
,
'student2'
,
'student3'
]
widgets
=
{
'board_pk'
:
forms
.
HiddenInput
(),
'student1'
:
forms
.
HiddenInput
(),
'student2'
:
forms
.
HiddenInput
(),
'student3'
:
forms
.
HiddenInput
()}
\ No newline at end of file
board/models.py
View file @
834b656a
from
django.db
import
models
from
django.db
import
models
# Create your models here.
class
Questboard
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
50
)
description
=
models
.
CharField
(
max_length
=
300
)
required_stars
=
models
.
IntegerField
()
class
Quest
(
models
.
Model
):
board_pk
=
models
.
IntegerField
(
default
=
0
)
name
=
models
.
CharField
(
max_length
=
60
,
default
=
''
)
description
=
models
.
CharField
(
max_length
=
300
,
default
=
''
)
stars
=
models
.
IntegerField
(
default
=
0
)
for_everyone
=
models
.
BooleanField
(
default
=
False
)
student1
=
models
.
CharField
(
max_length
=
60
,
default
=
''
)
student2
=
models
.
CharField
(
max_length
=
60
,
default
=
''
)
student3
=
models
.
CharField
(
max_length
=
60
,
default
=
''
)
def
is_for_everyone
(
self
):
if
self
.
students
is
not
None
:
return
self
.
students
.
for_everyone
else
:
return
False
def
is_students_full
(
self
):
return
self
.
student1
!=
''
and
self
.
student2
!=
''
and
self
.
student3
!=
''
def
is_students_empty
(
self
):
return
self
.
student1
==
''
and
self
.
student2
==
''
and
self
.
student3
==
''
def
is_editable
(
self
):
return
self
.
for_everyone
or
self
.
is_students_empty
()
homepage/models.py
deleted
100644 → 0
View file @
e2f57ed9
from
django.db
import
models
# Create your models here.
homepage/views.py
View file @
834b656a
from
django.shortcuts
import
redirect
,
render
from
django.shortcuts
import
redirect
,
render
from
board.models
import
Questboard
form
board
.
forms
import
QuestboardForm
def
redirect_to_home
(
request
):
def
redirect_to_home
(
request
):
return
redirect
(
'home/'
)
return
redirect
(
'home/'
)
...
...
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