Skip to content

Commit

Permalink
bug(fix): Fixed the article update bug
Browse files Browse the repository at this point in the history
  • Loading branch information
happychuks committed Sep 23, 2024
1 parent 78325ea commit c1178bc
Show file tree
Hide file tree
Showing 23 changed files with 125 additions and 473 deletions.
4 changes: 2 additions & 2 deletions server/apps/research/admin/article_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ class ArticleAdmin(admin.ModelAdmin):
"""Admin interface for the Article model."""
form = ArticleForm
fieldsets = [
('Article Details', {'fields': ['title', 'authors', 'acknowledgement', 'categories', 'thumb', 'content', 'summary', 'status', 'scheduled_publish_time']}),
('Article Details', {'fields': ['title', 'slug', 'authors', 'acknowledgement', 'categories', 'thumb', 'content', 'summary', 'status', 'scheduled_publish_time']}),
]
list_display = ('title', 'display_authors', 'status', 'views', 'display_categories', 'min_read', 'created_at', 'scheduled_publish_time')
search_fields = ('title', 'authors__user__username', 'authors__twitter_username', 'content')
list_per_page = 25
list_filter = ('authors', 'status', 'categories', 'created_at')
readonly_fields = ('views', 'slug')
readonly_fields = ('views',)
list_editable = ('status',)

def display_authors(self, obj):
Expand Down
61 changes: 59 additions & 2 deletions server/apps/research/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,69 @@
# Generated by Django 5.0.7 on 2024-08-05 02:36
# Generated by Django 5.0.8 on 2024-09-23 11:35

from django.db import migrations
import apps.research.models.article
import django.db.models.deletion
import tinymce.models
import uuid
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]

operations = [
migrations.CreateModel(
name='Category',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
('created_at', models.DateTimeField(auto_now_add=True, db_index=True)),
('updated_at', models.DateTimeField(auto_now=True, null=True)),
('name', models.CharField(max_length=255)),
],
options={
'verbose_name_plural': 'Categories',
},
),
migrations.CreateModel(
name='Author',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
('created_at', models.DateTimeField(auto_now_add=True, db_index=True)),
('updated_at', models.DateTimeField(auto_now=True, null=True)),
('bio', models.TextField(blank=True, null=True)),
('twitter_username', models.CharField(blank=True, max_length=100, null=True)),
('full_name', models.CharField(blank=True, max_length=255, null=True)),
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
options={
'verbose_name_plural': 'Authors',
},
),
migrations.CreateModel(
name='Article',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
('created_at', models.DateTimeField(auto_now_add=True, db_index=True)),
('updated_at', models.DateTimeField(auto_now=True, null=True)),
('title', models.TextField()),
('content', tinymce.models.HTMLField(blank=True, null=True)),
('summary', models.TextField(blank=True)),
('acknowledgement', tinymce.models.HTMLField(blank=True, null=True)),
('slug', models.SlugField(blank=True)),
('thumb', models.ImageField(blank=True, default=apps.research.models.article.get_default_thumb, upload_to='images/')),
('views', models.PositiveBigIntegerField(default=0)),
('status', models.CharField(choices=[('draft', 'Draft'), ('ready', 'Ready')], db_index=True, default='draft', max_length=10)),
('scheduled_publish_time', models.DateTimeField(blank=True, db_index=True, null=True)),
('authors', models.ManyToManyField(blank=True, related_name='articles', to='research.author')),
('categories', models.ManyToManyField(blank=True, related_name='articles', to='research.category')),
],
options={
'ordering': ('-scheduled_publish_time',),
},
),
]
52 changes: 0 additions & 52 deletions server/apps/research/migrations/0002_initial.py

This file was deleted.

This file was deleted.

17 changes: 0 additions & 17 deletions server/apps/research/migrations/0004_alter_author_options.py

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

19 changes: 0 additions & 19 deletions server/apps/research/migrations/0008_alter_article_content.py

This file was deleted.

19 changes: 0 additions & 19 deletions server/apps/research/migrations/0009_alter_article_thumb.py

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit c1178bc

Please sign in to comment.