From b1e57a1dbde03df80ccdf978c2be7abe501653d5 Mon Sep 17 00:00:00 2001 From: Rahul Tiwari Date: Fri, 12 Oct 2018 17:11:27 +0530 Subject: [PATCH 1/5] Remove unused views --- readthedocs/locale/ar/LC_MESSAGES/django.po | 5 --- readthedocs/locale/ca/LC_MESSAGES/django.po | 12 ------ readthedocs/locale/de/LC_MESSAGES/django.po | 4 -- readthedocs/locale/en/LC_MESSAGES/django.po | 14 ------- readthedocs/locale/eu/LC_MESSAGES/django.po | 5 --- readthedocs/locale/fr/LC_MESSAGES/django.po | 5 --- readthedocs/locale/gl/LC_MESSAGES/django.po | 5 --- readthedocs/locale/it/LC_MESSAGES/django.po | 14 ------- readthedocs/locale/ja/LC_MESSAGES/django.po | 5 --- readthedocs/locale/nb/LC_MESSAGES/django.po | 5 --- readthedocs/locale/pl/LC_MESSAGES/django.po | 5 --- .../locale/pt_BR/LC_MESSAGES/django.po | 5 --- readthedocs/locale/ru/LC_MESSAGES/django.po | 5 --- readthedocs/locale/sk/LC_MESSAGES/django.po | 5 --- readthedocs/locale/uk/LC_MESSAGES/django.po | 5 --- .../locale/vi_VN/LC_MESSAGES/django.po | 5 --- .../locale/zh_CN/LC_MESSAGES/django.po | 5 --- .../locale/zh_TW/LC_MESSAGES/django.po | 5 --- readthedocs/projects/views/private.py | 33 ---------------- .../templates/projects/alias_edit.html | 18 --------- .../templates/projects/alias_list.html | 38 ------------------- 21 files changed, 203 deletions(-) delete mode 100644 readthedocs/templates/projects/alias_edit.html delete mode 100644 readthedocs/templates/projects/alias_list.html diff --git a/readthedocs/locale/ar/LC_MESSAGES/django.po b/readthedocs/locale/ar/LC_MESSAGES/django.po index 8577189648a..5b1e41607aa 100644 --- a/readthedocs/locale/ar/LC_MESSAGES/django.po +++ b/readthedocs/locale/ar/LC_MESSAGES/django.po @@ -2400,11 +2400,6 @@ msgstr "أضف كنية لإصدار المشروع" msgid "Create" msgstr "إنشاء" -#: templates/projects/alias_list.html:6 templates/projects/alias_list.html:11 -msgid "Aliases" -msgstr "أسماء كنية" - -#: templates/projects/alias_list.html:20 #: templates/projects/project_list.html:48 msgid "Browse projects" msgstr "تصفّح المشاريع" diff --git a/readthedocs/locale/ca/LC_MESSAGES/django.po b/readthedocs/locale/ca/LC_MESSAGES/django.po index aeb278af22d..98db7f17e75 100644 --- a/readthedocs/locale/ca/LC_MESSAGES/django.po +++ b/readthedocs/locale/ca/LC_MESSAGES/django.po @@ -2415,24 +2415,12 @@ msgstr "D'acord, desa'l" msgid "%(user)s's profile" msgstr "Perfil de %(user)s" -#: templates/projects/alias_edit.html:4 templates/projects/alias_edit.html:7 -msgid "Project Alias" -msgstr "Àlies del projecte" - -#: templates/projects/alias_edit.html:12 -msgid "Add an alias for a project version." -msgstr "Afegiu un àlies a la versió del projecte." #: templates/projects/alias_edit.html:16 #: templates/projects/project_create.html:19 msgid "Create" msgstr "Crea" -#: templates/projects/alias_list.html:6 templates/projects/alias_list.html:11 -msgid "Aliases" -msgstr "Àlies" - -#: templates/projects/alias_list.html:20 #: templates/projects/project_list.html:48 msgid "Browse projects" msgstr "Navega pels projectes" diff --git a/readthedocs/locale/de/LC_MESSAGES/django.po b/readthedocs/locale/de/LC_MESSAGES/django.po index dd6c5417a83..99d5bc0b06e 100644 --- a/readthedocs/locale/de/LC_MESSAGES/django.po +++ b/readthedocs/locale/de/LC_MESSAGES/django.po @@ -2430,11 +2430,7 @@ msgstr "Alternativer Name für eine Projektversion hinzufügen" msgid "Create" msgstr "Erstellen" -#: templates/projects/alias_list.html:6 templates/projects/alias_list.html:11 -msgid "Aliases" -msgstr "Alternativer Name" -#: templates/projects/alias_list.html:20 #: templates/projects/project_list.html:48 msgid "Browse projects" msgstr "Projekte durchsuchen" diff --git a/readthedocs/locale/en/LC_MESSAGES/django.po b/readthedocs/locale/en/LC_MESSAGES/django.po index d8fc8071aa9..42125934a22 100644 --- a/readthedocs/locale/en/LC_MESSAGES/django.po +++ b/readthedocs/locale/en/LC_MESSAGES/django.po @@ -2375,24 +2375,10 @@ msgstr "" msgid "%(user)s's profile" msgstr "" -#: templates/projects/alias_edit.html:4 templates/projects/alias_edit.html:7 -msgid "Project Alias" -msgstr "" - -#: templates/projects/alias_edit.html:12 -msgid "Add an alias for a project version." -msgstr "" - -#: templates/projects/alias_edit.html:16 #: templates/projects/project_create.html:19 msgid "Create" msgstr "" -#: templates/projects/alias_list.html:6 templates/projects/alias_list.html:11 -msgid "Aliases" -msgstr "" - -#: templates/projects/alias_list.html:20 #: templates/projects/project_list.html:48 msgid "Browse projects" msgstr "" diff --git a/readthedocs/locale/eu/LC_MESSAGES/django.po b/readthedocs/locale/eu/LC_MESSAGES/django.po index 8205bb1f796..866200fb266 100644 --- a/readthedocs/locale/eu/LC_MESSAGES/django.po +++ b/readthedocs/locale/eu/LC_MESSAGES/django.po @@ -2390,11 +2390,6 @@ msgstr "" msgid "Create" msgstr "" -#: templates/projects/alias_list.html:6 templates/projects/alias_list.html:11 -msgid "Aliases" -msgstr "" - -#: templates/projects/alias_list.html:20 #: templates/projects/project_list.html:48 msgid "Browse projects" msgstr "Arakatu proiektuak" diff --git a/readthedocs/locale/fr/LC_MESSAGES/django.po b/readthedocs/locale/fr/LC_MESSAGES/django.po index 3581fcd1e84..1bb5a7b5847 100644 --- a/readthedocs/locale/fr/LC_MESSAGES/django.po +++ b/readthedocs/locale/fr/LC_MESSAGES/django.po @@ -2843,11 +2843,6 @@ msgstr "Ajouter un alias pour une version de projet." msgid "Create" msgstr "Créer" -#: templates/projects/alias_list.html:6 templates/projects/alias_list.html:11 -msgid "Aliases" -msgstr "Alias" - -#: templates/projects/alias_list.html:20 #: templates/projects/project_list.html:48 msgid "Browse projects" msgstr "Parcourir les projets" diff --git a/readthedocs/locale/gl/LC_MESSAGES/django.po b/readthedocs/locale/gl/LC_MESSAGES/django.po index 94bded26393..81b75a47bc2 100644 --- a/readthedocs/locale/gl/LC_MESSAGES/django.po +++ b/readthedocs/locale/gl/LC_MESSAGES/django.po @@ -2393,11 +2393,6 @@ msgstr "Engadir un alias para unha versión de proxecto." msgid "Create" msgstr "Crear" -#: templates/projects/alias_list.html:6 templates/projects/alias_list.html:11 -msgid "Aliases" -msgstr "Alias" - -#: templates/projects/alias_list.html:20 #: templates/projects/project_list.html:48 msgid "Browse projects" msgstr "" diff --git a/readthedocs/locale/it/LC_MESSAGES/django.po b/readthedocs/locale/it/LC_MESSAGES/django.po index 50b86128328..6ecfe455af4 100644 --- a/readthedocs/locale/it/LC_MESSAGES/django.po +++ b/readthedocs/locale/it/LC_MESSAGES/django.po @@ -2666,24 +2666,10 @@ msgstr "OK, salvalo!" msgid "%(user)s's profile" msgstr "profilo di %(user)s" -#: templates/projects/alias_edit.html:4 templates/projects/alias_edit.html:7 -msgid "Project Alias" -msgstr "Alias per Progetto" - -#: templates/projects/alias_edit.html:12 -msgid "Add an alias for a project version." -msgstr "Aggiungi un alias per una versione di progetto" - -#: templates/projects/alias_edit.html:16 #: templates/projects/project_create.html:19 msgid "Create" msgstr "Crea" -#: templates/projects/alias_list.html:6 templates/projects/alias_list.html:11 -msgid "Aliases" -msgstr "Alias" - -#: templates/projects/alias_list.html:20 #: templates/projects/project_list.html:48 msgid "Browse projects" msgstr "Sfoglia progetti" diff --git a/readthedocs/locale/ja/LC_MESSAGES/django.po b/readthedocs/locale/ja/LC_MESSAGES/django.po index b8744c9ef6e..46380baada0 100644 --- a/readthedocs/locale/ja/LC_MESSAGES/django.po +++ b/readthedocs/locale/ja/LC_MESSAGES/django.po @@ -2481,11 +2481,6 @@ msgstr "プロジェクトのバージョンに対する別名を追加" msgid "Create" msgstr "作成" -#: templates/projects/alias_list.html:6 templates/projects/alias_list.html:11 -msgid "Aliases" -msgstr "別名" - -#: templates/projects/alias_list.html:20 #: templates/projects/project_list.html:48 msgid "Browse projects" msgstr "プロジェクトを見る" diff --git a/readthedocs/locale/nb/LC_MESSAGES/django.po b/readthedocs/locale/nb/LC_MESSAGES/django.po index 6d9a896eca9..deab243e097 100644 --- a/readthedocs/locale/nb/LC_MESSAGES/django.po +++ b/readthedocs/locale/nb/LC_MESSAGES/django.po @@ -2425,11 +2425,6 @@ msgstr "Legg til et alias for en prosjektversjon." msgid "Create" msgstr "Opprett" -#: templates/projects/alias_list.html:6 templates/projects/alias_list.html:11 -msgid "Aliases" -msgstr "Alias" - -#: templates/projects/alias_list.html:20 #: templates/projects/project_list.html:48 msgid "Browse projects" msgstr "Finn prosjekter" diff --git a/readthedocs/locale/pl/LC_MESSAGES/django.po b/readthedocs/locale/pl/LC_MESSAGES/django.po index 45b2e5a0cd6..213ade44eaf 100644 --- a/readthedocs/locale/pl/LC_MESSAGES/django.po +++ b/readthedocs/locale/pl/LC_MESSAGES/django.po @@ -2400,11 +2400,6 @@ msgstr "Dodaj inną nazwę dla wersji projektu." msgid "Create" msgstr "Utwórz" -#: templates/projects/alias_list.html:6 templates/projects/alias_list.html:11 -msgid "Aliases" -msgstr "Inne nazwy" - -#: templates/projects/alias_list.html:20 #: templates/projects/project_list.html:48 msgid "Browse projects" msgstr "Przeglądaj projekty" diff --git a/readthedocs/locale/pt_BR/LC_MESSAGES/django.po b/readthedocs/locale/pt_BR/LC_MESSAGES/django.po index 7c8618e3fc4..ef6c1e474a3 100644 --- a/readthedocs/locale/pt_BR/LC_MESSAGES/django.po +++ b/readthedocs/locale/pt_BR/LC_MESSAGES/django.po @@ -2504,11 +2504,6 @@ msgstr "Adic alias para versão projeto" msgid "Create" msgstr "Criar" -#: templates/projects/alias_list.html:6 templates/projects/alias_list.html:11 -msgid "Aliases" -msgstr "Apelidos" - -#: templates/projects/alias_list.html:20 #: templates/projects/project_list.html:48 msgid "Browse projects" msgstr "Navegar em projetos" diff --git a/readthedocs/locale/ru/LC_MESSAGES/django.po b/readthedocs/locale/ru/LC_MESSAGES/django.po index 2f92b575d25..11b601d8119 100644 --- a/readthedocs/locale/ru/LC_MESSAGES/django.po +++ b/readthedocs/locale/ru/LC_MESSAGES/django.po @@ -2454,11 +2454,6 @@ msgstr "Добавить для версии проекта другое наз msgid "Create" msgstr "Создать" -#: templates/projects/alias_list.html:6 templates/projects/alias_list.html:11 -msgid "Aliases" -msgstr "Другие названия" - -#: templates/projects/alias_list.html:20 #: templates/projects/project_list.html:48 msgid "Browse projects" msgstr "Просмотреть пректы" diff --git a/readthedocs/locale/sk/LC_MESSAGES/django.po b/readthedocs/locale/sk/LC_MESSAGES/django.po index 13c3774443b..9c879ecca58 100644 --- a/readthedocs/locale/sk/LC_MESSAGES/django.po +++ b/readthedocs/locale/sk/LC_MESSAGES/django.po @@ -2400,11 +2400,6 @@ msgstr "" msgid "Create" msgstr "Vytvoriť" -#: templates/projects/alias_list.html:6 templates/projects/alias_list.html:11 -msgid "Aliases" -msgstr "" - -#: templates/projects/alias_list.html:20 #: templates/projects/project_list.html:48 msgid "Browse projects" msgstr "" diff --git a/readthedocs/locale/uk/LC_MESSAGES/django.po b/readthedocs/locale/uk/LC_MESSAGES/django.po index 4bb35aba6ab..8987cde6b27 100644 --- a/readthedocs/locale/uk/LC_MESSAGES/django.po +++ b/readthedocs/locale/uk/LC_MESSAGES/django.po @@ -2414,11 +2414,6 @@ msgstr "Додайте псевдонім для версії проекту." msgid "Create" msgstr "Створити" -#: templates/projects/alias_list.html:6 templates/projects/alias_list.html:11 -msgid "Aliases" -msgstr "Псевдоніми" - -#: templates/projects/alias_list.html:20 #: templates/projects/project_list.html:48 msgid "Browse projects" msgstr "Перегляд проектів" diff --git a/readthedocs/locale/vi_VN/LC_MESSAGES/django.po b/readthedocs/locale/vi_VN/LC_MESSAGES/django.po index 5d618a0bca8..eac30ad0365 100644 --- a/readthedocs/locale/vi_VN/LC_MESSAGES/django.po +++ b/readthedocs/locale/vi_VN/LC_MESSAGES/django.po @@ -2409,11 +2409,6 @@ msgstr "Thêm tên khác cho một phiên bản của dự án." msgid "Create" msgstr "" -#: templates/projects/alias_list.html:6 templates/projects/alias_list.html:11 -msgid "Aliases" -msgstr "Các tên phụ" - -#: templates/projects/alias_list.html:20 #: templates/projects/project_list.html:48 msgid "Browse projects" msgstr "Xem qua các dự án" diff --git a/readthedocs/locale/zh_CN/LC_MESSAGES/django.po b/readthedocs/locale/zh_CN/LC_MESSAGES/django.po index 7de41584cb9..5bb16469db7 100644 --- a/readthedocs/locale/zh_CN/LC_MESSAGES/django.po +++ b/readthedocs/locale/zh_CN/LC_MESSAGES/django.po @@ -2589,11 +2589,6 @@ msgstr "给项目版本添加别名" msgid "Create" msgstr "创建" -#: templates/projects/alias_list.html:6 templates/projects/alias_list.html:11 -msgid "Aliases" -msgstr "别名" - -#: templates/projects/alias_list.html:20 #: templates/projects/project_list.html:48 msgid "Browse projects" msgstr "浏览项目" diff --git a/readthedocs/locale/zh_TW/LC_MESSAGES/django.po b/readthedocs/locale/zh_TW/LC_MESSAGES/django.po index bfab62afde8..067db59ca3e 100644 --- a/readthedocs/locale/zh_TW/LC_MESSAGES/django.po +++ b/readthedocs/locale/zh_TW/LC_MESSAGES/django.po @@ -2523,11 +2523,6 @@ msgstr "新增專案版本別名" msgid "Create" msgstr "建立" -#: templates/projects/alias_list.html:6 templates/projects/alias_list.html:11 -msgid "Aliases" -msgstr "別名" - -#: templates/projects/alias_list.html:20 #: templates/projects/project_list.html:48 msgid "Browse projects" msgstr "瀏覽專案" diff --git a/readthedocs/projects/views/private.py b/readthedocs/projects/views/private.py index 30731529d8a..98a3e5e37f3 100644 --- a/readthedocs/projects/views/private.py +++ b/readthedocs/projects/views/private.py @@ -372,39 +372,6 @@ def get_context_data(self, **kwargs): return context -@login_required -def edit_alias(request, project_slug, alias_id=None): - """Edit project alias form view.""" - proj = get_object_or_404( - Project.objects.for_admin_user(request.user), slug=project_slug) - if alias_id: - alias = proj.aliases.get(pk=alias_id) - form = AliasForm(instance=alias, data=request.POST or None) - else: - form = AliasForm(request.POST or None) - - if request.method == 'POST' and form.is_valid(): - alias = form.save() - return HttpResponseRedirect(alias.project.get_absolute_url()) - return render( - request, - 'projects/alias_edit.html', - {'form': form}, - ) - - -class AliasList(PrivateViewMixin, ListView): - model = VersionAlias - template_context_name = 'alias' - template_name = 'projects/alias_list.html' - - def get_queryset(self): - self.project = get_object_or_404( - Project.objects.for_admin_user(self.request.user), - slug=self.kwargs.get('project_slug')) - return self.project.aliases.all() - - class ProjectRelationshipMixin(ProjectAdminMixin, PrivateViewMixin): model = ProjectRelationship diff --git a/readthedocs/templates/projects/alias_edit.html b/readthedocs/templates/projects/alias_edit.html deleted file mode 100644 index b32d1d8371b..00000000000 --- a/readthedocs/templates/projects/alias_edit.html +++ /dev/null @@ -1,18 +0,0 @@ -{% extends "dashboard/base_dashboard.html" %} -{% load i18n %} - -{% block title %}{% trans "Project Alias" %}{% endblock %} - -{% block content-header %} -

{% trans "Project Alias" %}

-{% endblock %} - -{% block content %} -

- {% trans "Add an alias for a project version." %} -

-
{% csrf_token %} - {{ form.as_p }} -

-
-{% endblock %} diff --git a/readthedocs/templates/projects/alias_list.html b/readthedocs/templates/projects/alias_list.html deleted file mode 100644 index e94784a463e..00000000000 --- a/readthedocs/templates/projects/alias_list.html +++ /dev/null @@ -1,38 +0,0 @@ -{% extends "projects/base_project.html" %} -{% load i18n %} - -{% load pagination_tags %} - -{% block title %}{% trans "Aliases" %} {% endblock %} - -{% block nav-browse %}class="active"{% endblock %} - -{% block content-header %} -{% trans "Aliases" %} -{% endblock %} - -{% block content %} - -
-
- -
-

{% trans "Browse projects" %}

-
- -
-
- -
    -{% for alias in alias_list %} -
  • {{ alias }}
  • -{% endfor %} -
- -
-
- -
-
- -{% endblock %} From 78f738b3e94924e4abee33771553fe84c6ec08e0 Mon Sep 17 00:00:00 2001 From: Rahul Tiwari Date: Sat, 13 Oct 2018 14:15:51 +0530 Subject: [PATCH 2/5] Remove unused models and forms --- readthedocs/builds/forms.py | 21 +-------------------- readthedocs/builds/models.py | 21 --------------------- 2 files changed, 1 insertion(+), 41 deletions(-) diff --git a/readthedocs/builds/forms.py b/readthedocs/builds/forms.py index 83daec3459b..74fe0dba504 100644 --- a/readthedocs/builds/forms.py +++ b/readthedocs/builds/forms.py @@ -11,27 +11,8 @@ from django import forms from django.utils.translation import ugettext_lazy as _ -from readthedocs.builds.models import Version, VersionAlias +from readthedocs.builds.models import Version from readthedocs.core.utils import trigger_build -from readthedocs.projects.models import Project - - -class AliasForm(forms.ModelForm): - - class Meta(object): - model = VersionAlias - fields = ( - 'project', - 'from_slug', - 'to_slug', - 'largest', - ) - - def __init__(self, instance=None, *args, **kwargs): # noqa - super(AliasForm, self).__init__(instance=instance, *args, **kwargs) - if instance: - self.fields['project'].queryset = (Project.objects - .filter(pk=instance.project.pk)) class VersionForm(forms.ModelForm): diff --git a/readthedocs/builds/models.py b/readthedocs/builds/models.py index 7698cdfd693..ffd15ee6844 100644 --- a/readthedocs/builds/models.py +++ b/readthedocs/builds/models.py @@ -404,27 +404,6 @@ def save(self, *args, **kwargs): return 0 -@python_2_unicode_compatible -class VersionAlias(models.Model): - - """Alias for a ``Version``.""" - - project = models.ForeignKey( - Project, verbose_name=_('Project'), related_name='aliases') - from_slug = models.CharField(_('From slug'), max_length=255, default='') - to_slug = models.CharField( - _('To slug'), max_length=255, default='', blank=True) - largest = models.BooleanField(_('Largest'), default=False) - - def __str__(self): - return ugettext( - 'Alias for {project}: {_from} -> {to}'.format( - project=self.project, - _from=self.from_slug, - to=self.to_slug, - )) - - @python_2_unicode_compatible class Build(models.Model): From 31203654e66c5fd03e8c7f38a1a1d3a58ea11c9d Mon Sep 17 00:00:00 2001 From: Rahul Tiwari Date: Sat, 13 Oct 2018 14:19:50 +0530 Subject: [PATCH 3/5] Remove usages --- readthedocs/builds/admin.py | 3 +-- readthedocs/builds/migrations/0001_initial.py | 10 ---------- readthedocs/projects/views/private.py | 4 ++-- readthedocs/rtd_tests/tests/test_privacy_urls.py | 3 +-- 4 files changed, 4 insertions(+), 16 deletions(-) diff --git a/readthedocs/builds/admin.py b/readthedocs/builds/admin.py index eea6024569a..66c046f9c3e 100644 --- a/readthedocs/builds/admin.py +++ b/readthedocs/builds/admin.py @@ -2,7 +2,7 @@ from __future__ import absolute_import from django.contrib import admin -from readthedocs.builds.models import Build, VersionAlias, Version, BuildCommandResult +from readthedocs.builds.models import Build, Version, BuildCommandResult from guardian.admin import GuardedModelAdmin @@ -32,5 +32,4 @@ class VersionAdmin(GuardedModelAdmin): admin.site.register(Build, BuildAdmin) -admin.site.register(VersionAlias) admin.site.register(Version, VersionAdmin) diff --git a/readthedocs/builds/migrations/0001_initial.py b/readthedocs/builds/migrations/0001_initial.py index 32e6e0eb1fd..d3b45f31645 100644 --- a/readthedocs/builds/migrations/0001_initial.py +++ b/readthedocs/builds/migrations/0001_initial.py @@ -60,16 +60,6 @@ class Migration(migrations.Migration): 'permissions': (('view_version', 'View Version'),), }, ), - migrations.CreateModel( - name='VersionAlias', - fields=[ - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('from_slug', models.CharField(default=b'', max_length=255, verbose_name='From slug')), - ('to_slug', models.CharField(default=b'', max_length=255, verbose_name='To slug', blank=True)), - ('largest', models.BooleanField(default=False, verbose_name='Largest')), - ('project', models.ForeignKey(related_name='aliases', verbose_name='Project', to='projects.Project')), - ], - ), migrations.AddField( model_name='build', name='version', diff --git a/readthedocs/projects/views/private.py b/readthedocs/projects/views/private.py index 98a3e5e37f3..897388c14ba 100644 --- a/readthedocs/projects/views/private.py +++ b/readthedocs/projects/views/private.py @@ -22,8 +22,8 @@ from django.views.generic import ListView, TemplateView, View from formtools.wizard.views import SessionWizardView from vanilla import CreateView, DeleteView, DetailView, GenericView, UpdateView -from readthedocs.builds.forms import AliasForm, VersionForm -from readthedocs.builds.models import Version, VersionAlias +from readthedocs.builds.forms import VersionForm +from readthedocs.builds.models import Version from readthedocs.core.mixins import ListViewWithForm, LoginRequiredMixin from readthedocs.core.utils import broadcast, trigger_build, prepare_build from readthedocs.integrations.models import HttpExchange, Integration diff --git a/readthedocs/rtd_tests/tests/test_privacy_urls.py b/readthedocs/rtd_tests/tests/test_privacy_urls.py index c3edf1c14d4..624273b5211 100644 --- a/readthedocs/rtd_tests/tests/test_privacy_urls.py +++ b/readthedocs/rtd_tests/tests/test_privacy_urls.py @@ -11,7 +11,7 @@ import mock from taggit.models import Tag -from readthedocs.builds.models import Build, VersionAlias, BuildCommandResult +from readthedocs.builds.models import Build, BuildCommandResult from readthedocs.core.utils.tasks import TaskNoPermission from readthedocs.integrations.models import HttpExchange, Integration from readthedocs.projects.models import Project, Domain @@ -137,7 +137,6 @@ def setUp(self): super(ProjectMixin, self).setUp() self.build = get(Build, project=self.pip) self.tag = get(Tag, slug='coolness') - self.alias = get(VersionAlias, slug='that_alias', project=self.pip) self.subproject = get(Project, slug='sub', language='ja', users=[self.owner], main_language_project=None) self.pip.add_subproject(self.subproject) From 36d90a94249058ef490b53295cd158f7d3def947 Mon Sep 17 00:00:00 2001 From: Rahul Tiwari Date: Sat, 13 Oct 2018 14:22:41 +0530 Subject: [PATCH 4/5] Remove alias.pk from kwargs --- readthedocs/rtd_tests/tests/test_privacy_urls.py | 1 - 1 file changed, 1 deletion(-) diff --git a/readthedocs/rtd_tests/tests/test_privacy_urls.py b/readthedocs/rtd_tests/tests/test_privacy_urls.py index 624273b5211..c1518af1ecb 100644 --- a/readthedocs/rtd_tests/tests/test_privacy_urls.py +++ b/readthedocs/rtd_tests/tests/test_privacy_urls.py @@ -157,7 +157,6 @@ def setUp(self): 'filename': 'index.html', 'type_': 'pdf', 'tag': self.tag.slug, - 'alias_id': self.alias.pk, 'child_slug': self.subproject.slug, 'build_pk': self.build.pk, 'domain_pk': self.domain.pk, From 736302de45ac81b569a31c854295dd38f305846c Mon Sep 17 00:00:00 2001 From: Rahul Tiwari Date: Wed, 17 Oct 2018 14:51:38 +0530 Subject: [PATCH 5/5] Revert back the initial migration and add migration --- readthedocs/builds/migrations/0001_initial.py | 10 ++++ .../migrations/0005_remove-version-alias.py | 58 +++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 readthedocs/builds/migrations/0005_remove-version-alias.py diff --git a/readthedocs/builds/migrations/0001_initial.py b/readthedocs/builds/migrations/0001_initial.py index d3b45f31645..32e6e0eb1fd 100644 --- a/readthedocs/builds/migrations/0001_initial.py +++ b/readthedocs/builds/migrations/0001_initial.py @@ -60,6 +60,16 @@ class Migration(migrations.Migration): 'permissions': (('view_version', 'View Version'),), }, ), + migrations.CreateModel( + name='VersionAlias', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('from_slug', models.CharField(default=b'', max_length=255, verbose_name='From slug')), + ('to_slug', models.CharField(default=b'', max_length=255, verbose_name='To slug', blank=True)), + ('largest', models.BooleanField(default=False, verbose_name='Largest')), + ('project', models.ForeignKey(related_name='aliases', verbose_name='Project', to='projects.Project')), + ], + ), migrations.AddField( model_name='build', name='version', diff --git a/readthedocs/builds/migrations/0005_remove-version-alias.py b/readthedocs/builds/migrations/0005_remove-version-alias.py new file mode 100644 index 00000000000..a41af51e2df --- /dev/null +++ b/readthedocs/builds/migrations/0005_remove-version-alias.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.13 on 2018-10-17 04:20 +from __future__ import unicode_literals + +from django.db import migrations, models +import readthedocs.builds.version_slug + + +class Migration(migrations.Migration): + + dependencies = [ + ('builds', '0004_add-apiversion-proxy-model'), + ] + + operations = [ + migrations.RemoveField( + model_name='versionalias', + name='project', + ), + migrations.AlterField( + model_name='build', + name='error', + field=models.TextField(blank=True, default='', verbose_name='Error'), + ), + migrations.AlterField( + model_name='build', + name='output', + field=models.TextField(blank=True, default='', verbose_name='Output'), + ), + migrations.AlterField( + model_name='build', + name='state', + field=models.CharField(choices=[('triggered', 'Triggered'), ('cloning', 'Cloning'), ('installing', 'Installing'), ('building', 'Building'), ('finished', 'Finished')], default='finished', max_length=55, verbose_name='State'), + ), + migrations.AlterField( + model_name='build', + name='type', + field=models.CharField(choices=[('html', 'HTML'), ('pdf', 'PDF'), ('epub', 'Epub'), ('man', 'Manpage'), ('dash', 'Dash')], default='html', max_length=55, verbose_name='Type'), + ), + migrations.AlterField( + model_name='version', + name='privacy_level', + field=models.CharField(choices=[('public', 'Public'), ('protected', 'Protected'), ('private', 'Private')], default='public', help_text='Level of privacy for this Version.', max_length=20, verbose_name='Privacy Level'), + ), + migrations.AlterField( + model_name='version', + name='slug', + field=readthedocs.builds.version_slug.VersionSlugField(db_index=True, max_length=255, populate_from='verbose_name', verbose_name='Slug'), + ), + migrations.AlterField( + model_name='version', + name='type', + field=models.CharField(choices=[('branch', 'Branch'), ('tag', 'Tag'), ('unknown', 'Unknown')], default='unknown', max_length=20, verbose_name='Type'), + ), + migrations.DeleteModel( + name='VersionAlias', + ), + ]