fix(MR-16): Use cache for FileField and ImageField (#17)

* Remove casting to list in _get_form_data

* Use cache for most fields and admin form for m2m files

* MR comments/clean up

* Cache should obey exclude and fields

* Some more tests and docs

* Only use cache for image files

* Even more tests and handle save as new

* fix test

* More tests

* minor refactor

* Improve test coverage

* Add no cover for some places

* V0.2.3.dev7

* Adding tests for fieldsets

* Added cache timeout

* Added another test for an edge case

* Fix issue with ManagementForm tampered with

* Update cache to only set when form is_multipart

* Even more testing changes

* Update based on comments on MR and clean up a bit

* make test names better

Co-authored-by: Thu Trang Pham <thu@joinmodernhealth.com>
This commit is contained in:
Thu Trang Pham
2021-02-27 15:39:01 -08:00
committed by GitHub
parent cc36492bfe
commit 06d3e1a208
31 changed files with 3017 additions and 116 deletions
@@ -0,0 +1,48 @@
# Generated by Django 3.1.6 on 2021-02-22 03:12
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('market', '0005_shoppingmall'),
]
operations = [
migrations.CreateModel(
name='GeneralManager',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=120)),
],
),
migrations.CreateModel(
name='Town',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=120)),
],
),
migrations.AddField(
model_name='item',
name='file',
field=models.FileField(blank=True, null=True, upload_to='tmp/files'),
),
migrations.AddField(
model_name='item',
name='image',
field=models.ImageField(blank=True, null=True, upload_to='tmp/items'),
),
migrations.AddField(
model_name='shoppingmall',
name='general_manager',
field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='market.generalmanager'),
),
migrations.AddField(
model_name='shoppingmall',
name='town',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='market.town'),
),
]
@@ -0,0 +1,18 @@
# Generated by Django 3.1.6 on 2021-02-24 01:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('market', '0006_auto_20210222_0312'),
]
operations = [
migrations.AddField(
model_name='generalmanager',
name='headshot',
field=models.ImageField(blank=True, null=True, upload_to='tmp/gm/headshots'),
),
]
@@ -0,0 +1,18 @@
# Generated by Django 3.1.6 on 2021-02-24 08:17
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('market', '0007_generalmanager_headshot'),
]
operations = [
migrations.AddField(
model_name='item',
name='description',
field=models.TextField(blank=True, null=True),
),
]