-
Notifications
You must be signed in to change notification settings - Fork 27
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 #990 from thunderstore-io/minor-fixes
Several smaller fixes
- Loading branch information
Showing
11 changed files
with
126 additions
and
6 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
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,35 @@ | ||
from django.contrib import admin | ||
from django.http import HttpRequest | ||
|
||
from thunderstore.repository.models import AsyncPackageSubmission | ||
|
||
|
||
@admin.register(AsyncPackageSubmission) | ||
class AsyncPackageSubmissionAdmin(admin.ModelAdmin): | ||
raw_id_fields = ( | ||
"owner", | ||
"file", | ||
) | ||
list_select_related = ( | ||
"owner", | ||
"file", | ||
) | ||
list_display = ( | ||
"owner", | ||
"file", | ||
"status", | ||
"datetime_scheduled", | ||
"datetime_polled", | ||
"datetime_finished", | ||
) | ||
list_filter = ("status",) | ||
search_fields = ("owner__username",) | ||
|
||
def has_add_permission(self, request: HttpRequest, obj=None) -> bool: | ||
return False | ||
|
||
def has_change_permission(self, request: HttpRequest, obj=None) -> bool: | ||
return False | ||
|
||
def has_delete_permission(self, request: HttpRequest, obj=None) -> bool: | ||
return False |
36 changes: 36 additions & 0 deletions
36
django/thunderstore/repository/admin/tests/test_submission.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,36 @@ | ||
import pytest | ||
from django.conf import settings | ||
from django.test import Client | ||
|
||
from thunderstore.repository.factories import AsyncPackageSubmissionFactory | ||
|
||
|
||
@pytest.mark.django_db | ||
def test_admin_asyncpackagesubmission_search(admin_client: Client) -> None: | ||
username = AsyncPackageSubmissionFactory().owner.username | ||
resp = admin_client.get( | ||
path=f"/djangoadmin/repository/asyncpackagesubmission/?q={username}", | ||
HTTP_HOST=settings.PRIMARY_HOST, | ||
) | ||
assert resp.status_code == 200 | ||
|
||
|
||
@pytest.mark.django_db | ||
def test_admin_asyncpackagesubmission_list(admin_client: Client) -> None: | ||
AsyncPackageSubmissionFactory() | ||
resp = admin_client.get( | ||
path="/djangoadmin/repository/asyncpackagesubmission/", | ||
HTTP_HOST=settings.PRIMARY_HOST, | ||
) | ||
assert resp.status_code == 200 | ||
|
||
|
||
@pytest.mark.django_db | ||
def test_admin_asyncpackagesubmission_detail(admin_client: Client) -> None: | ||
pk = AsyncPackageSubmissionFactory().pk | ||
path = f"/djangoadmin/repository/asyncpackagesubmission/{pk}/change/" | ||
resp = admin_client.get( | ||
path=path, | ||
HTTP_HOST=settings.PRIMARY_HOST, | ||
) | ||
assert resp.status_code == 200 |
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,10 +1,10 @@ | ||
from .async_submission import * | ||
from .cache import * | ||
from .discord_bot import * | ||
from .namespace import * | ||
from .package import * | ||
from .package_download import * | ||
from .package_rating import * | ||
from .package_version import * | ||
from .submission import * | ||
from .team import * | ||
from .wiki import * |
File renamed without changes.
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
27 changes: 27 additions & 0 deletions
27
django/thunderstore/usermedia/migrations/0003_usermedia_owner_set_null.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,27 @@ | ||
# Generated by Django 3.1.7 on 2024-01-04 15:48 | ||
|
||
import django.db.models.deletion | ||
from django.conf import settings | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
("usermedia", "0002_add_cleanup_schedule"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="usermedia", | ||
name="owner", | ||
field=models.ForeignKey( | ||
blank=True, | ||
null=True, | ||
on_delete=django.db.models.deletion.SET_NULL, | ||
related_name="usermedia", | ||
to=settings.AUTH_USER_MODEL, | ||
), | ||
), | ||
] |
18 changes: 18 additions & 0 deletions
18
django/thunderstore/usermedia/migrations/0004_usermedia_size_bigint.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 3.1.7 on 2024-01-04 15:59 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("usermedia", "0003_usermedia_owner_set_null"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="usermedia", | ||
name="size", | ||
field=models.PositiveBigIntegerField(), | ||
), | ||
] |
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
Submodule python-packages
updated
from f31e69 to 5de258