forked from City-of-Helsinki/linkedevents
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow images to be posted with an api_key as well
* Add tests for most common api key image cases * Add data source field to image * Refactor image permission validation to take place in LinkedEventsSerializer
- Loading branch information
Showing
5 changed files
with
229 additions
and
77 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
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,31 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.9.11 on 2016-11-28 14:24 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
|
||
def forwards_func(apps, schema_editor): | ||
Image = apps.get_model('events', 'Image') | ||
|
||
for image in Image.objects.filter(event__isnull=False).distinct(): | ||
image.data_source = image.event_set.all()[0].data_source | ||
image.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('events', '0032_add_super_event_type'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='image', | ||
name='data_source', | ||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='provided_image_data', to='events.DataSource'), | ||
), | ||
migrations.RunPython(forwards_func, migrations.RunPython.noop), | ||
] |
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
Oops, something went wrong.