Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

api for post upload #888

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ messagesde:
requirements: pyproject.toml
uv pip compile -o requirements.txt pyproject.toml -p 3.10
uv pip compile -o requirements-test.txt --extra test pyproject.toml -p 3.10

openapi:
python manage.py generateschema --file froide/openapi-schema.yaml
pnpm run openapi
2 changes: 2 additions & 0 deletions froide/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from froide.foirequest.models import FoiMessage, FoiRequest
from froide.foirequest.signals import email_left_queue
from froide.foirequest.tests.factories import (
FoiMessageDraftFactory,
FoiMessageFactory,
FoiProjectFactory,
FoiRequestFactory,
Expand All @@ -33,6 +34,7 @@
register(FoiRequestFollowerFactory)
register(PublicBodyFactory)
register(FoiMessageFactory)
register(FoiMessageDraftFactory)
register(ClassificationFactory)
register(FoiLawFactory)
register(JurisdictionFactory)
Expand Down
22 changes: 19 additions & 3 deletions froide/foirequest/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

from froide.account.models import UserTag
from froide.comments.models import FroideComment
from froide.foirequest.models.message import FoiMessageDraft
from froide.guide.models import Action
from froide.guide.utils import assign_guidance_action
from froide.helper.admin_utils import (
Expand Down Expand Up @@ -521,8 +522,7 @@ class MessageTagsFilter(MultiFilterMixin, TaggitListFilter):
@admin.register(FoiMessage)
class FoiMessageAdmin(admin.ModelAdmin):
save_on_top = True
list_display = (
"is_draft",
list_display = [
"subject",
"timestamp",
"message_page",
Expand All @@ -532,7 +532,7 @@ class FoiMessageAdmin(admin.ModelAdmin):
"registered_mail_date",
"kind",
"get_deliverystatus_display",
)
]
list_filter = (
"kind",
"is_response",
Expand Down Expand Up @@ -752,6 +752,22 @@ def add_comment(
)


@admin.register(FoiMessageDraft)
class FoiMessageDraftAdmin(FoiMessageAdmin):
list_display = ("pk", "request_page", "timestamp", "kind", "user")

def request_page(self, obj):
return format_html(
'<a href="{}">{}</a>', obj.request.get_absolute_short_url(), _("on site")
)

def user(self, obj):
return obj.request.user

def get_queryset(self, request):
return super().get_queryset(request).prefetch_related("deliverystatus")


@admin.register(MessageTag)
class MessageTagAdmin(admin.ModelAdmin):
prepopulated_fields = {"slug": ("name",)}
Expand Down
Loading
Loading