-
Notifications
You must be signed in to change notification settings - Fork 725
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support SVG for product and topic images (#5430)
- Loading branch information
Showing
7 changed files
with
278 additions
and
7 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
kitsune/products/migrations/0006_alter_product_and_topic_images.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,42 @@ | ||
# Generated by Django 4.1.7 on 2023-03-31 16:04 | ||
|
||
from django.db import migrations | ||
import kitsune.sumo.fields | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("products", "0001_squashed_0005_auto_20200629_0826"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="product", | ||
name="image", | ||
field=kitsune.sumo.fields.ImagePlusField( | ||
blank=True, | ||
help_text="Used on the the home page. Must be 484x244.", | ||
max_length=250, | ||
null=True, | ||
upload_to="uploads/products/", | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="product", | ||
name="image_alternate", | ||
field=kitsune.sumo.fields.ImagePlusField( | ||
blank=True, | ||
help_text="Used everywhere except the home page. Must be 96x96.", | ||
max_length=250, | ||
null=True, | ||
upload_to="uploads/products/", | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="topic", | ||
name="image", | ||
field=kitsune.sumo.fields.ImagePlusField( | ||
blank=True, max_length=250, null=True, upload_to="uploads/topics/" | ||
), | ||
), | ||
] |
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,17 @@ | ||
from django.db import models | ||
|
||
from kitsune.sumo import form_fields | ||
|
||
|
||
class ImagePlusField(models.ImageField): | ||
""" | ||
Same as models.ImageField but with support for SVG images as well. | ||
""" | ||
|
||
def formfield(self, **kwargs): | ||
return super().formfield( | ||
**{ | ||
"form_class": form_fields.ImagePlusField, | ||
**kwargs, | ||
} | ||
) |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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