From b666a135625c0414e47c5bc0db0234007df5a482 Mon Sep 17 00:00:00 2001 From: andrewlalis Date: Thu, 18 Oct 2018 10:47:21 +0200 Subject: [PATCH] Added names. --- backend/db.sqlite3 | Bin 79872 -> 79872 bytes backend/postings/forms.py | 4 +++- backend/postings/views.py | 8 +++++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/backend/db.sqlite3 b/backend/db.sqlite3 index 92f7380d513d38ab1a12c2d3571bbb25c167fd67..2c112bb1fe9db45c079c3e36bfb0f65a8ebbc2a1 100644 GIT binary patch delta 952 zcmZ{jL1@!Z7{~MaWsY@huG^~Ua6V9QLsybEZITw09t+}O7ZDHct$k@;mgdD|UD;uD z;$4(oJbIFWc#whxQS>$nB8VV@2qMTX9_Gb^^WaO}Dt0cAfAaW;@Av)R_p-htukXlr zr$#!GBwZ1A_qsQuqt26s7lW`0ORa?bAhz);Zla})pYfY#;F&bK|DhyJ9EbDB=ixH* zs^N`*t}xn2w(bnCY@Qs3js&~#1HQvI*oH6g2|mC(cmo|#@)1nSAfaR=laWkBG9F1H zlCjoy`;>fa7`FCne1?zk9^S%h*lLYFe+(P4zUWf z;H=bxfDzlS+g6kQTPS1ZH8W+Tv$>pch@&fJ(c|7~jn_jjA%e}BT}sRN9M zFu`I1%Y89HU%dEYh`cXSQvlOqj2X?$nFoM-j;Z&6x1=#aRIhc3Fi%6Ddm&qNDGtjv z=WYov+ss?qTVWRBD(96HF5ASbQe0cbH8IY=pkj2CL=UQ(GPG>k=-bzxlTo!^4+G*b hBiN1puoCRH(FL>vvCBsv&LH{eStQGCSwX)Be*>)50L1_R delta 203 zcmZqpz|!!6Wr8&CVFm^UKOpu5Vy1~2=8T6oChTQr&SuWuEXcBeY4QOsOU8!DzqksO zg~ge*84L1@OEUA)i{pz@%Q92T`I&by@Bwu~!R9{hvK4%+%+DE^e=~n${>c1>`8m*- ztIV69Zq1l(@{i`RRV?1PQ2iMj-72#NI$`0K|GgB`=sKX|OD3(P3oS d&Z5Eihk3K0%6sO?3M_(?ez0z5HDLVB4gg=6IdA{~ diff --git a/backend/postings/forms.py b/backend/postings/forms.py index 99d8065..ccd5446 100644 --- a/backend/postings/forms.py +++ b/backend/postings/forms.py @@ -9,4 +9,6 @@ class EntityReviewForm(forms.Form): # The textual content of the review. content = forms.CharField(widget=forms.Textarea) # The id of the entity for which the review is created. - entity_id = forms.IntegerField() \ No newline at end of file + entity_id = forms.IntegerField() + # TEMPORARY name for author name. + name = forms.CharField(max_length=64, required=False) \ No newline at end of file diff --git a/backend/postings/views.py b/backend/postings/views.py index 89c1225..51f26f4 100644 --- a/backend/postings/views.py +++ b/backend/postings/views.py @@ -71,10 +71,15 @@ def post_review(request): if form.is_valid(): # Only if the request is a POST and the form is valid do we do anything. rating = form.cleaned_data['rating'] - name = form.cleaned_data['name'] title = form.cleaned_data['title'] content = form.cleaned_data['content'] entity_id = form.cleaned_data['entity_id'] + + if 'name' in request.POST: + author_name = form.cleaned_data['name'] + else: + author_name = None + try: entity = RateableEntity.objects.get(pk=entity_id) except RateableEntity.DoesNotExist: @@ -83,6 +88,7 @@ def post_review(request): # Creates the new Review object from the posted data. review = Review.objects.create( rating=rating, + author_name=author_name, title=title, content=content, rateable_entity=entity