Parcourir la source

Remove bandwidth and share_part fields

fix #3
Jocelyn Delande il y a 9 ans
Parent
commit
bf1b8e5fd0

+ 1 - 1
wifiwithme/apps/contribmap/admin.py

@@ -31,7 +31,7 @@ class ContribAdmin(admin.ModelAdmin):
             'classes': ['collapse'],
         }],
         ['Partage de connexion', {
-            'fields': ['access_type', 'bandwidth', 'share_part'],
+            'fields': ['access_type'],
             'classes': ['collapse'],
         }],
         ['Vie privée', {

+ 2 - 2
wifiwithme/apps/contribmap/fixtures/bottle_data.yaml

@@ -2,13 +2,13 @@
   pk: 1
   fields: {name: Bill, contrib_type: share, latitude: 47.218371, longitude: -1.553621,
     phone: '', email: a@example.com, access_type: fiber, connect_local: false, connect_internet: false,
-    bandwidth: 3.0, share_part: 2.0, floor: null, floor_total: null, orientations: 'N,NO,O,SO,S,SE,E,NE',
+     floor: null, floor_total: null, orientations: 'N,NO,O,SO,S,SE,E,NE',
     roof: false, comment: '', privacy_name: false, privacy_email: false, privacy_coordinates: true,
     privacy_place_details: true, privacy_comment: false, date: ! '2016-03-03 12:26:39+00:00'}
 - model: contribmap.contrib
   pk: 2
   fields: {name: veau, contrib_type: connect, latitude: 47.2195681123155, longitude: -1.5398025512695312,
     phone: '0101010101', email: '', access_type: vdsl, connect_local: true, connect_internet: false,
-    bandwidth: null, share_part: null, floor: 1, floor_total: 2, orientations: 'N,NO',
+    floor: 1, floor_total: 2, orientations: 'N,NO',
     roof: false, comment: '', privacy_name: false, privacy_email: false, privacy_coordinates: false,
     privacy_place_details: false, privacy_comment: false, date: ! '2016-03-03 12:27:24+00:00'}

+ 2 - 4
wifiwithme/apps/contribmap/forms.py

@@ -26,7 +26,6 @@ class PublicContribForm(forms.ModelForm):
             'comment',
             'access_type',
             'connect_local', 'connect_internet',
-            'bandwidth', 'share_part',
             'floor', 'floor_total', 'orientations', 'roof',
             'comment',
             'privacy_name', 'privacy_email', 'privacy_coordinates',
@@ -71,9 +70,8 @@ class PublicContribForm(forms.ModelForm):
 
     def _validate_share_fields(self, data):
         if data.get('contrib_type') == Contrib.CONTRIB_SHARE:
-            for required_field in ('access_type', 'bandwidth', 'share_part'):
-                if data.get(required_field, '') is None:
-                    self.add_error(required_field, 'Ce champ est requis')
+            if data.get('access_type') == '':
+                self.add_error('access_type', 'Ce champ est requis')
 
     def clean(self):
         cleaned_data = super().clean()

+ 23 - 0
wifiwithme/apps/contribmap/migrations/0013_auto_20160515_1036.py

@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.3 on 2016-05-15 10:36
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('contribmap', '0012_auto_20160510_2335'),
+    ]
+
+    operations = [
+        migrations.RemoveField(
+            model_name='contrib',
+            name='bandwidth',
+        ),
+        migrations.RemoveField(
+            model_name='contrib',
+            name='share_part',
+        ),
+    ]

+ 0 - 6
wifiwithme/apps/contribmap/models.py

@@ -42,12 +42,6 @@ class Contrib(models.Model):
     connect_internet = models.NullBooleanField(
         'Services locaux',
         default=False, null=True)
-    bandwidth = models.FloatField(
-        'débit total',
-        blank=True, null=True)
-    share_part = models.FloatField(
-        'débit partagé',
-        blank=True, null=True)
     floor = models.PositiveIntegerField(
         'étage',
         blank=True, null=True)

+ 0 - 17
wifiwithme/apps/contribmap/templates/contribmap/wifi-form.html

@@ -85,23 +85,6 @@ pourraient être intéressantes.
     </div>
 
     {{ form.access_type.errors }}
-
-    <h3>Débits</h3>
-    <p class="help-block">
-      Il est possible de limiter techniquement la quantité de bande passante
-    partagée avec les autres expérimentateurs afin de ne pas pénaliser votre
-    confort.
-    </p>
-    <p>
-      <label for="bandwidth">Débit total</label><br />
-      {{ form.bandwidth|formcontrol }}
-      {{ form.bandwidth.errors }}
-    </p>
-    <p>
-      <label for="share-part">Je souhaite partager (au max.)</label><br />
-      {{ form.share_part|formcontrol }}
-      {{ form.share_part.errors }}
-    </p>
     </div>
 
     <div id="contrib-type-connect">

+ 0 - 4
wifiwithme/apps/contribmap/tests.py

@@ -198,10 +198,6 @@ class TestForms(TestCase):
 
         self.assertFalse(PublicContribForm(data).is_valid())
         data['access_type'] = 'cable'
-        self.assertFalse(PublicContribForm(data).is_valid())
-        data['bandwidth'] = 12
-        self.assertFalse(PublicContribForm(data).is_valid())
-        data['share_part'] = 5
         self.assertTrue(PublicContribForm(data).is_valid())