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(
|
||||
User,
|
||||
blank=True,
|
||||
related_name='subscriptions'
|
||||
related_name='subscriptions',
|
||||
help_text='will be notified when creating or commenting on a post'
|
||||
)
|
||||
tags = GenericRelation(Tag)
|
||||
|
||||
|
||||
@ -51,6 +51,20 @@
|
||||
<form action="{% url 'core:comment-create' %}" method="POST">
|
||||
{% csrf_token %}
|
||||
{{ 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">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user