Show More
@@ -0,0 +1,20 b'' | |||||
|
1 | # -*- coding: utf-8 -*- | |||
|
2 | # Generated by Django 1.9.5 on 2016-05-04 15:36 | |||
|
3 | from __future__ import unicode_literals | |||
|
4 | ||||
|
5 | from django.db import migrations, models | |||
|
6 | ||||
|
7 | ||||
|
8 | class Migration(migrations.Migration): | |||
|
9 | ||||
|
10 | dependencies = [ | |||
|
11 | ('boards', '0043_merge'), | |||
|
12 | ] | |||
|
13 | ||||
|
14 | operations = [ | |||
|
15 | migrations.AddField( | |||
|
16 | model_name='globalid', | |||
|
17 | name='content', | |||
|
18 | field=models.TextField(blank=True, null=True), | |||
|
19 | ), | |||
|
20 | ] |
@@ -55,6 +55,7 b' class SyncManager:' | |||||
55 |
|
55 | |||
56 | models = et.SubElement(response, TAG_MODELS) |
|
56 | models = et.SubElement(response, TAG_MODELS) | |
57 |
|
57 | |||
|
58 | # TODO Put global id's content into XML instad of manual serialization | |||
58 | for post in model_list: |
|
59 | for post in model_list: | |
59 | model = et.SubElement(models, TAG_MODEL) |
|
60 | model = et.SubElement(models, TAG_MODEL) | |
60 | model.set(ATTR_NAME, 'post') |
|
61 | model.set(ATTR_NAME, 'post') | |
@@ -139,6 +140,8 b' class SyncManager:' | |||||
139 | if exists: |
|
140 | if exists: | |
140 | print('Post with same ID already exists') |
|
141 | print('Post with same ID already exists') | |
141 | else: |
|
142 | else: | |
|
143 | global_id.content = et.to_string(tag_content, | |||
|
144 | ENCODING_UNICODE) | |||
142 | global_id.save() |
|
145 | global_id.save() | |
143 | for signature in signatures: |
|
146 | for signature in signatures: | |
144 | signature.global_id = global_id |
|
147 | signature.global_id = global_id |
@@ -80,6 +80,7 b' class GlobalId(models.Model):' | |||||
80 | key = models.TextField() |
|
80 | key = models.TextField() | |
81 | key_type = models.TextField() |
|
81 | key_type = models.TextField() | |
82 | local_id = models.IntegerField() |
|
82 | local_id = models.IntegerField() | |
|
83 | content = models.TextField(blank=True, null=True) | |||
83 |
|
84 | |||
84 | def __str__(self): |
|
85 | def __str__(self): | |
85 | return '%s::%s::%d' % (self.key_type, self.key, self.local_id) |
|
86 | return '%s::%s::%d' % (self.key_type, self.key, self.local_id) |
General Comments 0
You need to be logged in to leave comments.
Login now