-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #165 from 2077-Collective/staging
Staging to Main merge
- Loading branch information
Showing
6 changed files
with
53 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from .category_admin import CategoryAdmin | ||
from .author_admin import AuthorAdmin | ||
from .article_admin import ArticleAdmin | ||
from .log_entry import LogEntryAdmin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from django.contrib import admin | ||
from django.contrib.admin.models import LogEntry | ||
from django.utils.translation import gettext_lazy as _ | ||
|
||
class LogEntryAdmin(admin.ModelAdmin): | ||
list_display = ('action_time', 'user', 'content_type', 'object_id', 'action_flag', 'change_message') | ||
list_filter = ('action_flag', 'user', 'content_type') | ||
search_fields = ('object_id', 'change_message') | ||
|
||
admin.site.register(LogEntry, LogEntryAdmin) |
18 changes: 18 additions & 0 deletions
18
server/apps/research/migrations/0019_alter_article_status.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 5.0.8 on 2024-09-02 23:20 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('research', '0018_alter_article_acknowledgement'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='article', | ||
name='status', | ||
field=models.CharField(choices=[('draft', 'Draft'), ('ready', 'Ready')], db_index=True, default='draft', max_length=10), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,20 @@ | ||
from django.urls import path, include, re_path | ||
from rest_framework.routers import DefaultRouter | ||
from .views import ArticleViewSet, index | ||
from django.urls import path, re_path, include | ||
from django.conf import settings | ||
from django.conf.urls.static import static | ||
from django.http import HttpResponse | ||
import requests | ||
from django.views.generic.base import RedirectView | ||
from rest_framework.routers import DefaultRouter | ||
from .views import ArticleViewSet | ||
|
||
router = DefaultRouter() | ||
router.register(r'articles', ArticleViewSet, basename='article') | ||
|
||
urlpatterns = [ | ||
path('', index, name='index'), | ||
path('', RedirectView.as_view(url='/admin/', permanent=False)), # Redirect root to admin | ||
path('api/', include(router.urls)), | ||
|
||
# Custom URL for retrieving articles by slug or UUID | ||
re_path(r'^api/articles/(?P<identifier>[-\w0-9a-fA-F]+)/$', ArticleViewSet.as_view({'get': 'retrieve_by_identifier'}), name='article-detail-by-identifier'), | ||
|
||
# Custom URL for retrieving articles by category | ||
re_path(r'^api/articles/category/(?P<category>[-\w]+)/$', ArticleViewSet.as_view({'get': 'retrieve_by_category'}), name='article-list-by-category'), | ||
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) | ||
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters