Show More
@@ -0,0 +1,24 b'' | |||||
|
1 | # -*- coding: utf-8 -*- | |||
|
2 | from __future__ import unicode_literals | |||
|
3 | ||||
|
4 | from django.db import models, migrations | |||
|
5 | ||||
|
6 | ||||
|
7 | class Migration(migrations.Migration): | |||
|
8 | ||||
|
9 | dependencies = [ | |||
|
10 | ('boards', '0020_merge'), | |||
|
11 | ] | |||
|
12 | ||||
|
13 | operations = [ | |||
|
14 | migrations.RemoveField( | |||
|
15 | model_name='post', | |||
|
16 | name='signature', | |||
|
17 | ), | |||
|
18 | migrations.AddField( | |||
|
19 | model_name='signature', | |||
|
20 | name='global_id', | |||
|
21 | field=models.ForeignKey(default=0, to='boards.GlobalId'), | |||
|
22 | preserve_default=False, | |||
|
23 | ), | |||
|
24 | ] |
@@ -101,9 +101,6 b' class Post(models.Model, Viewable):' | |||||
101 | # server, this indicates the server. |
|
101 | # server, this indicates the server. | |
102 | global_id = models.OneToOneField('GlobalId', null=True, blank=True) |
|
102 | global_id = models.OneToOneField('GlobalId', null=True, blank=True) | |
103 |
|
103 | |||
104 | # One post can be signed by many nodes that give their trust to it |
|
|||
105 | signature = models.ManyToManyField('Signature', null=True, blank=True) |
|
|||
106 |
|
||||
107 | def __str__(self): |
|
104 | def __str__(self): | |
108 | return 'P#{}/{}'.format(self.id, self.title) |
|
105 | return 'P#{}/{}'.format(self.id, self.title) | |
109 |
|
106 | |||
@@ -216,7 +213,6 b' class Post(models.Model, Viewable):' | |||||
216 | if image_refs_count == 1: |
|
213 | if image_refs_count == 1: | |
217 | image.delete() |
|
214 | image.delete() | |
218 |
|
215 | |||
219 | self.signature.all().delete() |
|
|||
220 | if self.global_id: |
|
216 | if self.global_id: | |
221 | self.global_id.delete() |
|
217 | self.global_id.delete() | |
222 |
|
218 |
@@ -74,7 +74,7 b' class SyncManager:' | |||||
74 | pub_time.text = str(post.get_pub_time_str()) |
|
74 | pub_time.text = str(post.get_pub_time_str()) | |
75 |
|
75 | |||
76 | signatures_tag = et.SubElement(model, TAG_SIGNATURES) |
|
76 | signatures_tag = et.SubElement(model, TAG_SIGNATURES) | |
77 | post_signatures = post.signature.all() |
|
77 | post_signatures = post.global_id.signature_set.all() | |
78 | if post_signatures: |
|
78 | if post_signatures: | |
79 | signatures = post_signatures |
|
79 | signatures = post_signatures | |
80 | # TODO Adding signature to a post is not yet added. For now this |
|
80 | # TODO Adding signature to a post is not yet added. For now this |
@@ -117,3 +117,5 b' class Signature(models.Model):' | |||||
117 | key_type = models.TextField() |
|
117 | key_type = models.TextField() | |
118 | key = models.TextField() |
|
118 | key = models.TextField() | |
119 | signature = models.TextField() |
|
119 | signature = models.TextField() | |
|
120 | ||||
|
121 | global_id = models.ForeignKey('GlobalId') |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now