-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #174 from Ecotrust/bulk
- Loading branch information
Showing
17 changed files
with
411 additions
and
5 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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from django import forms | ||
from .models import MediaBulkUpload, Media, Places, Resources, Citations, ResourcesActivityEvents, PlacesResourceMediaEvents | ||
from .widgets import ThumbnailFileInput | ||
|
||
class MultipleFileInput(forms.ClearableFileInput): | ||
allow_multiple_selected = True | ||
|
||
class MultipleFileField(forms.FileField): | ||
def __init__(self, *args, **kwargs): | ||
kwargs.setdefault("widget", MultipleFileInput()) | ||
super().__init__(*args, **kwargs) | ||
|
||
def clean(self, data, initial=None): | ||
single_file_clean = super().clean | ||
if isinstance(data, (list, tuple)): | ||
result = [single_file_clean(d, initial) for d in data] | ||
else: | ||
result = [single_file_clean(data, initial)] | ||
return result | ||
|
||
# class MultipleFileField(forms.FileField): | ||
# widget = ThumbnailFileInput | ||
|
||
class MediaBulkUploadForm(forms.ModelForm): | ||
files = MultipleFileField() | ||
mediabulkdate = forms.DateField(widget=forms.SelectDateWidget) | ||
places = forms.ModelMultipleChoiceField(queryset=Places.objects.all(), required=False) | ||
resources = forms.ModelMultipleChoiceField(queryset=Resources.objects.all(), required=False) | ||
citations = forms.ModelMultipleChoiceField(queryset=Citations.objects.all(), required=False) | ||
activities = forms.ModelMultipleChoiceField(queryset=ResourcesActivityEvents.objects.all(), required=False) | ||
placeresources = forms.ModelMultipleChoiceField(queryset=PlacesResourceMediaEvents.objects.all(), required=False) | ||
|
||
class Meta: | ||
model = MediaBulkUpload | ||
fields = ['mediabulkname', 'mediabulkdescription', 'files', 'mediabulkdate', 'places', 'resources', 'citations', 'activities', 'placeresources'] |
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,32 @@ | ||
# Generated by Django 3.2.25 on 2024-10-04 22:47 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('Lookup', '0005_alter_lookupuserinfo_id'), | ||
('TEKDB', '0012_auto_20240926_1440'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='MediaBulkUpload', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('name', models.CharField(blank=True, max_length=255, null=True)), | ||
('description', models.TextField(blank=True, null=True)), | ||
('date', models.DateField(blank=True, default=None, null=True)), | ||
('created_at', models.DateTimeField(auto_now_add=True, null=True)), | ||
('updated_at', models.DateTimeField(auto_now=True, null=True)), | ||
('user', models.ForeignKey(blank=True, db_column='user', default=None, null=True, on_delete=django.db.models.deletion.SET_DEFAULT, to='Lookup.lookupuserinfo', verbose_name='user')), | ||
], | ||
), | ||
migrations.AddField( | ||
model_name='media', | ||
name='mediauploadevent', | ||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='mediabulkupload', to='TEKDB.mediabulkupload'), | ||
), | ||
] |
19 changes: 19 additions & 0 deletions
19
TEKDB/TEKDB/migrations/0014_alter_media_mediauploadevent.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,19 @@ | ||
# Generated by Django 3.2.25 on 2024-10-04 22:55 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('TEKDB', '0013_auto_20241004_1547'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='media', | ||
name='mediauploadevent', | ||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='mediauploadevent', to='TEKDB.mediabulkupload'), | ||
), | ||
] |
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,23 @@ | ||
# Generated by Django 3.2.25 on 2024-10-04 22:59 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('TEKDB', '0014_alter_media_mediauploadevent'), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name='media', | ||
name='mediauploadevent', | ||
), | ||
migrations.AddField( | ||
model_name='media', | ||
name='mediabulkupload', | ||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='mediabulkupload', to='TEKDB.mediabulkupload'), | ||
), | ||
] |
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,71 @@ | ||
# Generated by Django 3.2.25 on 2024-10-16 22:49 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('TEKDB', '0015_auto_20241004_1559'), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name='mediabulkupload', | ||
name='created_at', | ||
), | ||
migrations.RemoveField( | ||
model_name='mediabulkupload', | ||
name='updated_at', | ||
), | ||
migrations.AddField( | ||
model_name='mediabulkupload', | ||
name='enteredbydate', | ||
field=models.DateTimeField(auto_now_add=True, db_column='enteredbydate', null=True, verbose_name='entered by date'), | ||
), | ||
migrations.AddField( | ||
model_name='mediabulkupload', | ||
name='enteredbyname', | ||
field=models.CharField(blank=True, db_column='enteredbyname', max_length=25, null=True, verbose_name='entered by name'), | ||
), | ||
migrations.AddField( | ||
model_name='mediabulkupload', | ||
name='enteredbytitle', | ||
field=models.CharField(blank=True, db_column='enteredbytitle', max_length=100, null=True, verbose_name='entered by title'), | ||
), | ||
migrations.AddField( | ||
model_name='mediabulkupload', | ||
name='enteredbytribe', | ||
field=models.CharField(blank=True, db_column='enteredbytribe', max_length=100, null=True, verbose_name='entered by tribe'), | ||
), | ||
migrations.AddField( | ||
model_name='mediabulkupload', | ||
name='modifiedbydate', | ||
field=models.DateTimeField(auto_now=True, db_column='modifiedbydate', null=True, verbose_name='modified by date'), | ||
), | ||
migrations.AddField( | ||
model_name='mediabulkupload', | ||
name='modifiedbyname', | ||
field=models.CharField(blank=True, db_column='modifiedbyname', max_length=25, null=True, verbose_name='modified by name'), | ||
), | ||
migrations.AddField( | ||
model_name='mediabulkupload', | ||
name='modifiedbytitle', | ||
field=models.CharField(blank=True, db_column='modifiedbytitle', max_length=100, null=True, verbose_name='modified by title'), | ||
), | ||
migrations.AddField( | ||
model_name='mediabulkupload', | ||
name='modifiedbytribe', | ||
field=models.CharField(blank=True, db_column='modifiedbytribe', max_length=100, null=True, verbose_name='modified by tribe'), | ||
), | ||
migrations.AddField( | ||
model_name='mediabulkupload', | ||
name='needsReview', | ||
field=models.BooleanField(db_column='needsreview', default=True, verbose_name='Needs Review'), | ||
), | ||
migrations.AddField( | ||
model_name='mediabulkupload', | ||
name='researchComments', | ||
field=models.TextField(blank=True, db_column='researchcomments', default=None, null=True, verbose_name='Research Comments'), | ||
), | ||
] |
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,32 @@ | ||
# Generated by Django 3.2.25 on 2024-10-16 22:52 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('TEKDB', '0016_auto_20241016_1549'), | ||
] | ||
|
||
operations = [ | ||
migrations.RenameField( | ||
model_name='mediabulkupload', | ||
old_name='date', | ||
new_name='mediabulkdate', | ||
), | ||
migrations.RenameField( | ||
model_name='mediabulkupload', | ||
old_name='description', | ||
new_name='mediabulkdescription', | ||
), | ||
migrations.RenameField( | ||
model_name='mediabulkupload', | ||
old_name='name', | ||
new_name='mediabulkname', | ||
), | ||
migrations.RemoveField( | ||
model_name='mediabulkupload', | ||
name='user', | ||
), | ||
] |
Oops, something went wrong.