Skip to content

Commit

Permalink
fix: assorted fixes
Browse files Browse the repository at this point in the history
Fix the following:
1. Improper configuration for crispy forms library leading to errors during login.
2. Allow `ExtracMetadata` and ` UploadMetadata` instances to be deletable.
3. Add an extra column on `SqlUploadMetadataAdmin` allowing uploads to be filtered by their associated `ExtractMetadata` instance.
  • Loading branch information
kennedykori committed Apr 3, 2023
1 parent ee237b9 commit a2f6e51
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 8 deletions.
6 changes: 2 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
exclude: "docs|node_modules|migrations|.git|.tox"
# default_language_version:
# python: python3.11
default_stages: [commit]
# fail_fast: true
exclude: "docs|node_modules|migrations|.git|.tox"

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
Expand Down
1 change: 1 addition & 0 deletions apps/sql_data/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class SQLUploadMetadataAdmin(AuditBaseModelAdmin):
list_display = (
"name",
"data_source_name",
"extract_metadata",
"chunks_count",
"start_time",
"finish_time",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Generated by Django 4.2 on 2023-04-03 11:38

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):
dependencies = [
("sql_data", "0003_remove_sqluploadchunk_finish_time_and_more"),
]

operations = [
migrations.AlterField(
model_name="sqluploadchunk",
name="upload_metadata",
field=models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="upload_chunks",
to="sql_data.sqluploadmetadata",
),
),
migrations.AlterField(
model_name="sqluploadmetadata",
name="extract_metadata",
field=models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="uploads",
to="sql_data.sqlextractmetadata",
),
),
]
4 changes: 2 additions & 2 deletions apps/sql_data/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class SQLUploadChunk(AbstractUploadChunk):

upload_metadata = models.ForeignKey(
"SQLUploadMetadata",
on_delete=models.PROTECT,
on_delete=models.CASCADE,
related_name="upload_chunks",
)
chunk_content = models.FileField(
Expand Down Expand Up @@ -143,7 +143,7 @@ class UploadContentTypes(models.TextChoices):
PARQUET = "application/vnd.apache-parquet", _("Parquet")

extract_metadata = models.ForeignKey(
SQLExtractMetadata, on_delete=models.PROTECT, related_name="uploads"
SQLExtractMetadata, on_delete=models.CASCADE, related_name="uploads"
)
content_type = models.CharField(
max_length=100, choices=UploadContentTypes.choices
Expand Down
4 changes: 2 additions & 2 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,9 @@
# CRISPY FORMS
###############################################################################

CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap4"
CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap5"

CRISPY_TEMPLATE_PACK = "bootstrap4"
CRISPY_TEMPLATE_PACK = "bootstrap5"


###############################################################################
Expand Down

0 comments on commit a2f6e51

Please sign in to comment.