Changeset - 9ff46824209a
[Not reviewed]
0 5 1
Ben Sturmfels (bsturmfels) - 2 months ago 2024-03-15 07:49:48
ben@sturm.com.au
usethesource: Allow comments to be attributed to non-account holders
6 files changed with 25 insertions and 4 deletions:
0 comments (0 inline, 0 general)
conservancy/usethesource/forms.py
Show inline comments
...
 
@@ -10,3 +10,3 @@ class CommentForm(forms.ModelForm):
 
        model = Comment
 
        fields = ['time', 'message', 'post_to_list']
 
        fields = ['time', 'attribute_to', 'message', 'post_to_list']
 

	
conservancy/usethesource/migrations/0008_comment_attribute_to.py
Show inline comments
 
new file 100644
 
# Generated by Django 3.2.19 on 2024-03-15 03:43
 

	
 
from django.db import migrations, models
 

	
 

	
 
class Migration(migrations.Migration):
 

	
 
    dependencies = [
 
        ('usethesource', '0007_candidate_show_download_disclaimer'),
 
    ]
 

	
 
    operations = [
 
        migrations.AddField(
 
            model_name='comment',
 
            name='attribute_to',
 
            field=models.CharField(blank=True, max_length=50),
 
        ),
 
    ]
conservancy/usethesource/models.py
Show inline comments
...
 
@@ -43,2 +43,3 @@ class Comment(models.Model):
 
    user = models.ForeignKey(User, on_delete=models.PROTECT)
 
    attribute_to = models.CharField(max_length=50, blank=True)
 
    time = models.DateTimeField(default=timezone.now)
conservancy/usethesource/templates/usethesource/add_comment_form.html
Show inline comments
...
 
@@ -2,3 +2,4 @@
 
  {% csrf_token %}
 
  <div>{{ form.time }}</div>
 
  <div><label>Time: {{ form.time }}</label></div>
 
  <div class="mt2"><label>Attribute to: {{ form.attribute_to }}</label></div>
 
  <div class="mt2">{{ form.message }}</div>
conservancy/usethesource/templates/usethesource/comment_partial.html
Show inline comments
 
<div class="mb4" hx-target="this" hx-swap="outerHTML"><strong>{{ comment.user }} — {{ comment.time }}</strong>
 
<div class="mb4" hx-target="this" hx-swap="outerHTML"><strong>{% if comment.attribute_to %}{{ comment.attribute_to }}{% else %}{{ comment.user }}{% endif %} — {{ comment.time }}</strong>
 
  {% if user.is_staff %}
conservancy/usethesource/templates/usethesource/edit_comment_form.html
Show inline comments
...
 
@@ -2,3 +2,4 @@
 
  {% csrf_token %}
 
  <div>{{ form.time }}</div>
 
  <div><label>Time: {{ form.time }}</label></div>
 
  <div class="mt2"><label>Attribute to: {{ form.attribute_to }}</label></div>
 
  <div class="mt2">{{ form.message }}</div>
0 comments (0 inline, 0 general)