Add recipient list to comment section
This commit is contained in:
parent
08abb25ce8
commit
1d688a4123
@ -130,7 +130,8 @@ class Post(models.Model):
|
|||||||
recipients = models.ManyToManyField(
|
recipients = models.ManyToManyField(
|
||||||
User,
|
User,
|
||||||
blank=True,
|
blank=True,
|
||||||
related_name='subscriptions'
|
related_name='subscriptions',
|
||||||
|
help_text='will be notified when creating or commenting on a post'
|
||||||
)
|
)
|
||||||
tags = GenericRelation(Tag)
|
tags = GenericRelation(Tag)
|
||||||
|
|
||||||
|
|||||||
@ -51,6 +51,20 @@
|
|||||||
<form action="{% url 'core:comment-create' %}" method="POST">
|
<form action="{% url 'core:comment-create' %}" method="POST">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ comment_create_form.as_p }}
|
{{ comment_create_form.as_p }}
|
||||||
|
<p>
|
||||||
|
{% for recipient in post.recipients.all %}
|
||||||
|
{% if post.recipients.all|length > 2 %}
|
||||||
|
{% if not forloop.last %}{{ recipient }},{% else %}and {{ recipient }}{% endif %}
|
||||||
|
{% elif post.recipients.all|length is 2 %}
|
||||||
|
{% if forloop.last %}and {{ recipient }} {% else %} {{ recipient }}{% endif %}
|
||||||
|
{% else %}
|
||||||
|
{{ recipient }}
|
||||||
|
{% endif %}
|
||||||
|
{% empty %}
|
||||||
|
No one
|
||||||
|
{% endfor %}
|
||||||
|
will be notified when you post your comment.
|
||||||
|
</p>
|
||||||
<input class="action-button" type="submit" value="Post comment">
|
<input class="action-button" type="submit" value="Post comment">
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user