Show More
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
@@ -4,5 +4,5 b' from django import forms' | |||||
4 | class NewThreadForm(forms.Form): |
|
4 | class NewThreadForm(forms.Form): | |
5 | title = forms.CharField(max_length = 100) |
|
5 | title = forms.CharField(max_length = 100) | |
6 | text = forms.CharField(widget = forms.Textarea) |
|
6 | text = forms.CharField(widget = forms.Textarea) | |
7 | image = forms.ImageField() |
|
7 | image = forms.ImageField(required=False) | |
8 | tags = forms.CharField(max_length=100) |
|
8 | tags = forms.CharField(max_length=100) |
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
@@ -2,11 +2,24 b' html {' | |||||
2 | background: #555555; |
|
2 | background: #555555; | |
3 | } |
|
3 | } | |
4 |
|
4 | |||
5 |
|
|
5 | .admin_panel { | |
6 | background: #FF0000; |
|
6 | background: #FF0000; | |
7 | color: #00FF00 |
|
7 | color: #00FF00 | |
8 | } |
|
8 | } | |
9 |
|
9 | |||
|
10 | .input_field { | |||
|
11 | ||||
|
12 | } | |||
|
13 | ||||
|
14 | .input_field_name { | |||
|
15 | ||||
|
16 | } | |||
|
17 | ||||
|
18 | .input_field_error { | |||
|
19 | color: #FF0000; | |||
|
20 | } | |||
|
21 | ||||
|
22 | ||||
10 | .title { |
|
23 | .title { | |
11 | font-weight: bold; |
|
24 | font-weight: bold; | |
12 | color: #ffcc00; |
|
25 | color: #ffcc00; |
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
@@ -1,20 +1,30 b'' | |||||
1 | from django.template import RequestContext |
|
1 | from django.template import RequestContext | |
2 | from boards import forms |
|
2 | from boards import forms | |
|
3 | from boards.forms import NewThreadForm | |||
3 | from boards.models import Post, Admin |
|
4 | from boards.models import Post, Admin | |
4 | from django.shortcuts import render, get_list_or_404 |
|
5 | from django.shortcuts import render, get_list_or_404 | |
5 |
from django.http import HttpResponseRedirect |
|
6 | from django.http import HttpResponseRedirect | |
6 |
|
7 | |||
7 | def index(request): |
|
8 | def index(request): | |
8 | context = RequestContext(request) |
|
9 | context = RequestContext(request) | |
9 |
|
10 | |||
10 | if request.method == 'POST': |
|
11 | if request.method == 'POST': | |
11 | Post.objects.create_post(request.POST['title'], |
|
12 | ||
12 | request.POST['text'], ip = request.META['REMOTE_ADDR']) |
|
13 | form = NewThreadForm(request.POST) | |
|
14 | if form.is_valid(): | |||
|
15 | ||||
|
16 | Post.objects.create_post(form.cleaned_data['title'], | |||
|
17 | form.cleaned_data['text'], ip = request.META['REMOTE_ADDR']) | |||
|
18 | else: | |||
|
19 | context['form'] = form | |||
|
20 | ||||
13 |
|
21 | |||
14 | threads = Post.objects.get_threads() |
|
22 | threads = Post.objects.get_threads() | |
15 |
|
23 | |||
16 | context['threads'] = None if len(threads) == 0 else threads |
|
24 | context['threads'] = None if len(threads) == 0 else threads | |
17 | context['form'] = forms.NewThreadForm() |
|
25 | ||
|
26 | if 'form' not in context: | |||
|
27 | context['form'] = forms.NewThreadForm() | |||
18 |
|
28 | |||
19 | return render(request, 'posting_general.html', |
|
29 | return render(request, 'posting_general.html', | |
20 | context) |
|
30 | context) |
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
@@ -5,7 +5,7 b'' | |||||
5 | {% block head %}{% endblock %} |
|
5 | {% block head %}{% endblock %} | |
6 | </head> |
|
6 | </head> | |
7 | <body> |
|
7 | <body> | |
8 |
<div |
|
8 | <div class="admin_panel"> | |
9 |
|
9 | |||
10 | {% if request.session.admin == True %} |
|
10 | {% if request.session.admin == True %} | |
11 | Admin panel TODO: Need to implement <BR /> |
|
11 | Admin panel TODO: Need to implement <BR /> |
@@ -17,8 +17,32 b'' | |||||
17 |
|
17 | |||
18 | <div class="post-form"> |
|
18 | <div class="post-form"> | |
19 | <form action="/boards/" method="post">{% csrf_token %} |
|
19 | <form action="/boards/" method="post">{% csrf_token %} | |
20 | {{ form.as_p }} |
|
20 | <div class="input_field_name"> | |
21 | <input type="submit" value="Post!" /> |
|
21 | <span class=input_field_error>{{ form.title.errors }}</span> | |
|
22 | ||||
|
23 | <label class=input_field_name for="title">Title</label> | |||
|
24 | {{ form.title }} | |||
|
25 | </div> | |||
|
26 | ||||
|
27 | <div class="input_field_name"> | |||
|
28 | <span class=input_field_error>{{ form.text.errors }}</span> | |||
|
29 | ||||
|
30 | <label class=input_field_name for="text">Text</label> | |||
|
31 | {{ form.text }} | |||
|
32 | </div> | |||
|
33 | ||||
|
34 | <div class="input_field_name"> | |||
|
35 | <label class=input_field_name for="image">Avatar</label> | |||
|
36 | {{ form.image }} | |||
|
37 | </div> | |||
|
38 | ||||
|
39 | <div class="input_field_name"> | |||
|
40 | <span class=input_field_error>{{ form.tags.errors}}</span> | |||
|
41 | <label class=input_field_name for="tags">Name</label> | |||
|
42 | {{ form.tags }} | |||
|
43 | </div> | |||
|
44 | ||||
|
45 | <input type="submit" value="Create" /> | |||
22 | </form> |
|
46 | </form> | |
23 | </div> |
|
47 | </div> | |
24 |
|
48 |
General Comments 0
You need to be logged in to leave comments.
Login now