-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactoring
- Loading branch information
Showing
79 changed files
with
885 additions
and
432 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 |
---|---|---|
|
@@ -41,7 +41,7 @@ runs: | |
shell: bash | ||
# Install and configure Poetry. | ||
- name: Install and configure Poetry | ||
uses: snok/[email protected].4 | ||
uses: snok/[email protected].6 | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
|
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 |
---|---|---|
|
@@ -106,7 +106,7 @@ jobs: | |
shell: bash | ||
# Install and configure Poetry. | ||
- name: Install and configure Poetry | ||
uses: snok/[email protected].4 | ||
uses: snok/[email protected].6 | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
|
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 |
---|---|---|
|
@@ -103,7 +103,7 @@ jobs: | |
shell: bash | ||
# Install and configure Poetry. | ||
- name: Install and configure Poetry | ||
uses: snok/[email protected].4 | ||
uses: snok/[email protected].6 | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
|
@@ -202,7 +202,7 @@ jobs: | |
shell: bash | ||
# Install and configure Poetry. | ||
- name: Install and configure Poetry | ||
uses: snok/[email protected].4 | ||
uses: snok/[email protected].6 | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
|
@@ -282,7 +282,7 @@ jobs: | |
shell: bash | ||
# Install and configure Poetry. | ||
- name: Install and configure Poetry | ||
uses: snok/[email protected].4 | ||
uses: snok/[email protected].6 | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
|
@@ -357,7 +357,7 @@ jobs: | |
shell: bash | ||
# Install and configure Poetry. | ||
- name: Install and configure Poetry | ||
uses: snok/[email protected].4 | ||
uses: snok/[email protected].6 | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
|
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 |
---|---|---|
|
@@ -68,7 +68,7 @@ jobs: | |
shell: bash | ||
# Install and configure Poetry. | ||
- name: Install and configure Poetry | ||
uses: snok/[email protected].4 | ||
uses: snok/[email protected].6 | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
|
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,11 @@ | ||
{ | ||
"source_directories": [ | ||
"." | ||
], | ||
"exclude": [ | ||
".*\/node_modules\/.*", | ||
".*\/.venv\/.*", | ||
".*\/.cache\/.*" | ||
], | ||
"taint_models_path": ".venv/lib" | ||
} |
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
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 @@ | ||
{} |
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,9 +1,4 @@ | ||
"""Admin app for ModularHistory.""" | ||
|
||
from .inlines import ( | ||
GenericStackedInline, | ||
GenericTabularInline, | ||
StackedInline, | ||
TabularInline, | ||
) | ||
from .inlines import StackedInline, TabularInline | ||
from .model_admin import ModelAdmin, admin_site |
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,63 +1,28 @@ | ||
from typing import TYPE_CHECKING, List, Optional | ||
from typing import TYPE_CHECKING | ||
|
||
from nested_admin.nested import ( | ||
NestedGenericStackedInline, | ||
NestedGenericTabularInline, | ||
NestedStackedInline, | ||
NestedTabularInline, | ||
) | ||
# from django.contrib.admin import StackedInline as BaseStackedInline | ||
# from django.contrib.admin import TabularInline as BaseTabularInline | ||
from nested_admin.nested import NestedStackedInline, NestedTabularInline | ||
|
||
from apps.admin.model_admin import FORM_FIELD_OVERRIDES | ||
|
||
if TYPE_CHECKING: | ||
from core.models.model import Model | ||
|
||
|
||
class GenericTabularInline(NestedGenericTabularInline): | ||
"""Tabular inline admin for generically related objects.""" | ||
|
||
formfield_overrides = FORM_FIELD_OVERRIDES | ||
|
||
|
||
class GenericStackedInline(NestedGenericStackedInline): | ||
"""Stacked inline admin for generically related objects.""" | ||
|
||
formfield_overrides = FORM_FIELD_OVERRIDES | ||
|
||
|
||
class StackedInline(NestedStackedInline): | ||
"""Inline admin with fields stacked vertically.""" | ||
|
||
formfield_overrides = FORM_FIELD_OVERRIDES | ||
|
||
def get_fields(self, request, model_instance=None) -> List[str]: | ||
"""Return reordered fields to be displayed in the admin.""" | ||
fields = super().get_fields(request, model_instance) | ||
return reorder_fields(fields) | ||
|
||
|
||
class TabularInline(NestedTabularInline): | ||
"""Inline admin with fields laid out horizontally.""" | ||
|
||
formfield_overrides = FORM_FIELD_OVERRIDES | ||
|
||
def get_extra(self, request, model_instance: Optional['Model'] = None, **kwargs): | ||
def get_extra(self, request, *args, **kwargs): | ||
"""Return the number of extra/blank rows to display.""" | ||
if len(self.get_queryset(request)): | ||
return 0 | ||
return 1 | ||
|
||
def get_fields(self, request, model_instance=None) -> List[str]: | ||
"""Return reordered fields to be displayed in the admin.""" | ||
fields = super().get_fields(request, model_instance) | ||
return reorder_fields(fields) | ||
|
||
|
||
def reorder_fields(fields) -> List[str]: | ||
"""Return a reordered list of fields to display in the admin.""" | ||
ordered_fields = ('page_number', 'end_page_number', 'notes', 'position') | ||
for field_name in ordered_fields: | ||
if field_name in fields: | ||
fields.remove(field_name) | ||
fields.append(field_name) | ||
return fields |
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
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,29 @@ | ||
# Generated by Django 3.1.11 on 2021-05-24 01:13 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('entities', '0003_auto_20210521_1334'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='entityimage', | ||
name='position', | ||
field=models.PositiveSmallIntegerField(blank=True, default=0, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='entity', | ||
name='title', | ||
field=models.CharField( | ||
blank=True, | ||
help_text='The title can be used for the detail page header and title tag, SERP result card header, etc. It should be a noun phrase!', | ||
max_length=120, | ||
null=True, | ||
verbose_name='title', | ||
), | ||
), | ||
] |
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,24 @@ | ||
# Generated by Django 3.1.11 on 2021-05-24 01:13 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('images', '0002_auto_20210522_1558'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='image', | ||
name='title', | ||
field=models.CharField( | ||
blank=True, | ||
help_text='The title can be used for the detail page header and title tag, SERP result card header, etc. It should be a noun phrase!', | ||
max_length=120, | ||
null=True, | ||
verbose_name='title', | ||
), | ||
), | ||
] |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.