-
Notifications
You must be signed in to change notification settings - Fork 49
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 #24 from rdmorganiser/import_export
Import export
- Loading branch information
Showing
181 changed files
with
7,627 additions
and
4,177 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,5 +1,10 @@ | ||
from django.contrib import admin | ||
|
||
from .models import * | ||
from .models import Condition | ||
|
||
admin.site.register(Condition) | ||
|
||
class ConditionAdmin(admin.ModelAdmin): | ||
readonly_fields = ('uri', ) | ||
|
||
|
||
admin.site.register(Condition, ConditionAdmin) |
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,30 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.9 on 2017-01-25 13:48 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('conditions', '0009_options'), | ||
('options', '0006_refactoring'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterModelOptions( | ||
name='condition', | ||
options={'ordering': ('key',), 'verbose_name': 'Condition', 'verbose_name_plural': 'Conditions'}, | ||
), | ||
migrations.RenameField( | ||
model_name='condition', | ||
old_name='description', | ||
new_name='comment', | ||
), | ||
migrations.RenameField( | ||
model_name='condition', | ||
old_name='title', | ||
new_name='key', | ||
), | ||
] |
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,60 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.9 on 2017-01-25 13:56 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('conditions', '0010_refactoring'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterModelOptions( | ||
name='condition', | ||
options={'ordering': ('uri',), 'verbose_name': 'Condition', 'verbose_name_plural': 'Conditions'}, | ||
), | ||
migrations.AddField( | ||
model_name='condition', | ||
name='uri', | ||
field=models.URLField(blank=True, help_text='The Uniform Resource Identifier of this option set (auto-generated).', max_length=640, null=True, verbose_name='URI'), | ||
), | ||
migrations.AddField( | ||
model_name='condition', | ||
name='uri_prefix', | ||
field=models.URLField(blank=True, help_text='The prefix for the URI of this condition.', max_length=256, null=True, verbose_name='URI Prefix'), | ||
), | ||
migrations.AlterField( | ||
model_name='condition', | ||
name='comment', | ||
field=models.TextField(blank=True, help_text='Additional information about this condition.', null=True, verbose_name='Comment'), | ||
), | ||
migrations.AlterField( | ||
model_name='condition', | ||
name='key', | ||
field=models.SlugField(blank=True, help_text='The internal identifier of this condition. The URI will be generated from this key.', max_length=128, null=True, verbose_name='Key'), | ||
), | ||
migrations.AlterField( | ||
model_name='condition', | ||
name='relation', | ||
field=models.CharField(choices=[('eq', 'is equal to (==)'), ('neq', 'is not equal to (!=)'), ('contains', 'contains'), ('gt', 'is greater than (>)'), ('gte', 'is greater than or equal (>=)'), ('lt', 'is lesser than (<)'), ('lte', 'is lesser than or equal (<=)'), ('empty', 'is empty'), ('notempty', 'is not empty')], help_text='Relation this condition is using.', max_length=8, verbose_name='Relation'), | ||
), | ||
migrations.AlterField( | ||
model_name='condition', | ||
name='source', | ||
field=models.ForeignKey(blank=True, db_constraint=False, help_text='Attribute this condition is evaluating.', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='domain.Attribute', verbose_name='Source'), | ||
), | ||
migrations.AlterField( | ||
model_name='condition', | ||
name='target_option', | ||
field=models.ForeignKey(blank=True, db_constraint=False, help_text='Option this condition is checking against.', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='options.Option', verbose_name='Target (Option)'), | ||
), | ||
migrations.AlterField( | ||
model_name='condition', | ||
name='target_text', | ||
field=models.CharField(blank=True, help_text='Raw text value this condition is checking against.', max_length=256, null=True, verbose_name='Target (Text)'), | ||
), | ||
] |
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,24 @@ | ||
from apps.core.renderers import BaseXMLRenderer | ||
|
||
|
||
class XMLRenderer(BaseXMLRenderer): | ||
|
||
def render_document(self, xml, conditions): | ||
xml.startElement('conditions', { | ||
'xmlns:dc': "http://purl.org/dc/elements/1.1/" | ||
}) | ||
|
||
for condition in conditions: | ||
self.render_condition(xml, condition) | ||
|
||
xml.endElement('conditions') | ||
|
||
def render_condition(self, xml, condition): | ||
xml.startElement('condition', {}) | ||
self.render_text_element(xml, 'dc:uri', {}, condition["uri"]) | ||
self.render_text_element(xml, 'dc:comment', {}, condition["comment"]) | ||
self.render_text_element(xml, 'source', {'dc:uri': condition["source"]}, None) | ||
self.render_text_element(xml, 'relation', {}, condition["relation"]) | ||
self.render_text_element(xml, 'target_text', {}, condition["target_text"]) | ||
self.render_text_element(xml, 'target_option', {'dc:uri': condition["target_option"]}, None) | ||
xml.endElement('condition') |
Oops, something went wrong.