From ecf06d40be3c3ce98ace88c4a738779b37381c23 Mon Sep 17 00:00:00 2001 From: luxagraf Date: Wed, 1 Nov 2023 08:56:14 -0400 Subject: posts: updated post edit template --- app/posts/forms.py | 2 +- app/posts/migrations/0017_post_edit_url.py | 18 ++++++++++++++++++ app/posts/models.py | 1 + app/posts/templates/posts/post_form.html | 2 +- 4 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 app/posts/migrations/0017_post_edit_url.py diff --git a/app/posts/forms.py b/app/posts/forms.py index f1b9960..4013040 100644 --- a/app/posts/forms.py +++ b/app/posts/forms.py @@ -16,4 +16,4 @@ class PostUpdateForm(ModelForm): class Meta: model = Post - fields = ['title', 'post_status'] + fields = ['title', 'post_status', 'url', 'template_type', 'update_frequency', 'edit_url', 'date_last_pub'] diff --git a/app/posts/migrations/0017_post_edit_url.py b/app/posts/migrations/0017_post_edit_url.py new file mode 100644 index 0000000..1f7499b --- /dev/null +++ b/app/posts/migrations/0017_post_edit_url.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.2 on 2023-11-01 12:54 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('posts', '0016_post_post_status'), + ] + + operations = [ + migrations.AddField( + model_name='post', + name='edit_url', + field=models.CharField(blank=True, max_length=512, null=True), + ), + ] diff --git a/app/posts/models.py b/app/posts/models.py index b518554..06794be 100644 --- a/app/posts/models.py +++ b/app/posts/models.py @@ -30,6 +30,7 @@ class Post(models.Model): title = models.CharField(max_length=512, blank=True, null=True) body = models.TextField(blank=True, null=True) url = models.CharField(max_length=512, blank=True, null=True) + edit_url = models.CharField(max_length=512, blank=True, null=True) date_last_pub = models.DateField() guid = models.CharField(max_length=512, blank=True, null=True, db_index=True) author = models.CharField(max_length=255, blank=True, null=True) diff --git a/app/posts/templates/posts/post_form.html b/app/posts/templates/posts/post_form.html index 23289fe..35e2959 100644 --- a/app/posts/templates/posts/post_form.html +++ b/app/posts/templates/posts/post_form.html @@ -4,7 +4,7 @@
{% csrf_token %} {% for field in form %}
- {%if field.name == "guide_type" or field.name == "post_status" %}{{field.label_tag}}{%else%}{{field.label_tag}}{%endif%} + {%if field.name == "guide_type" or field.name == "post_status" or field.name == "template_type" %}{{field.label_tag}}{%else%}{{field.label_tag}}{%endif%} {%if field.name == "body_markdown"%}
{{ field }}
{%else%}{{field}}{%endif%}
{% if field.errors %}{{field.errors}}{% endif %} -- cgit v1.2.3-70-g09d2