Repository: carpentries/amy

Issue:
Hide fee/invoice from event view
@elizabethwilliams8  is tracking all fees and invoices separately.  We do not need to track this in AMY.




Discussion:
@maneesha by "fee" do you mean "Admin fee" field?
Yes - "Admin fee" and "Invoice" can be hidden from view.
@maneesha do you want to hide "admin fee" from event add/edit form as well?

Resolving patch:
diff --git a/amy/api/serializers.py b/amy/api/serializers.py
--- a/amy/api/serializers.py
+++ b/amy/api/serializers.py
@@ -234,7 +234,7 @@ class Meta:
         model = Event
         fields = (
             'slug', 'completed', 'start', 'end', 'host', 'administrator',
-            'tags', 'website_url', 'reg_key', 'admin_fee', 'invoice_status',
+            'tags', 'website_url', 'reg_key',
             'attendance', 'contact', 'country', 'venue', 'address',
             'latitude', 'longitude', 'notes', 'tasks', 'assigned_to',
         )
diff --git a/amy/workshops/forms.py b/amy/workshops/forms.py
--- a/amy/workshops/forms.py
+++ b/amy/workshops/forms.py
@@ -376,9 +376,6 @@ class EventForm(forms.ModelForm):
         widget=ListSelect2(),
     )
 
-    admin_fee = forms.DecimalField(min_value=0, decimal_places=2,
-                                   required=False, widget=TextInput)
-
     helper = BootstrapHelper(add_cancel_button=False,
                              duplicate_buttons_on_top=True)
 
@@ -386,7 +383,7 @@ class Meta:
         model = Event
         fields = ('slug', 'completed', 'start', 'end', 'host', 'administrator',
                   'assigned_to', 'tags', 'url', 'language', 'reg_key', 'venue',
-                  'admin_fee', 'invoice_status', 'attendance', 'contact',
+                  'attendance', 'contact',
                   'notes', 'country', 'address', 'latitude', 'longitude',
                   'open_TTT_applications', 'curricula', )
         widgets = {
@@ -426,8 +423,6 @@ def __init__(self, *args, **kwargs):
             'url',
             'language',
             'reg_key',
-            'admin_fee',
-            'invoice_status',
             'attendance',
             'contact',
             'notes',


Test patch:
diff --git a/amy/workshops/tests/test_event.py b/amy/workshops/tests/test_event.py
--- a/amy/workshops/tests/test_event.py
+++ b/amy/workshops/tests/test_event.py
@@ -477,39 +477,35 @@ def test_start_date_gte_end_date(self):
         response = self.client.post(reverse('event_add'), data)
         assert response.status_code == 302
 
-    def test_negative_admin_fee_attendance(self):
-        """Ensure we disallow negative admin fee or attendance.
+    def test_negative_attendance(self):
+        """Ensure we disallow negative attendance.
 
         This is a regression test for
-        https://github.com/swcarpentry/amy/issues/435."""
+        https://github.com/swcarpentry/amy/issues/435.
+
+        Warning: this used to test `admin_fee` for negative value, but since
+        #1411 (https://github.com/swcarpentry/amy/pull/1411) we don't have
+        `admin_fee` in the form nor on Event Details page."""
         error_str = "Ensure this value is greater than or equal to 0."
 
         data = {
             'host': self.test_host.id,
             'tags': [self.test_tag.id],
             'slug': '2016-06-30-test-event',
-            'admin_fee': -1200,
+            'attendance': -36,
             'invoice_status': 'unknown',
         }
 
-        f = EventForm(data)
-        self.assertIn('admin_fee', f.errors)
-        self.assertIn(error_str, f.errors['admin_fee'])
-
-        del data['admin_fee']
         data['attendance'] = -36
         f = EventForm(data)
         self.assertIn('attendance', f.errors)
         self.assertIn(error_str, f.errors['attendance'])
 
-        data['admin_fee'] = 0
         data['attendance'] = 0
         f = EventForm(data)
-        self.assertNotIn('admin_fee', f.errors)
         self.assertNotIn('attendance', f.errors)
 
         data['slug'] = '2016-06-30-test-event2'
-        data['admin_fee'] = 1200
         data['attendance'] = 36
         f = EventForm(data)
         self.assertTrue(f.is_valid())