Skip to content

Commit

Permalink
[#304] Remove unused field from networkgroup (#305)
Browse files Browse the repository at this point in the history
* [#304] Remove unused field from networkgroup

This removes three fields from `NetworkGroups`
- youtube_url
- wiki_url
- gplus_url

They were not used by any groups so it was decided that they can be
dropped

* Base new migration on newest old migration
  • Loading branch information
k-nut authored and pwalsh committed Jul 1, 2016
1 parent 54c2ff8 commit 1280f93
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 55 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('organisation', '0003_add_nowdoing_field'),
]

operations = [
migrations.RemoveField(
model_name='networkgroup',
name='gplus_url',
),
migrations.RemoveField(
model_name='networkgroup',
name='wiki_url',
),
migrations.RemoveField(
model_name='networkgroup',
name='youtube_url',
),
]
3 changes: 0 additions & 3 deletions foundation/organisation/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,6 @@ class NetworkGroup(models.Model):
homepage_url = models.URLField(blank=True)
twitter = models.CharField(max_length=18, blank=True)
facebook_url = models.URLField(blank=True)
youtube_url = models.URLField(blank=True)
gplus_url = models.URLField('Google+ url', blank=True)
wiki_url = models.URLField(blank=True)

position = GeopositionField(blank=True, null=True)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@ <h3>Connect</h3>
<a href="{{ object.homepage_url }}">{{ object.homepage_url }}</a>
</li>
{% endif %}
{% if object.wiki_url %}
<li>
<i class="fa fa-link fa-large"></i>
<a href="{{ object.wiki_url }}">Wiki page</a>
</li>
{% endif %}
{% if object.mailinglist_url %}
<li>
<i class="fa fa-envelope fa-large"></i>
Expand All @@ -61,22 +55,6 @@ <h3>Connect</h3>
</a>
</li>
{% endif %}
{% if object.gplus_url %}
<li>
<i class="fa fa-google-plus fa-large"></i>
<a href="{{ object.gplus_url }}">
Google+ page
</a>
</li>
{% endif %}
{% if object.youtube_url %}
<li>
<i class="fa fa-youtube fa-large"></i>
<a href="{{ object.youtube_url }}">
YouTube channel
</a>
</li>
{% endif %}
</ul>
{% if regional_groups %}
<h3>Our Regional Groups</h3>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@ <h3>
Facebook page
</a>
{% endif %}
{% if object.youtube_url %}
<i class="fa fa-youtube fa-large"></i>
<a href="{{ object.youtube_url }}">
YouTube channel
</a>
{% endif %}
</p>
</div>
</div>
1 change: 0 additions & 1 deletion foundation/organisation/tests/test_cms_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ def setUp(self): # flake8: noqa
homepage_url='http://queen.okfn.org/',
twitter='buckingham',
facebook_url='http://facebook.com/queenthepersonnottheband',
youtube_url='https://www.youtube.com/user/Queenovision'
)

self.germany = NetworkGroup.objects.create(
Expand Down
20 changes: 3 additions & 17 deletions foundation/organisation/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,6 @@ def setUp(self): # flake8: noqa
country='GB',
mailinglist_url='http://lists.okfn.org/okfn-britain',
homepage_url='http://gb.okfn.org/',
wiki_url='http://wiki.okfn.org/GodSaveTheQueen',
twitter='OKFNgb'
)

Expand All @@ -465,8 +464,6 @@ def setUp(self): # flake8: noqa
homepage_url='http://queen.okfn.org/',
twitter='buckingham',
facebook_url='http://facebook.com/queenthepersonnottheband',
youtube_url='https://www.youtube.com/user/Queenovision',
gplus_url='https://plus.google.com/+Intel',
)


Expand Down Expand Up @@ -546,13 +543,10 @@ def test_regional_group(self):

self.assertIn(self.buckingham.homepage_url, response.body)
self.assertNotIn(self.britain.homepage_url, response.body)
self.assertNotIn(self.britain.wiki_url, response.body)
self.assertNotIn(self.britain.mailinglist_url, response.body)
self.assertIn(self.buckingham.twitter, response.body)
self.assertNotIn(self.britain.twitter, response.body)
self.assertIn(self.buckingham.facebook_url, response.body)
self.assertIn(self.buckingham.youtube_url, response.body)
self.assertIn(self.buckingham.gplus_url, response.body)

self.assertIn(self.elizabeth.name, response.body)
self.assertIn(self.elizabeth_britain.title, response.body)
Expand Down Expand Up @@ -603,8 +597,7 @@ def test_csv_output(self):
# Headers need to be on a specific form
headers = ['ISO3', 'Country', 'Geo coordinates', 'Map location',
'Local Groups status', 'Community Leaders', 'Website',
'Wiki page', 'Mailing List', 'Twitter handle',
'Youtube channel', 'Facebook page', 'Google+ page']
'Mailing List', 'Twitter handle', 'Facebook page']
for group in WorkingGroup.objects.all():
headers.append('Topic: {0}'.format(group.name))

Expand All @@ -616,11 +609,8 @@ def test_csv_output(self):
'', '', self.germany.get_group_type_display(),
', '.join([m.name for m in self.germany.members.all()]),
self.germany.homepage_url,
self.germany.wiki_url,
self.germany.mailinglist_url,
self.germany.twitter, '', '',
self.germany.gplus_url, 'Y', 'Y']

self.germany.twitter, '', 'Y', 'Y']
self.assertEqual(germany, germany_data)

britain = csv.next()
Expand All @@ -629,11 +619,8 @@ def test_csv_output(self):
'', '', self.britain.get_group_type_display(),
', '.join([m.name for m in self.britain.members.all()]),
self.britain.homepage_url,
self.britain.wiki_url,
self.britain.mailinglist_url,
self.britain.twitter, '', '',
self.britain.gplus_url, '', 'Y']
#import pdb; pdb.set_trace()
self.britain.twitter, '', '', 'Y']
self.assertEqual(britain, britain_data)

buckingham = csv.next()
Expand All @@ -653,7 +640,6 @@ def test_csv_output(self):
self.buckingham.homepage_url,
self.buckingham.mailinglist_url,
self.buckingham.twitter,
self.buckingham.youtube_url,
self.buckingham.facebook_url, 'Y', '' '']

@override_settings(HUBOT_API_KEY='secretkey')
Expand Down
8 changes: 2 additions & 6 deletions foundation/organisation/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,7 @@ def networkgroup_csv_output(request):
writer = unicodecsv.writer(response)
header_row = ['ISO3', 'Country', 'Geo coordinates', 'Map location',
'Local Groups status', 'Community Leaders', 'Website',
'Wiki page', 'Mailing List', 'Twitter handle',
'Youtube channel', 'Facebook page', 'Google+ page']
'Mailing List', 'Twitter handle', 'Facebook page']

working_groups = []
for group in WorkingGroup.objects.all():
Expand All @@ -190,12 +189,9 @@ def networkgroup_csv_output(request):
u', '.join([member.name
for member in group.members.all()]), # Leaders
group.homepage_url, # Website
group.wiki_url if group.wiki_url else '',
group.mailinglist_url,
group.twitter if group.twitter else '',
group.youtube_url if group.youtube_url else '',
group.facebook_url,
group.gplus_url if group.gplus_url else '', ]
group.facebook_url]

# Find topics of working group
group_working_groups = [g.name for g in group.working_groups.all()]
Expand Down

0 comments on commit 1280f93

Please sign in to comment.