diff options
author | luxagraf <sng@luxagraf.net> | 2023-07-20 10:01:40 -0500 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2023-07-20 10:01:40 -0500 |
commit | 0d9832ddea1bab497674ffcb81503dbc98b014d9 (patch) | |
tree | 50c0bbf0b8c270d344cc25e2bb8525af516286fa | |
parent | 30a7a279f51596aa5c03b1b62d7226b9ae734f94 (diff) |
posts: added a status to notes
-rw-r--r-- | app/posts/migrations/0012_note_status.py | 18 | ||||
-rw-r--r-- | app/posts/models.py | 10 | ||||
-rw-r--r-- | app/posts/templates/posts/note_form.html | 2 | ||||
-rw-r--r-- | app/posts/templates/posts/post_detail.html | 3 | ||||
-rw-r--r-- | app/posts/views.py | 2 |
5 files changed, 32 insertions, 3 deletions
diff --git a/app/posts/migrations/0012_note_status.py b/app/posts/migrations/0012_note_status.py new file mode 100644 index 0000000..a773488 --- /dev/null +++ b/app/posts/migrations/0012_note_status.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.2 on 2023-07-20 13:49 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('posts', '0011_alter_note_url'), + ] + + operations = [ + migrations.AddField( + model_name='note', + name='status', + field=models.IntegerField(choices=[(0, 'Need to Call In'), (1, 'Called In'), (2, 'Testing'), (3, 'Done'), (4, 'Live')], default=0), + ), + ] diff --git a/app/posts/models.py b/app/posts/models.py index 8781bc1..d9a4236 100644 --- a/app/posts/models.py +++ b/app/posts/models.py @@ -98,6 +98,14 @@ class Note(models.Model): body_markdown = models.TextField(blank=True, null=True) date_created = models.DateTimeField(default=timezone.now) post = models.ForeignKey(Post, on_delete=models.CASCADE, null=True) + STATUS = ( + (0, 'Call In'), + (1, 'Coming'), + (2, 'Testing'), + (3, 'Done'), + (4, 'Live'), + ) + status = models.IntegerField(choices=STATUS, default=0) class Meta: ordering = ('date_created',) @@ -108,6 +116,8 @@ class Note(models.Model): def get_absolute_url(self): return reverse('notes:edit', kwargs={"pk": self.pk}) + def save(self, *args, **kwargs): + super(Note, self).save() #URL,This Article,Type,Lead,Previous Leads,Other Testers,Notes/Docs,Last Pub Date,Update Next,Months Since Update,Update Frequency (Months),Updates per year,Prev. Updates,"18 Mo Traffic Trend ''' row[0] #url diff --git a/app/posts/templates/posts/note_form.html b/app/posts/templates/posts/note_form.html index 15797f2..10d81ac 100644 --- a/app/posts/templates/posts/note_form.html +++ b/app/posts/templates/posts/note_form.html @@ -5,7 +5,7 @@ {% for field in form %} <fieldset> - {%if field.name == "post"%}<span class="selector">{{field.label_tag}}</span>{%else%}{{field.label_tag}}{%endif%} + {%if field.name == "post" or field.name == "status" %}<span class="selector">{{field.label_tag}}</span>{%else%}{{field.label_tag}}{%endif%} {%if field.name == "body_markdown"%}<div class="textarea-rounded">{{ field }}</div>{%else%}{{field}}{%endif%} </fieldset> <small class="alert">{% if field.errors %}{{field.errors}}{% endif %}</small> diff --git a/app/posts/templates/posts/post_detail.html b/app/posts/templates/posts/post_detail.html index 8117fe6..193cfa5 100644 --- a/app/posts/templates/posts/post_detail.html +++ b/app/posts/templates/posts/post_detail.html @@ -8,7 +8,8 @@ </div> <div class="note-list">{% for object in object.note_set.all%}<article> <h2>{%if object.url%}<a href="{{object.url}}">{{object.title}}</a>{%else%}{{object.title}}{%endif%}<span class="note-edit"><a href="{{object.get_absolute_url}}">edit</a></span></h2> - <p>{{object.body_markdown}}</p></article> + <p>{{object.body_markdown}}</p> + <p>Status: {% if object.status == 0 %}<span class="alert">{{object.get_status_display}}</span>{%else%}{{object.get_status_display}}{%endif%}</p></article> {% endfor%}</div> </main> {% endblock %} diff --git a/app/posts/views.py b/app/posts/views.py index ae8b1e4..e1af9b5 100644 --- a/app/posts/views.py +++ b/app/posts/views.py @@ -38,7 +38,7 @@ class NoteCreateView(CreateView): class NoteUpdateView(UpdateView): model = Note - fields = ['title', 'url', 'body_markdown', 'post'] + fields = ['title', 'url', 'body_markdown', 'post', 'status'] def get_context_data(self, **kwargs): context = super(NoteUpdateView, self).get_context_data(**kwargs) |