{"action":"created","comment":{"url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/pulls/comments/76982129","id":76982129,"diff_hunk":"@@ -0,0 +1,91 @@\n+# -*- coding: utf-8 -*-\n+from django.db import models\n+from django.utils.translation import ugettext_lazy as _\n+\n+from cms.models import CMSPlugin, Page, force_text\n+from easy_thumbnails.files import get_thumbnailer\n+from filer.fields.image import FilerImageField\n+\n+\n+class Carousel(CMSPlugin):\n+    \"\"\"\n+    Model for storing carousel meta data and configuration.\n+    \"\"\"\n+    name = models.CharField(\n+        verbose_name=_(\"name\"),\n+        max_length=160\n+    )\n+    interval = models.IntegerField(\n+        verbose_name=_(\"slide changing time\"),\n+        default=5000,\n+        help_text=_(\"Changing time for slides in milliseconds. 1000 ms = 1 s.\",)\n+    )\n+\n+    def __str__(self):\n+        return \"%s\" % self.name\n+\n+    def copy_relations(self, oldinstance):\n+        \"\"\"\n+        Make a copy of the related slides for the new carousel object.\n+        See docs: http://docs.django-cms.org/en/release-3.3.x/how_to/custom_plugins.html#for-foreign-key-relations-from-other-objects\n+        \"\"\"\n+        for slide in oldinstance.slides.all():\n+            slide.pk = None\n+            slide.carousel = self\n+            slide.save()\n+\n+\n+class Slide(models.Model):\n+    \"\"\"\n+    Model for storing carousel slide related data.\n+    \"\"\"\n+    carousel = models.ForeignKey(\n+        Carousel,\n+        verbose_name=_(\"carousel\"),\n+        related_name=\"slides\"\n+    )\n+    image = FilerImageField(\n+        verbose_name=_(\"slide image\")\n+    )\n+    caption = models.CharField(\n+        verbose_name=_(\"slide caption\"),\n+        max_length=160,\n+        blank=True\n+    )\n+    url = models.URLField(\n+        verbose_name=\"link to URL\",\n+        max_length=250,\n+        blank=True\n+    )\n+    linked_page = models.ForeignKey(\n+        Page,\n+        verbose_name=_(\"link to page\"),\n+        null=True,\n+        blank=True,\n+        help_text=_(\"Page link overrides given URL.\"),\n+        limit_choices_to={\"publisher_is_draft\": False},\n+        related_name=\"linking_slides\",","path":"cmsplugin_carousel_ai/models.py","position":67,"original_position":67,"commit_id":"97aae527b24e47dd9ce51a53bd54b03b1bd00eb4","original_commit_id":"97aae527b24e47dd9ce51a53bd54b03b1bd00eb4","user":{"login":"akx","id":58669,"avatar_url":"https://avatars.githubusercontent.com/u/58669?v=3","gravatar_id":"","url":"https://api.github.com/users/akx","html_url":"https://github.com/akx","followers_url":"https://api.github.com/users/akx/followers","following_url":"https://api.github.com/users/akx/following{/other_user}","gists_url":"https://api.github.com/users/akx/gists{/gist_id}","starred_url":"https://api.github.com/users/akx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akx/subscriptions","organizations_url":"https://api.github.com/users/akx/orgs","repos_url":"https://api.github.com/users/akx/repos","events_url":"https://api.github.com/users/akx/events{/privacy}","received_events_url":"https://api.github.com/users/akx/received_events","type":"User","site_admin":false},"body":"I'm not sure there's much point in this related_name? Or rather, what's the UC for finding pages that are linked to in slides? :)","created_at":"2016-08-31T12:59:16Z","updated_at":"2016-08-31T12:59:16Z","html_url":"https://github.com/andersinno/cmsplugin-carousel-ai/pull/3#discussion_r76982129","pull_request_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/pulls/comments/76982129"},"html":{"href":"https://github.com/andersinno/cmsplugin-carousel-ai/pull/3#discussion_r76982129"},"pull_request":{"href":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/pulls/3","id":83444291,"html_url":"https://github.com/andersinno/cmsplugin-carousel-ai/pull/3","diff_url":"https://github.com/andersinno/cmsplugin-carousel-ai/pull/3.diff","patch_url":"https://github.com/andersinno/cmsplugin-carousel-ai/pull/3.patch","issue_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/issues/3","number":3,"state":"open","locked":false,"title":"Initial carousel slider implementation","user":{"login":"JsseL","id":3500484,"avatar_url":"https://avatars.githubusercontent.com/u/3500484?v=3","gravatar_id":"","url":"https://api.github.com/users/JsseL","html_url":"https://github.com/JsseL","followers_url":"https://api.github.com/users/JsseL/followers","following_url":"https://api.github.com/users/JsseL/following{/other_user}","gists_url":"https://api.github.com/users/JsseL/gists{/gist_id}","starred_url":"https://api.github.com/users/JsseL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JsseL/subscriptions","organizations_url":"https://api.github.com/users/JsseL/orgs","repos_url":"https://api.github.com/users/JsseL/repos","events_url":"https://api.github.com/users/JsseL/events{/privacy}","received_events_url":"https://api.github.com/users/JsseL/received_events","type":"User","site_admin":false},"body":"Simplistic approach for defining a Carousel model with n related slides.","created_at":"2016-08-31T12:37:42Z","updated_at":"2016-08-31T12:59:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b30b00465d8faac70c45f5790bbda1a132c5fe9a","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/pulls/3/commits","review_comments_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/pulls/3/comments","review_comment_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/pulls/comments{/number}","comments_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/issues/3/comments","statuses_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/statuses/97aae527b24e47dd9ce51a53bd54b03b1bd00eb4","head":{"label":"andersinno:initial-implementation","ref":"initial-implementation","sha":"97aae527b24e47dd9ce51a53bd54b03b1bd00eb4","user":{"login":"andersinno","id":1138034,"avatar_url":"https://avatars.githubusercontent.com/u/1138034?v=3","gravatar_id":"","url":"https://api.github.com/users/andersinno","html_url":"https://github.com/andersinno","followers_url":"https://api.github.com/users/andersinno/followers","following_url":"https://api.github.com/users/andersinno/following{/other_user}","gists_url":"https://api.github.com/users/andersinno/gists{/gist_id}","starred_url":"https://api.github.com/users/andersinno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andersinno/subscriptions","organizations_url":"https://api.github.com/users/andersinno/orgs","repos_url":"https://api.github.com/users/andersinno/repos","events_url":"https://api.github.com/users/andersinno/events{/privacy}","received_events_url":"https://api.github.com/users/andersinno/received_events","type":"Organization","site_admin":false},"repo":{"id":66957774,"name":"cmsplugin-carousel-ai","full_name":"andersinno/cmsplugin-carousel-ai","owner":{"login":"andersinno","id":1138034,"avatar_url":"https://avatars.githubusercontent.com/u/1138034?v=3","gravatar_id":"","url":"https://api.github.com/users/andersinno","html_url":"https://github.com/andersinno","followers_url":"https://api.github.com/users/andersinno/followers","following_url":"https://api.github.com/users/andersinno/following{/other_user}","gists_url":"https://api.github.com/users/andersinno/gists{/gist_id}","starred_url":"https://api.github.com/users/andersinno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andersinno/subscriptions","organizations_url":"https://api.github.com/users/andersinno/orgs","repos_url":"https://api.github.com/users/andersinno/repos","events_url":"https://api.github.com/users/andersinno/events{/privacy}","received_events_url":"https://api.github.com/users/andersinno/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/andersinno/cmsplugin-carousel-ai","description":"Image carousel plugin for Django CMS","fork":false,"url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai","forks_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/forks","keys_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/teams","hooks_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/hooks","issue_events_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/issues/events{/number}","events_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/events","assignees_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/assignees{/user}","branches_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/branches{/branch}","tags_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/tags","blobs_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/git/refs{/sha}","trees_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/statuses/{sha}","languages_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/languages","stargazers_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/stargazers","contributors_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/contributors","subscribers_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/subscribers","subscription_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/subscription","commits_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/commits{/sha}","git_commits_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/git/commits{/sha}","comments_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/comments{/number}","issue_comment_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/issues/comments{/number}","contents_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/contents/{+path}","compare_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/merges","archive_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/downloads","issues_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/issues{/number}","pulls_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/pulls{/number}","milestones_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/milestones{/number}","notifications_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/labels{/name}","releases_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/releases{/id}","deployments_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/deployments","created_at":"2016-08-30T16:21:17Z","updated_at":"2016-08-31T12:35:40Z","pushed_at":"2016-08-31T12:52:48Z","git_url":"git://github.com/andersinno/cmsplugin-carousel-ai.git","ssh_url":"git@github.com:andersinno/cmsplugin-carousel-ai.git","clone_url":"https://github.com/andersinno/cmsplugin-carousel-ai.git","svn_url":"https://github.com/andersinno/cmsplugin-carousel-ai","homepage":"","size":8,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"andersinno:master","ref":"master","sha":"3859de22ac2ba71b8bbd819d4960a91680b36096","user":{"login":"andersinno","id":1138034,"avatar_url":"https://avatars.githubusercontent.com/u/1138034?v=3","gravatar_id":"","url":"https://api.github.com/users/andersinno","html_url":"https://github.com/andersinno","followers_url":"https://api.github.com/users/andersinno/followers","following_url":"https://api.github.com/users/andersinno/following{/other_user}","gists_url":"https://api.github.com/users/andersinno/gists{/gist_id}","starred_url":"https://api.github.com/users/andersinno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andersinno/subscriptions","organizations_url":"https://api.github.com/users/andersinno/orgs","repos_url":"https://api.github.com/users/andersinno/repos","events_url":"https://api.github.com/users/andersinno/events{/privacy}","received_events_url":"https://api.github.com/users/andersinno/received_events","type":"Organization","site_admin":false},"repo":{"id":66957774,"name":"cmsplugin-carousel-ai","full_name":"andersinno/cmsplugin-carousel-ai","owner":{"login":"andersinno","id":1138034,"avatar_url":"https://avatars.githubusercontent.com/u/1138034?v=3","gravatar_id":"","url":"https://api.github.com/users/andersinno","html_url":"https://github.com/andersinno","followers_url":"https://api.github.com/users/andersinno/followers","following_url":"https://api.github.com/users/andersinno/following{/other_user}","gists_url":"https://api.github.com/users/andersinno/gists{/gist_id}","starred_url":"https://api.github.com/users/andersinno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andersinno/subscriptions","organizations_url":"https://api.github.com/users/andersinno/orgs","repos_url":"https://api.github.com/users/andersinno/repos","events_url":"https://api.github.com/users/andersinno/events{/privacy}","received_events_url":"https://api.github.com/users/andersinno/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/andersinno/cmsplugin-carousel-ai","description":"Image carousel plugin for Django CMS","fork":false,"url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai","forks_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/forks","keys_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/teams","hooks_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/hooks","issue_events_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/issues/events{/number}","events_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/events","assignees_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/assignees{/user}","branches_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/branches{/branch}","tags_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/tags","blobs_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/git/refs{/sha}","trees_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/statuses/{sha}","languages_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/languages","stargazers_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/stargazers","contributors_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/contributors","subscribers_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/subscribers","subscription_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/subscription","commits_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/commits{/sha}","git_commits_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/git/commits{/sha}","comments_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/comments{/number}","issue_comment_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/issues/comments{/number}","contents_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/contents/{+path}","compare_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/merges","archive_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/downloads","issues_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/issues{/number}","pulls_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/pulls{/number}","milestones_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/milestones{/number}","notifications_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/labels{/name}","releases_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/releases{/id}","deployments_url":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/deployments","created_at":"2016-08-30T16:21:17Z","updated_at":"2016-08-31T12:35:40Z","pushed_at":"2016-08-31T12:52:48Z","git_url":"git://github.com/andersinno/cmsplugin-carousel-ai.git","ssh_url":"git@github.com:andersinno/cmsplugin-carousel-ai.git","clone_url":"https://github.com/andersinno/cmsplugin-carousel-ai.git","svn_url":"https://github.com/andersinno/cmsplugin-carousel-ai","homepage":"","size":8,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/pulls/3"},"html":{"href":"https://github.com/andersinno/cmsplugin-carousel-ai/pull/3"},"issue":{"href":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/issues/3"},"comments":{"href":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/andersinno/cmsplugin-carousel-ai/statuses/97aae527b24e47dd9ce51a53bd54b03b1bd00eb4"}}}}
{"actor":{"display_login":"akx"}}