Commit 98a9f0cf authored by okhin's avatar okhin

Kind change is file or url is not null. If both aren't null it's a file.

parent a0a062be
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-08-07 14:03
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('campaign', '0002_auto_20150116_1546'),
]
operations = [
migrations.AlterField(
model_name='argumentary',
name='lang',
field=models.CharField(max_length=5, verbose_name='language'),
),
migrations.AlterField(
model_name='campaign',
name='default_lang',
field=models.CharField(choices=[('en', 'English'), ('de', 'German'), ('fr', 'French')], max_length=5, verbose_name='language'),
),
]
...@@ -22,8 +22,7 @@ class Campaign(models.Model): ...@@ -22,8 +22,7 @@ class Campaign(models.Model):
verbose_name=_('language')) verbose_name=_('language'))
def __str__(self): def __str__(self):
return self.title.decode('utf-8') return self.title
class Argumentary(models.Model): class Argumentary(models.Model):
"""Argumentary in a given language for a campaign""" """Argumentary in a given language for a campaign"""
......
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-08-07 14:03
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('contact', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='contact',
name='photo',
field=models.ImageField(blank=True, upload_to='contacts/photos'),
),
]
...@@ -7,13 +7,20 @@ class Importer(models.Model): ...@@ -7,13 +7,20 @@ class Importer(models.Model):
"""Importer model. Used to populate campaign with contacts""" """Importer model. Used to populate campaign with contacts"""
id = models.AutoField(primary_key=True) id = models.AutoField(primary_key=True)
name = models.CharField(max_length=64) name = models.CharField(max_length=64)
kind = models.CharField(max_length=4, choices=[('FILE', _("File"))])
data_format = models.CharField(max_length=4, choices=[('JSON', 'json'), ('CSV', 'csv')]) data_format = models.CharField(max_length=4, choices=[('JSON', 'json'), ('CSV', 'csv')])
file = models.FileField(upload_to='imports/', blank=True, null=True) file = models.FileField(upload_to='imports/', blank=True, null=True)
url = models.URLField(blank=True, null=True) url = models.URLField(blank=True, null=True)
campaign = models.ForeignKey(Campaign, on_delete=models.SET_NULL, null=True) campaign = models.ForeignKey(Campaign, on_delete=models.SET_NULL, null=True)
def __str__(self): def __str__(self):
return _(u'%{name}: %{format} %{type} importer' % {'format': self.data_format, return _('%{name}: %{format} %{type} importer' % {'format': self.data_format,
'type': self.kind, 'type': self.kind(),
'name': self.name}) 'name': self.name})
def kind(self):
if self.url is None and self.file is None:
return None
if self.url is None:
return 'file'
else:
return 'url'
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-08-07 14:03
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('organization', '0002_remove_group_organization'),
]
operations = [
migrations.AlterField(
model_name='group',
name='contacts',
field=models.ManyToManyField(blank=True, related_name='groups', to='contact.Contact'),
),
migrations.AlterField(
model_name='organization',
name='users',
field=models.ManyToManyField(blank=True, related_name='organizations', to=settings.AUTH_USER_MODEL),
),
]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment