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

Add a flag for marking a project ad-free #4313

Merged
merged 2 commits into from
Jul 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
20 changes: 20 additions & 0 deletions readthedocs/projects/migrations/0026_ad-free-option.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2018-06-29 15:53
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('projects', '0025_show-version-warning-existing-projects'),
]

operations = [
migrations.AddField(
model_name='project',
name='ad_free',
field=models.BooleanField(default=False, help_text='If checked, do not show advertising for this project', verbose_name='Ad-free'),
),
]
5 changes: 5 additions & 0 deletions readthedocs/projects/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ class Project(models.Model):
allow_promos = models.BooleanField(
_('Allow paid advertising'), default=True, help_text=_(
'If unchecked, users will still see community ads.'))
ad_free = models.BooleanField(
_('Ad-free'),
default=False,
help_text='If checked, do not show advertising for this project',
)
show_version_warning = models.BooleanField(
_('Show version warning'), default=False,
help_text=_('Show warning banner in non-stable nor latest versions.')
Expand Down
1 change: 1 addition & 0 deletions readthedocs/restapi/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class Meta(ProjectSerializer.Meta):
'features',
'has_valid_clone',
'has_valid_webhook',
'ad_free',
)


Expand Down
1 change: 1 addition & 0 deletions readthedocs/rtd_tests/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,7 @@ def test_get_version_by_id(self):
'id': 18,
'active': True,
'project': {
'ad_free': False,
'analytics_code': None,
'canonical_url': 'http://readthedocs.org/docs/pip/en/latest/',
'cdn_enabled': False,
Expand Down