Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Ole Gabor Husebø
rodtrad
Commits
38314e80
Commit
38314e80
authored
Apr 15, 2020
by
Silje Odland
Browse files
fixed challange name
parent
79667251
Changes
7
Hide whitespace changes
Inline
Side-by-side
rodTraa/Templates/base.html
View file @
38314e80
...
...
@@ -55,7 +55,7 @@
<a
class=
"nav-link"
href=
"{% url 'newevent' %}"
>
Nytt arrangement
</a>
</li>
<li
class=
"nav-item"
>
<a
class=
"nav-link"
href=
"{% url 'postpage' %}"
>
Nytt innlegg
</a>
<a
class=
"nav-link"
href=
"{% url 'postpage' %}"
>
Nytt innlegg
</a>
</li>
</ul>
...
...
@@ -83,5 +83,6 @@
</div>
<script
src=
"{% static 'js/theme.js' %}"
>
</script>
</body>
</html>
</html>
\ No newline at end of file
rodTraa/Templates/companypost.html
View file @
38314e80
...
...
@@ -5,12 +5,11 @@
<div
style=
"padding-left: 30px; padding-right: 30px"
>
<div
style=
"border-radius: 20px; margin-top: 90px; min-width: fit-content; max-width: 600px; text-align: center; margin-right: auto; margin-left: auto; background-color: white; height: 400px; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);"
>
<form
style=
"margin-top: 40px"
>
<h2>
Nytt innlegg
</h2>
{% csrf_token %}
<h2>
Ny utfording
</h2>
<div
class=
"custom-file"
style=
"margin-left: 5%; margin-right: 20%; width: 60%"
>
<form
method=
"post"
enctype=
"multipart/form-data"
action=
"{% url 'companypost' %}"
>
{% csrf_token %}
{{ form }}
<button
type=
"submit"
>
Last opp
</button>
</form>
...
...
rodTraa/Templates/postpage.html
View file @
38314e80
...
...
@@ -5,15 +5,24 @@
<div
style=
" padding-left: 30px; padding-right: 30px;"
>
<div
style=
"border-radius: 20px; margin-top: 90px; min-width: fit-content; max-width: 600px; text-align: center; margin-right: auto; margin-left: auto; background-color: white; height:
400px
; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19)"
>
<div
style=
"border-radius: 20px; margin-top: 90px; min-width: fit-content; max-width: 600px; text-align: center; margin-right: auto; margin-left: auto; background-color: white; height:
fit-content
; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19)"
>
<form
method=
"post"
action=
"{% url 'postpage' %}"
enctype=
"multipart/form-data"
style=
"text-align: center; margin-top: 20px "
>
{% csrf_token %}
<h2
style=
"padding-top: 20px"
>
Nytt innlegg
<br></h2>
{% csrf_token %}
{% if privateperson %}
<h2
style=
"padding-top: 20px"
>
Nytt innlegg
<br></h2>
{% else %}
<h2
style=
"padding-top: 20px"
>
Ny utfordring
<br></h2>
<label
style=
"text-align: left; margin-top: 20px"
>
Navnet på utfordringen
<br>
{{ form.name }}
</label><br>
{% endif %}
<label
style=
"margin-top: 20px; text-align: left"
>
Skriv litt om innlegget her
<br>
{{ form.text }}
</label><br>
<label
style=
"text-align: left"
>
Last opp et bilde
<br>
{{ form.image }}
</label><br>
<button
type=
"submit"
class=
"btn btn-outline-info"
style=
"margin-top: 30px"
>
Publiser innlegg
</button>
</form>
{% if privateperson %}
<button
type=
"submit"
class=
"btn btn-outline-info"
style=
"margin-top: 30px"
>
Publiser innlegg
</button>
{% else %}
<button
type=
"submit"
class=
"btn btn-outline-info"
style=
"margin-top: 30px"
>
Publiser utfordring
</button>
{% endif %}
</form><br>
</div>
</div>
...
...
rodTraa/apps/feed/forms.py
View file @
38314e80
...
...
@@ -13,6 +13,7 @@ class PostForm(forms.ModelForm):
class
ChallengeForm
(
forms
.
ModelForm
):
name
=
forms
.
CharField
(
required
=
False
,
widget
=
forms
.
Textarea
(
attrs
=
{
'rows'
:
1
,
'cols'
:
40
}))
text
=
forms
.
CharField
(
required
=
False
,
widget
=
forms
.
Textarea
(
attrs
=
{
'rows'
:
5
,
'cols'
:
40
}))
class
Meta
:
...
...
rodTraa/apps/feed/models.py
View file @
38314e80
...
...
@@ -15,7 +15,7 @@ class Post(models.Model):
like
=
models
.
ManyToManyField
(
User
,
blank
=
True
,
related_name
=
"like"
)
class
Challange
(
models
.
Model
):
name
=
models
.
TextField
(
null
=
True
,
blank
=
True
,
max_length
=
10
0
)
name
=
models
.
TextField
(
null
=
True
,
blank
=
True
,
max_length
=
4
0
)
text
=
models
.
TextField
(
null
=
True
,
blank
=
True
,
max_length
=
4000
)
image
=
models
.
ImageField
(
null
=
False
)
time
=
models
.
DateTimeField
(
null
=
True
)
...
...
rodTraa/apps/feed/views.py
View file @
38314e80
...
...
@@ -8,7 +8,9 @@ from .models import Post, Event, Challange
# Create your views here.
def
postpage
(
request
):
privateperson
=
False
;
if
PrivatePerson
.
objects
.
filter
(
user
=
request
.
user
).
first
():
privateperson
=
True
;
if
request
.
method
==
'POST'
:
form
=
PostForm
(
request
.
POST
,
request
.
FILES
)
form
.
instance
.
post_owner
=
request
.
user
...
...
@@ -19,7 +21,7 @@ def postpage(request):
return
redirect
(
'startpage'
)
else
:
form
=
PostForm
()
return
render
(
request
,
'postpage.html'
,
{
'form'
:
form
})
return
render
(
request
,
'postpage.html'
,
{
'form'
:
form
,
'privateperson'
:
privateperson
})
else
:
if
request
.
method
==
'POST'
:
...
...
@@ -32,9 +34,7 @@ def postpage(request):
return
redirect
(
'challenges'
)
else
:
form
=
ChallengeForm
()
return
render
(
request
,
'postpage.html'
,
{
'form'
:
form
})
return
render
(
request
,
'postpage.html'
,
{
'form'
:
form
,
'privateperson'
:
privateperson
})
def
deletePost
(
request
,
pk
):
post
=
Post
.
objects
.
filter
(
pk
=
pk
).
first
()
...
...
rodTraa/apps/staticpages/views.py
View file @
38314e80
...
...
@@ -28,7 +28,7 @@ def companyprofile(request,pk):
def
challenges
(
request
):
challengeposts
=
Challange
.
objects
.
all
().
order_by
(
'-time'
)
privateperson
=
False
;
privateperson
=
False
if
PrivatePerson
.
objects
.
filter
(
user
=
request
.
user
).
first
():
privateperson
=
True
return
render
(
request
,
"challenges.html"
,
{
'challengeposts'
:
challengeposts
,
'privateperson'
:
privateperson
})
...
...
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