From 34d456a85b20678618b51ad20a872415403a5914 Mon Sep 17 00:00:00 2001
From: Jarmil <jarmil.halamicek@seznam.cz>
Date: Wed, 4 Nov 2020 10:55:13 +0100
Subject: [PATCH] REF: mswebs: prejmenovano pirate_id

---
 shared/migrations/0013_auto_20201104_1053.py | 16 ++++++++++++++++
 shared/models.py                             |  6 +++---
 2 files changed, 19 insertions(+), 3 deletions(-)
 create mode 100644 shared/migrations/0013_auto_20201104_1053.py

diff --git a/shared/migrations/0013_auto_20201104_1053.py b/shared/migrations/0013_auto_20201104_1053.py
new file mode 100644
index 00000000..92f5df8e
--- /dev/null
+++ b/shared/migrations/0013_auto_20201104_1053.py
@@ -0,0 +1,16 @@
+# Generated by Django 3.1.1 on 2020-11-04 09:53
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ("shared", "0012_article_date"),
+    ]
+
+    operations = [
+        migrations.RenameField(
+            model_name="personpage", old_name="pirate_id", new_name="username",
+        ),
+    ]
diff --git a/shared/models.py b/shared/models.py
index d5a27e15..316316f1 100644
--- a/shared/models.py
+++ b/shared/models.py
@@ -84,7 +84,7 @@ class PersonPage(SharedSubpageMixin, MetadataPageMixin, Page):
     """
 
     # ve formatu iapi: https://iapi.pirati.cz/v1/user?username=john.doe
-    pirate_id = models.TextField("Pirate ID osoby", blank=False)
+    username = models.TextField("Pirate ID osoby", blank=False)
     profile_id = models.IntegerField(
         "ÄŚĂ­slo medailonku (0..2) z lide.pirati.cz",
         blank=True,
@@ -95,7 +95,7 @@ class PersonPage(SharedSubpageMixin, MetadataPageMixin, Page):
     perex = models.TextField("Perex osoby", blank=True)
 
     content_panels = Page.content_panels + [
-        FieldPanel("pirate_id"),
+        FieldPanel("username"),
         FieldPanel("profile_id"),
         FieldPanel("perex"),
     ]
@@ -103,7 +103,7 @@ class PersonPage(SharedSubpageMixin, MetadataPageMixin, Page):
     def _iapi(self):
         """ Vrati data o osobe z piratskeho IAPI jako json. Cached via requests_cache """
         return requests.get(
-            "https://iapi.pirati.cz/v1/user?username=%s" % self.pirate_id
+            "https://iapi.pirati.cz/v1/user?username=%s" % self.username
         ).json()
 
     @property
-- 
GitLab