Skip to content

Commit

Permalink
Formulaire média: style
Browse files Browse the repository at this point in the history
  • Loading branch information
amandine-sahl committed Aug 28, 2024
1 parent bbed1b4 commit f33140e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
17 changes: 15 additions & 2 deletions apptax/admin/admin_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,16 +257,29 @@ def import_cd_nom_view(self, *args, **kwargs):


class InlineMediaForm(InlineFormAdmin):
form_label = "Médias"
form_label = "Média"
form_extra_fields = {
"chemin": ImageUploadFieldWithoutDelete(
label="Image",
label="Téléverser un fichier",
namegen=taxref_media_file_name,
endpoint="media_taxhub",
base_path=Path(current_app.config["MEDIA_FOLDER"], "taxhub").absolute(),
)
}

form_columns = (
"types",
"url",
"chemin",
"titre",
"auteur",
"desc_media",
"source",
"licence",
"is_public",
)
column_labels = {"is_public": "Média public ?", "types": "Type", "desc_media": "Description"}

def __init__(self):
return super(InlineMediaForm, self).__init__(TMedias)

Expand Down
2 changes: 1 addition & 1 deletion apptax/taxonomie/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ class TMedias(db.Model):
desc_media = db.Column(db.Text)
source = db.Column(db.Unicode)
licence = db.Column(db.Unicode)
is_public = db.Column(db.BOOLEAN)
is_public = db.Column(db.BOOLEAN, nullable=False, default=True)
id_type = db.Column(
db.Integer,
ForeignKey(BibTypesMedia.id_type),
Expand Down

0 comments on commit f33140e

Please sign in to comment.