Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused project model fields #4870

Merged
merged 21 commits into from
Dec 4, 2018
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion readthedocs/projects/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class ProjectAdmin(GuardedModelAdmin):
"""Project model admin view."""

prepopulated_fields = {'slug': ('name',)}
list_display = ('name', 'slug', 'repo', 'repo_type', 'featured', 'theme')
list_display = ('name', 'slug', 'repo', 'repo_type', 'featured')
list_filter = ('repo_type', 'featured', 'privacy_level',
'documentation_type', 'programming_language',
ProjectOwnerBannedFilter)
Expand Down
14 changes: 0 additions & 14 deletions readthedocs/projects/fixtures/test_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"description": "",
"project_url": "",
"repo": "https://github.com/rtfd/readthedocs.org",
"version": "0.1",
"users": [
1
],
Expand All @@ -24,7 +23,6 @@
"description": "",
"project_url": "",
"repo": "https://github.com/alex/django-taggit",
"version": "0.8",
"users": [
1
],
Expand All @@ -41,7 +39,6 @@
"description": "",
"project_url": "",
"repo": "https://github.com/pypa/pip",
"version": "",
"users": [
1
],
Expand All @@ -58,7 +55,6 @@
"description": "Awesome forms!",
"project_url": "",
"repo": "https://github.com/pydanny/django-uni-form",
"version": "0.7",
"users": [
1
],
Expand All @@ -75,7 +71,6 @@
"description": "OMG API!",
"project_url": "",
"repo": "http://github.com/codysoyland/django-tastypie",
"version": "0.8.2",
"users": [
1
],
Expand All @@ -92,7 +87,6 @@
"description": "ZOMG HE'S COMING?!",
"project_url": "",
"repo": "https://github.com/ericholscher/django-kong",
"version": "0.1",
"users": [
1
],
Expand All @@ -109,7 +103,6 @@
"description": "",
"project_url": "",
"repo": "https://github.com/worldcompany/djangoembed",
"version": "",
"users": [
1
],
Expand All @@ -126,7 +119,6 @@
"description": "",
"project_url": "",
"repo": "http://github.com/dmishe/django-south",
"version": "0.7",
"users": [
1
],
Expand All @@ -143,7 +135,6 @@
"description": "",
"project_url": "",
"repo": "https://github.com/fabric/fabric",
"version": "0.1.0",
"users": [
1
],
Expand All @@ -160,7 +151,6 @@
"description": "",
"project_url": "",
"repo": "http://github.com/coleifer/cue.git",
"version": "0.1.0",
"users": [
1
],
Expand All @@ -177,7 +167,6 @@
"description": "Awesome",
"project_url": "",
"repo": "http://github.com/pinax/pinax",
"version": "0.9",
"users": [
1
],
Expand All @@ -194,7 +183,6 @@
"description": "",
"project_url": "",
"repo": "https://github.com/ericholscher/django-test-utils",
"version": "0.2",
"users": [
1
],
Expand Down Expand Up @@ -294,7 +282,6 @@
"description": "Awesome docs",
"project_url": "",
"repo": "https://github.com/toastdriven/django-haystack",
"version": "1.1.0",
"users": [
1
],
Expand All @@ -311,7 +298,6 @@
"description": "",
"project_url": "",
"repo": "https://github.com/bogususer/non-existing-repo",
"version": "",
"pub_date": "2014-09-10 11:58:01",
"slug": "test_project",
"name": "test_project"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-11-05 12:20
from __future__ import unicode_literals

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('projects', '0030_change-max-length-project-slug'),
]

operations = [
migrations.RemoveField(
model_name='project',
name='copyright',
),
migrations.RemoveField(
model_name='project',
name='django_packages_url',
),
migrations.RemoveField(
model_name='project',
name='mirror',
),
migrations.RemoveField(
model_name='project',
name='num_major',
),
migrations.RemoveField(
model_name='project',
name='num_minor',
),
migrations.RemoveField(
model_name='project',
name='num_point',
),
migrations.RemoveField(
model_name='project',
name='suffix',
),
migrations.RemoveField(
model_name='project',
name='theme',
),
migrations.RemoveField(
model_name='project',
name='version',
),
]
38 changes: 0 additions & 38 deletions readthedocs/projects/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,6 @@ class Project(models.Model):
help_text=_('The project\'s homepage'))
canonical_url = models.URLField(_('Canonical URL'), blank=True,
help_text=_('URL that documentation is expected to serve from'))
version = models.CharField(_('Version'), max_length=100, blank=True,
help_text=_('Project version these docs apply '
'to, i.e. 1.0a'))
copyright = models.CharField(_('Copyright'), max_length=255, blank=True,
help_text=_('Project copyright information'))
theme = models.CharField(
_('Theme'), max_length=20, choices=constants.DEFAULT_THEME_CHOICES,
default=constants.THEME_DEFAULT,
help_text=(u'<a href="http://sphinx.pocoo.org/theming.html#builtin-'
'themes" target="_blank">%s</a>') % _('Examples'))
suffix = models.CharField(_('Suffix'), max_length=10, editable=False,
default='.rst')
single_version = models.BooleanField(
_('Single version'), default=False,
help_text=_('A single version site has no translations and only your '
Expand Down Expand Up @@ -189,7 +177,6 @@ class Project(models.Model):

featured = models.BooleanField(_('Featured'), default=False)
skip = models.BooleanField(_('Skip'), default=False)
mirror = models.BooleanField(_('Mirror'), default=False)
install_project = models.BooleanField(
_('Install Project'),
help_text=_('Install your project inside a virtualenv using <code>setup.py '
Expand All @@ -213,8 +200,6 @@ class Project(models.Model):
'site-packages dir.'),
default=False
)
django_packages_url = models.CharField(_('Django Packages URL'),
max_length=255, blank=True)
privacy_level = models.CharField(
_('Privacy Level'), max_length=20, choices=constants.PRIVACY_CHOICES,
default=getattr(settings, 'DEFAULT_PRIVACY_LEVEL', 'public'),
Expand Down Expand Up @@ -252,29 +237,6 @@ class Project(models.Model):
on_delete=models.SET_NULL,
blank=True, null=True)

# Version State
num_major = models.IntegerField(
_('Number of Major versions'),
default=2,
null=True,
blank=True,
help_text=_('2 means supporting 3.X.X and 2.X.X, but not 1.X.X')
)
num_minor = models.IntegerField(
_('Number of Minor versions'),
default=2,
null=True,
blank=True,
help_text=_('2 means supporting 2.2.X and 2.1.X, but not 2.0.X')
)
num_point = models.IntegerField(
_('Number of Point versions'),
default=2,
null=True,
blank=True,
help_text=_('2 means supporting 2.2.2 and 2.2.1, but not 2.2.0')
)

has_valid_webhook = models.BooleanField(
default=False, help_text=_('This project has been built with a webhook')
)
Expand Down
1 change: 0 additions & 1 deletion readthedocs/restapi/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ class Meta(ProjectSerializer.Meta):
'container_time_limit',
'install_project',
'use_system_packages',
'suffix',
'skip',
'requirements_file',
'python_interpreter',
Expand Down
23 changes: 0 additions & 23 deletions readthedocs/restapi/views/model_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,29 +94,6 @@ class ProjectViewSet(UserSelectViewSet):
pagination_class = api_utils.ProjectPagination
filter_fields = ('slug',)

@decorators.detail_route()
def valid_versions(self, request, **kwargs):
dojutsu-user marked this conversation as resolved.
Show resolved Hide resolved
"""Maintain state of versions that are wanted."""
project = get_object_or_404(
Project.objects.api(request.user), pk=kwargs['pk'])
if (not project.num_major or not project.num_minor or
not project.num_point):
return Response(
{
'error': 'Project does not support point version control',
},
status=status.HTTP_400_BAD_REQUEST,
)
version_strings = project.supported_versions()
# Disable making old versions inactive for now.
# project.versions.exclude(verbose_name__in=version_strings).update(active=False)
project.versions.filter(verbose_name__in=version_strings).update(
active=True,
)
return Response({
'flat': version_strings,
})

@detail_route()
def translations(self, *_, **__):
translations = self.get_object().translations.all()
Expand Down
7 changes: 1 addition & 6 deletions readthedocs/rtd_tests/mocks/mock_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,9 @@ def get(self, **kwargs):
{
"absolute_url": "/projects/docs/",
"analytics_code": "",
"copyright": "",
"default_branch": "",
"default_version": "latest",
"description": "Make docs.readthedocs.org work :D",
"django_packages_url": "",
"documentation_type": "sphinx",
"id": "2599",
"modified_date": "2012-03-12T19:59:09.130773",
Expand All @@ -60,13 +58,10 @@ def get(self, **kwargs):
"requirements_file": "",
"resource_uri": "/api/v1/project/2599/",
"slug": "docs",
"suffix": ".rst",
"theme": "default",
"install_project": false,
"users": [
"/api/v1/user/1/"
],
"version": ""
]
}""")
version['project'] = project
project['repo'] = repo
Expand Down
1 change: 0 additions & 1 deletion readthedocs/rtd_tests/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1076,7 +1076,6 @@ def test_get_version_by_id(self):
'show_advertising': True,
'skip': False,
'slug': 'pip',
'suffix': '.rst',
'use_system_packages': False,
'users': [1],
},
Expand Down
7 changes: 0 additions & 7 deletions readthedocs/rtd_tests/tests/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,6 @@ def setUp(self):

class TestProject(ProjectMixin, TestCase):

def test_valid_versions(self):
dojutsu-user marked this conversation as resolved.
Show resolved Hide resolved
r = self.client.get('/api/v2/project/6/valid_versions/', {})
resp = json.loads(r.content)
self.assertEqual(r.status_code, 200)
self.assertEqual(resp['flat'][0], '0.8')
self.assertEqual(resp['flat'][1], '0.8.1')

def test_subprojects(self):
r = self.client.get('/api/v2/project/6/subprojects/', {})
resp = json.loads(r.content)
Expand Down