Commit cca547e3 authored by okhin's avatar okhin

Adding a n importer applications

parent c0875b09
from django.contrib import admin
from picampaign.importer.models import Importer
class ImporteractAdmin(admin.ModelAdmin):
list_display = ['name', 'kind', 'data_format', 'file', 'url']
admin.site.register(Importer, ImporterAdmin)
from django.db import models
from django.utils.translation import ugettext_lazy as _
class Importer(models.Model):
"""Importer model. Used to populate campaign with contacts"""
id = models.AutoField(primary_key=True)
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')])
file = models.FileField(upload_to='imports/', blank=True, null=True)
url = models.URLField(blank=True, null=True)
campaign = models.ForeignKey('Campaign', on_delete=models.SET_NULL)
def __str__(self):
return _(u'%{name}: %{format} %{type} importer' % {'format': self.data_format,
'type': self.kind,
'name': self.name})
......@@ -42,6 +42,7 @@ INSTALLED_APPS = (
'picampaign.campaign',
'picampaign.organization',
'picampaign.feedback',
'picampaign.importer',
)
MIDDLEWARE_CLASSES = (
......
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