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ba%PN7wzOcI{&yH5kwCkhst1X>vI|$Nl1Nb9$1-TpO>Ae`THLfI_u?O5qo^&XpUq zA(Mr#%0?4iuM_$nKc=r)=4NguPu4t7up^gI4;lAGi5_iUE0PCz5;eg{Dso;~wJ!Aq U$#e8S$6_p_;3znfyyQsy0N#v+*8l(j diff --git a/boards/views.py b/boards/views.py --- a/boards/views.py +++ b/boards/views.py @@ -1,20 +1,30 @@ from django.template import RequestContext from boards import forms +from boards.forms import NewThreadForm from boards.models import Post, Admin from django.shortcuts import render, get_list_or_404 -from django.http import HttpResponseRedirect, Http404 +from django.http import HttpResponseRedirect def index(request): context = RequestContext(request) if request.method == 'POST': - Post.objects.create_post(request.POST['title'], - request.POST['text'], ip = request.META['REMOTE_ADDR']) + + form = NewThreadForm(request.POST) + if form.is_valid(): + + Post.objects.create_post(form.cleaned_data['title'], + form.cleaned_data['text'], ip = request.META['REMOTE_ADDR']) + else: + context['form'] = form + threads = Post.objects.get_threads() context['threads'] = None if len(threads) == 0 else threads - context['form'] = forms.NewThreadForm() + + if 'form' not in context: + context['form'] = forms.NewThreadForm() return render(request, 'posting_general.html', context) diff --git a/boards/views.pyc b/boards/views.pyc index d3292785945e6f68eeab63b3ddebfa0172a14127..dd4c9a78915a8309584ecfcdd28a2804c7e96f25 GIT binary patch literal 3063 zc$}?P%Wm676ul&6y=>X3otM%eB@7f`T2xMfwCF-88YE7#NSu`RN7X@{~d zjk=UA(`eaxo0P6l)}v96vQ-+bvbRM)6OGm=ZcE_`#T_YpLUC6L>l80bVT0loDO{zv zN4vo)Z#emv{{n|g2Gvl#JyO~{EOMjX8|zZL2*tJL-7vpj1)(nEe3|Fby^@ z3vHzPgE&ia>u<6tRUWI-tZ{Lo%s5T785iaF{=NIQ&s8>0jhTf?&x%~DP{m29_Kj&R z8o1{^7RMr(@FDR28$*dsh~^HRIw(vXz<=mcX~?+Z@uZc@E=?OW=gmxTq-m3;EpfKN zP=8VKsLy<0Tn7~N=dRGx;&tL3qj~_gG z6iPdoN}x*t&j?Fe1K}C7ljM`}MCGcC(!qhr(g2)qJBl^RDR;9mZB;uP&$oCfl zlz8u-x>bb*1&ughowdk4LA=N@7LClwJ8d8d>;{-!-<9x*{m9SNu@6}NAjy3ToL`iF zq`9qBv-HE=K?tdY%T<&nSu{~Qf}qeRjD_nk8-NRa!ahtrF1%d@FP6F#Q~@UMT_oXS zDmcjNIX$=6sKdBX!8o}HBZI{Pw@A$$hp}Y2ETY`QUKzW&fQWE=h&V;Kxj>UK9rCaf zL3+rVK9K|qoDo^jxc-XG6J`7;O??wh7SL)xz=pMdobX|fxY?gYoVd*0fvA;xN?3{d z{x_a>0*N{dc(T10Hfs`O=na^g=aepV2xPp#IFB+V3xu~WN#o&XJaT|3RxJzeItzN! z=|a-(MJ~RxDRnAx75M1_{0o=?uH?zst-<3e zEN~a#lJpmco0kccon^gWPNSvt}+bUr`G@{$7 zTpaZ<$h{tftT87Sx^B>6L+&$&%Ab%5&&<Wz0AHfz zr6GGR7mtTayBXwgPb*QAcZU<$ZKv-x`FG8`&4DDksI(!vxIxvM#6Cra$YhePY<%p5 z!37-ciN1jO5(Z83(2`SLnzH#YoYY=nBA`l6&)EsCVYd*2ooHZGHcR<7|M(!VQ_1Zt zx4W$mL s(pUI7%srT|&tY;IH`S1LeUz&2aYTKc%@qfq>-e~xo1InutaPsZ2WZJ diff --git a/templates/base.html b/templates/base.html --- a/templates/base.html +++ b/templates/base.html @@ -5,7 +5,7 @@ {% block head %}{% endblock %} -
+
{% if request.session.admin == True %} Admin panel TODO: Need to implement
diff --git a/templates/posting_general.html b/templates/posting_general.html --- a/templates/posting_general.html +++ b/templates/posting_general.html @@ -17,8 +17,32 @@
{% csrf_token %} - {{ form.as_p }} - +
+ {{ form.title.errors }} + + + {{ form.title }} +
+ +
+ {{ form.text.errors }} + + + {{ form.text }} +
+ +
+ + {{ form.image }} +
+ +
+ {{ form.tags.errors}} + + {{ form.tags }} +
+ +