From 643e9ea1d39dfd30e7f6bc61189d8534a2711024 Mon Sep 17 00:00:00 2001 From: andrewlalis Date: Thu, 18 Oct 2018 10:32:37 +0200 Subject: [PATCH] Added temporary user name shortcut for now. --- backend/db.sqlite3 | Bin 79872 -> 79872 bytes .../migrations/0005_review_author_name.py | 18 ++++++++++++++++++ backend/postings/models.py | 2 ++ .../templates/postings/frontend/entity.html | 4 ++-- .../templates/postings/frontend/review.html | 2 +- backend/postings/views.py | 1 + 6 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 backend/postings/migrations/0005_review_author_name.py diff --git a/backend/db.sqlite3 b/backend/db.sqlite3 index c569ecb7996f92af1140e34288f371bb93ae6de0..92f7380d513d38ab1a12c2d3571bbb25c167fd67 100644 GIT binary patch delta 706 zcmYk2ZAepL6vvOhK#Vn1=D5;eaB5g8>ntB+nxzodzFsOGYs)r-Uo|po+ng` zFuT0vhC0YBem!07;9K;sM#dei5o4vQrFBLhF^Db~+&QUU*=>eiHTY6gAMbuvzwKRA z6MHx76v|TX(_- zF%(b4Z;U1;#}!)zL5I>%gy|NTI|RLEf&s-xu*{~pTj9we*k&@avJ*;k5q@cfM~7gI zks@7+p$KoeK&km((@cgrUu78MtK|C?M@1UY;u4(FY9(@bSAu%&rvy^DQhnJVo~2-) g=5d2n`_%?b+G632PlAr;7CQ(J_jSuU84e780ap^jG5`Po delta 612 zcmXv~OK1~O6n*#Imxd;peA<`@p-F3+rgjpsh(aiSW+Sv!Nrl9XAPPlFp$Ump!A(X% z6j5xSbX*835)fSJ)I__m$-)*Ibfa{kn`99y=psTJL`8iw(tA0F`wr)Rc!d@#wAh`1 zr%DJpAuuXH1@d#TeL~#hZCJ$1g)an?W6!dq*pU)d;-tQeW6WQ`2yS2zPvZ!Ej~1M! z6LdL>FgzCzK!k1Z{nzTX11{{8kf)=H_U?u zg$)Yw&*k7_R_S#!SR|;>>vUWc!!%>u4*Fu_c$b7D1RzZyZ6x=wHlzek*sh*SS^csM z*DmwH%`lAfdcB9=YFK%8bB*8Ky2O>OBzFfHyb<>5^B;^kEwo0kh6|WRAFYWUuc%)8 zbEFT($`FIUSa!#tg>y;ELO*mkN(6KCE$xFFq{KZRijJhqMj(8}uP8vY`F>cD)E!PC zMb#ct%0%F%r0$l4lu-98N+;1g1MomncR6gN^ROB=rPTqrC#iP3aLKCGlxCx#x+NMQ zjI0xwChPPIjf$&RQ0+RU&B$<2V={!aH5m?|8c%Dlhv2C8)Q~<7K|nhsL);<$(|{Q~ T+OF#N>pNk-mzCLG_-*|MEik2K diff --git a/backend/postings/migrations/0005_review_author_name.py b/backend/postings/migrations/0005_review_author_name.py new file mode 100644 index 0000000..dae5770 --- /dev/null +++ b/backend/postings/migrations/0005_review_author_name.py @@ -0,0 +1,18 @@ +# Generated by Django 2.1.1 on 2018-10-18 08:30 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('postings', '0004_remove_reviewhelpfulvote_user'), + ] + + operations = [ + migrations.AddField( + model_name='review', + name='author_name', + field=models.CharField(default='Anonymous', max_length=64), + ), + ] diff --git a/backend/postings/models.py b/backend/postings/models.py index de4c017..f6ca417 100644 --- a/backend/postings/models.py +++ b/backend/postings/models.py @@ -74,6 +74,8 @@ class Review(models.Model): last_updated_date = models.DateTimeField(auto_now=True) # A reference to the person who created this review. author = models.ForeignKey('postings.User', on_delete=models.PROTECT, null=True, blank=True) + # TEMPORARY: Name of person who gave review. + author_name = models.CharField(max_length=64, default='Anonymous') # Gets the total number of votes which marked this review as 'helpful'. @property diff --git a/backend/postings/templates/postings/frontend/entity.html b/backend/postings/templates/postings/frontend/entity.html index 52c58aa..3350487 100644 --- a/backend/postings/templates/postings/frontend/entity.html +++ b/backend/postings/templates/postings/frontend/entity.html @@ -55,8 +55,8 @@ {# Username input #}
- - + +
{# Title input #} diff --git a/backend/postings/templates/postings/frontend/review.html b/backend/postings/templates/postings/frontend/review.html index ab4f843..6e83a36 100644 --- a/backend/postings/templates/postings/frontend/review.html +++ b/backend/postings/templates/postings/frontend/review.html @@ -7,7 +7,7 @@ {# Username #} - + {# Date at which review was posted. #}
{{ review.created_date|date:"j M, Y" }}
diff --git a/backend/postings/views.py b/backend/postings/views.py index bf668c8..89c1225 100644 --- a/backend/postings/views.py +++ b/backend/postings/views.py @@ -71,6 +71,7 @@ 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']