Added temporary user name shortcut for now.
This commit is contained in:
parent
176658c319
commit
643e9ea1d3
Binary file not shown.
|
@ -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),
|
||||
),
|
||||
]
|
|
@ -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
|
||||
|
|
|
@ -55,8 +55,8 @@
|
|||
|
||||
{# Username input #}
|
||||
<div class="form-group">
|
||||
<label for="name_input">Name:</label>
|
||||
<input type="text" class="form-control" placeholder="Name..." id="name_input">
|
||||
<label for="name_input">Name (Optional):</label>
|
||||
<input type="text" class="form-control" placeholder="Name..." id="name_input" name="name">
|
||||
</div>
|
||||
|
||||
{# Title input #}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<span class="big-font glyphicon glyphicon-user img-rounded"></span>
|
||||
|
||||
{# Username #}
|
||||
<div class="review-block-name"><a href="#">Student</a></div>
|
||||
<div class="review-block-name"><a href="#">{{ review.author_name }}</a></div>
|
||||
|
||||
{# Date at which review was posted. #}
|
||||
<div class="review-block-date">{{ review.created_date|date:"j M, Y" }}<br/></div>
|
||||
|
|
|
@ -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']
|
||||
|
|
Loading…
Reference in New Issue