diff --git a/backend/db.sqlite3 b/backend/db.sqlite3 index 92f7380..2c112bb 100644 Binary files a/backend/db.sqlite3 and b/backend/db.sqlite3 differ 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