{"action":"created","comment":{"url":"https://api.github.com/repos/divio/django-cms/pulls/comments/41046311","id":41046311,"diff_hunk":"@@ -0,0 +1,78 @@\n+# -*- coding: utf-8 -*-\n+\n+from __future__ import unicode_literals\n+\n+from django import forms\n+from django.utils.encoding import smart_text\n+from django.utils.translation import ugettext_lazy as _\n+\n+from cms.constants import TEMPLATE_INHERITANCE_MAGIC\n+from cms.models.titlemodels import EmptyTitle\n+\n+\n+class BaseCMSPageForm(forms.Form):\n+    title = forms.CharField(label=_(u'Title'), max_length=255,\n+                            help_text=_(u\"Provide a title for the new page.\"))\n+    content = forms.CharField(\n+        label=_(u'Content'), widget=forms.Textarea, required=False,\n+        help_text=_(u\"Optional. If supplied, will be automatically added \"\n+                    u\"within a new text plugin.\"))\n+\n+    def __init__(self, instance=None, *args, **kwargs):\n+        # Expect instance argument here, as we have to accept some of the\n+        # ModelForm __init__() arguments here for the ModelFormMixin cbv\n+        self.instance = instance\n+        super(BaseCMSPageForm, self).__init__(*args, **kwargs)\n+\n+\n+class CreateCMSPageForm(BaseCMSPageForm):\n+\n+    @staticmethod\n+    def create_page_titles(page, title, languages):\n+        # Import here due to potential circular dependency issues\n+        from cms.api import create_title\n+\n+        for language in languages:\n+            title_obj = page.get_title_obj(language=language, fallback=False)\n+            if isinstance(title_obj, EmptyTitle):\n+                create_title(language, title, page)\n+\n+    @staticmethod\n+    def get_placeholder_slot(page):\n+        \"\"\"\n+        Returns the slot name of the first editable, non-static placeholder\n+        or None.\n+        \"\"\"\n+        for ph in page.placeholders.all():\n+            if not ph.is_static and ph.is_editable:\n+                return ph.slot\n+        else:\n+            return None\n+\n+    def save(self, **kwargs):\n+        from cms.api import create_page, add_plugin\n+\n+        title = self.cleaned_data['title']\n+        page = create_page(\n+            title=title,\n+            template=TEMPLATE_INHERITANCE_MAGIC,\n+            language=self.language_code,\n+            created_by=smart_text(self.user),\n+            parent=self.page,","path":"cms/forms/wizards.py","position":61,"original_position":61,"commit_id":"7d8a36f099e011a622f284fdc8d74259b69ce677","original_commit_id":"7d8a36f099e011a622f284fdc8d74259b69ce677","user":{"login":"mkoistinen","id":615759,"avatar_url":"https://avatars.githubusercontent.com/u/615759?v=3","gravatar_id":"","url":"https://api.github.com/users/mkoistinen","html_url":"https://github.com/mkoistinen","followers_url":"https://api.github.com/users/mkoistinen/followers","following_url":"https://api.github.com/users/mkoistinen/following{/other_user}","gists_url":"https://api.github.com/users/mkoistinen/gists{/gist_id}","starred_url":"https://api.github.com/users/mkoistinen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkoistinen/subscriptions","organizations_url":"https://api.github.com/users/mkoistinen/orgs","repos_url":"https://api.github.com/users/mkoistinen/repos","events_url":"https://api.github.com/users/mkoistinen/events{/privacy}","received_events_url":"https://api.github.com/users/mkoistinen/received_events","type":"User","site_admin":false},"body":"What do you propose?","created_at":"2015-10-02T17:33:52Z","updated_at":"2015-10-02T17:33:52Z","html_url":"https://github.com/divio/django-cms/pull/4508#discussion_r41046311","pull_request_url":"https://api.github.com/repos/divio/django-cms/pulls/4508","_links":{"self":{"href":"https://api.github.com/repos/divio/django-cms/pulls/comments/41046311"},"html":{"href":"https://github.com/divio/django-cms/pull/4508#discussion_r41046311"},"pull_request":{"href":"https://api.github.com/repos/divio/django-cms/pulls/4508"}}},"pull_request":{"url":"https://api.github.com/repos/divio/django-cms/pulls/4508","id":46058156,"html_url":"https://github.com/divio/django-cms/pull/4508","diff_url":"https://github.com/divio/django-cms/pull/4508.diff","patch_url":"https://github.com/divio/django-cms/pull/4508.patch","issue_url":"https://api.github.com/repos/divio/django-cms/issues/4508","number":4508,"state":"open","locked":false,"title":"Content creation wizard","user":{"login":"mkoistinen","id":615759,"avatar_url":"https://avatars.githubusercontent.com/u/615759?v=3","gravatar_id":"","url":"https://api.github.com/users/mkoistinen","html_url":"https://github.com/mkoistinen","followers_url":"https://api.github.com/users/mkoistinen/followers","following_url":"https://api.github.com/users/mkoistinen/following{/other_user}","gists_url":"https://api.github.com/users/mkoistinen/gists{/gist_id}","starred_url":"https://api.github.com/users/mkoistinen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkoistinen/subscriptions","organizations_url":"https://api.github.com/users/mkoistinen/orgs","repos_url":"https://api.github.com/users/mkoistinen/repos","events_url":"https://api.github.com/users/mkoistinen/events{/privacy}","received_events_url":"https://api.github.com/users/mkoistinen/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-09-25T21:05:30Z","updated_at":"2015-10-02T17:33:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5eaf322f517101a876658f81dc98c1689f53ca60","assignee":null,"milestone":{"url":"https://api.github.com/repos/divio/django-cms/milestones/33","html_url":"https://github.com/divio/django-cms/milestones/3.2","labels_url":"https://api.github.com/repos/divio/django-cms/milestones/33/labels","id":1007077,"number":33,"title":"3.2","description":"Next feature release","creator":{"login":"yakky","id":714711,"avatar_url":"https://avatars.githubusercontent.com/u/714711?v=3","gravatar_id":"","url":"https://api.github.com/users/yakky","html_url":"https://github.com/yakky","followers_url":"https://api.github.com/users/yakky/followers","following_url":"https://api.github.com/users/yakky/following{/other_user}","gists_url":"https://api.github.com/users/yakky/gists{/gist_id}","starred_url":"https://api.github.com/users/yakky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yakky/subscriptions","organizations_url":"https://api.github.com/users/yakky/orgs","repos_url":"https://api.github.com/users/yakky/repos","events_url":"https://api.github.com/users/yakky/events{/privacy}","received_events_url":"https://api.github.com/users/yakky/received_events","type":"User","site_admin":false},"open_issues":71,"closed_issues":73,"state":"open","created_at":"2015-03-05T07:27:27Z","updated_at":"2015-10-02T15:48:45Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/divio/django-cms/pulls/4508/commits","review_comments_url":"https://api.github.com/repos/divio/django-cms/pulls/4508/comments","review_comment_url":"https://api.github.com/repos/divio/django-cms/pulls/comments{/number}","comments_url":"https://api.github.com/repos/divio/django-cms/issues/4508/comments","statuses_url":"https://api.github.com/repos/divio/django-cms/statuses/7d8a36f099e011a622f284fdc8d74259b69ce677","head":{"label":"mkoistinen:content_creation_wizard","ref":"content_creation_wizard","sha":"7d8a36f099e011a622f284fdc8d74259b69ce677","user":{"login":"mkoistinen","id":615759,"avatar_url":"https://avatars.githubusercontent.com/u/615759?v=3","gravatar_id":"","url":"https://api.github.com/users/mkoistinen","html_url":"https://github.com/mkoistinen","followers_url":"https://api.github.com/users/mkoistinen/followers","following_url":"https://api.github.com/users/mkoistinen/following{/other_user}","gists_url":"https://api.github.com/users/mkoistinen/gists{/gist_id}","starred_url":"https://api.github.com/users/mkoistinen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkoistinen/subscriptions","organizations_url":"https://api.github.com/users/mkoistinen/orgs","repos_url":"https://api.github.com/users/mkoistinen/repos","events_url":"https://api.github.com/users/mkoistinen/events{/privacy}","received_events_url":"https://api.github.com/users/mkoistinen/received_events","type":"User","site_admin":false},"repo":{"id":16410287,"name":"django-cms","full_name":"mkoistinen/django-cms","owner":{"login":"mkoistinen","id":615759,"avatar_url":"https://avatars.githubusercontent.com/u/615759?v=3","gravatar_id":"","url":"https://api.github.com/users/mkoistinen","html_url":"https://github.com/mkoistinen","followers_url":"https://api.github.com/users/mkoistinen/followers","following_url":"https://api.github.com/users/mkoistinen/following{/other_user}","gists_url":"https://api.github.com/users/mkoistinen/gists{/gist_id}","starred_url":"https://api.github.com/users/mkoistinen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkoistinen/subscriptions","organizations_url":"https://api.github.com/users/mkoistinen/orgs","repos_url":"https://api.github.com/users/mkoistinen/repos","events_url":"https://api.github.com/users/mkoistinen/events{/privacy}","received_events_url":"https://api.github.com/users/mkoistinen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mkoistinen/django-cms","description":"The easy-to-use and developer-friendly CMS","fork":true,"url":"https://api.github.com/repos/mkoistinen/django-cms","forks_url":"https://api.github.com/repos/mkoistinen/django-cms/forks","keys_url":"https://api.github.com/repos/mkoistinen/django-cms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mkoistinen/django-cms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mkoistinen/django-cms/teams","hooks_url":"https://api.github.com/repos/mkoistinen/django-cms/hooks","issue_events_url":"https://api.github.com/repos/mkoistinen/django-cms/issues/events{/number}","events_url":"https://api.github.com/repos/mkoistinen/django-cms/events","assignees_url":"https://api.github.com/repos/mkoistinen/django-cms/assignees{/user}","branches_url":"https://api.github.com/repos/mkoistinen/django-cms/branches{/branch}","tags_url":"https://api.github.com/repos/mkoistinen/django-cms/tags","blobs_url":"https://api.github.com/repos/mkoistinen/django-cms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mkoistinen/django-cms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mkoistinen/django-cms/git/refs{/sha}","trees_url":"https://api.github.com/repos/mkoistinen/django-cms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mkoistinen/django-cms/statuses/{sha}","languages_url":"https://api.github.com/repos/mkoistinen/django-cms/languages","stargazers_url":"https://api.github.com/repos/mkoistinen/django-cms/stargazers","contributors_url":"https://api.github.com/repos/mkoistinen/django-cms/contributors","subscribers_url":"https://api.github.com/repos/mkoistinen/django-cms/subscribers","subscription_url":"https://api.github.com/repos/mkoistinen/django-cms/subscription","commits_url":"https://api.github.com/repos/mkoistinen/django-cms/commits{/sha}","git_commits_url":"https://api.github.com/repos/mkoistinen/django-cms/git/commits{/sha}","comments_url":"https://api.github.com/repos/mkoistinen/django-cms/comments{/number}","issue_comment_url":"https://api.github.com/repos/mkoistinen/django-cms/issues/comments{/number}","contents_url":"https://api.github.com/repos/mkoistinen/django-cms/contents/{+path}","compare_url":"https://api.github.com/repos/mkoistinen/django-cms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mkoistinen/django-cms/merges","archive_url":"https://api.github.com/repos/mkoistinen/django-cms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mkoistinen/django-cms/downloads","issues_url":"https://api.github.com/repos/mkoistinen/django-cms/issues{/number}","pulls_url":"https://api.github.com/repos/mkoistinen/django-cms/pulls{/number}","milestones_url":"https://api.github.com/repos/mkoistinen/django-cms/milestones{/number}","notifications_url":"https://api.github.com/repos/mkoistinen/django-cms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mkoistinen/django-cms/labels{/name}","releases_url":"https://api.github.com/repos/mkoistinen/django-cms/releases{/id}","created_at":"2014-01-31T14:35:19Z","updated_at":"2015-03-04T16:30:48Z","pushed_at":"2015-10-02T04:06:56Z","git_url":"git://github.com/mkoistinen/django-cms.git","ssh_url":"git@github.com:mkoistinen/django-cms.git","clone_url":"https://github.com/mkoistinen/django-cms.git","svn_url":"https://github.com/mkoistinen/django-cms","homepage":"http://www.django-cms.org","size":49425,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"divio:develop","ref":"develop","sha":"dccab14ffc0990e3a9e2a2da9a3275f2552fb5b8","user":{"login":"divio","id":117904,"avatar_url":"https://avatars.githubusercontent.com/u/117904?v=3","gravatar_id":"","url":"https://api.github.com/users/divio","html_url":"https://github.com/divio","followers_url":"https://api.github.com/users/divio/followers","following_url":"https://api.github.com/users/divio/following{/other_user}","gists_url":"https://api.github.com/users/divio/gists{/gist_id}","starred_url":"https://api.github.com/users/divio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/divio/subscriptions","organizations_url":"https://api.github.com/users/divio/orgs","repos_url":"https://api.github.com/users/divio/repos","events_url":"https://api.github.com/users/divio/events{/privacy}","received_events_url":"https://api.github.com/users/divio/received_events","type":"Organization","site_admin":false},"repo":{"id":143580,"name":"django-cms","full_name":"divio/django-cms","owner":{"login":"divio","id":117904,"avatar_url":"https://avatars.githubusercontent.com/u/117904?v=3","gravatar_id":"","url":"https://api.github.com/users/divio","html_url":"https://github.com/divio","followers_url":"https://api.github.com/users/divio/followers","following_url":"https://api.github.com/users/divio/following{/other_user}","gists_url":"https://api.github.com/users/divio/gists{/gist_id}","starred_url":"https://api.github.com/users/divio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/divio/subscriptions","organizations_url":"https://api.github.com/users/divio/orgs","repos_url":"https://api.github.com/users/divio/repos","events_url":"https://api.github.com/users/divio/events{/privacy}","received_events_url":"https://api.github.com/users/divio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/divio/django-cms","description":"The easy-to-use and developer-friendly CMS","fork":false,"url":"https://api.github.com/repos/divio/django-cms","forks_url":"https://api.github.com/repos/divio/django-cms/forks","keys_url":"https://api.github.com/repos/divio/django-cms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/divio/django-cms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/divio/django-cms/teams","hooks_url":"https://api.github.com/repos/divio/django-cms/hooks","issue_events_url":"https://api.github.com/repos/divio/django-cms/issues/events{/number}","events_url":"https://api.github.com/repos/divio/django-cms/events","assignees_url":"https://api.github.com/repos/divio/django-cms/assignees{/user}","branches_url":"https://api.github.com/repos/divio/django-cms/branches{/branch}","tags_url":"https://api.github.com/repos/divio/django-cms/tags","blobs_url":"https://api.github.com/repos/divio/django-cms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/divio/django-cms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/divio/django-cms/git/refs{/sha}","trees_url":"https://api.github.com/repos/divio/django-cms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/divio/django-cms/statuses/{sha}","languages_url":"https://api.github.com/repos/divio/django-cms/languages","stargazers_url":"https://api.github.com/repos/divio/django-cms/stargazers","contributors_url":"https://api.github.com/repos/divio/django-cms/contributors","subscribers_url":"https://api.github.com/repos/divio/django-cms/subscribers","subscription_url":"https://api.github.com/repos/divio/django-cms/subscription","commits_url":"https://api.github.com/repos/divio/django-cms/commits{/sha}","git_commits_url":"https://api.github.com/repos/divio/django-cms/git/commits{/sha}","comments_url":"https://api.github.com/repos/divio/django-cms/comments{/number}","issue_comment_url":"https://api.github.com/repos/divio/django-cms/issues/comments{/number}","contents_url":"https://api.github.com/repos/divio/django-cms/contents/{+path}","compare_url":"https://api.github.com/repos/divio/django-cms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/divio/django-cms/merges","archive_url":"https://api.github.com/repos/divio/django-cms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/divio/django-cms/downloads","issues_url":"https://api.github.com/repos/divio/django-cms/issues{/number}","pulls_url":"https://api.github.com/repos/divio/django-cms/pulls{/number}","milestones_url":"https://api.github.com/repos/divio/django-cms/milestones{/number}","notifications_url":"https://api.github.com/repos/divio/django-cms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/divio/django-cms/labels{/name}","releases_url":"https://api.github.com/repos/divio/django-cms/releases{/id}","created_at":"2009-03-05T10:14:18Z","updated_at":"2015-10-02T07:10:10Z","pushed_at":"2015-10-02T17:09:12Z","git_url":"git://github.com/divio/django-cms.git","ssh_url":"git@github.com:divio/django-cms.git","clone_url":"https://github.com/divio/django-cms.git","svn_url":"https://github.com/divio/django-cms","homepage":"http://www.django-cms.org","size":68553,"stargazers_count":3675,"watchers_count":3675,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1417,"mirror_url":null,"open_issues_count":293,"forks":1417,"open_issues":293,"watchers":3675,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/divio/django-cms/pulls/4508"},"html":{"href":"https://github.com/divio/django-cms/pull/4508"},"issue":{"href":"https://api.github.com/repos/divio/django-cms/issues/4508"},"comments":{"href":"https://api.github.com/repos/divio/django-cms/issues/4508/comments"},"review_comments":{"href":"https://api.github.com/repos/divio/django-cms/pulls/4508/comments"},"review_comment":{"href":"https://api.github.com/repos/divio/django-cms/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/divio/django-cms/pulls/4508/commits"},"statuses":{"href":"https://api.github.com/repos/divio/django-cms/statuses/7d8a36f099e011a622f284fdc8d74259b69ce677"}}}}