diff --git a/exhibition/api.py b/exhibition/api.py index 948a33d..4f3bc35 100644 --- a/exhibition/api.py +++ b/exhibition/api.py @@ -53,7 +53,7 @@ def post(self, request, *args, **kwargs): class ExhibitorInfoSerializer(I18nAwareModelSerializer): class Meta: model = ExhibitorInfo - fields = ('id', 'name', 'description', 'url', 'email', 'logo', 'key', 'lead_scanning_enabled') + fields = ('id', 'name', 'description', 'url', 'email', 'logo', 'key', 'lead_scanning_enabled', 'status') class ExhibitorInfoViewSet(viewsets.ReadOnlyModelViewSet): diff --git a/exhibition/forms.py b/exhibition/forms.py index 4a96f00..7c264dc 100644 --- a/exhibition/forms.py +++ b/exhibition/forms.py @@ -65,6 +65,7 @@ class Meta: 'allow_voucher_access', 'allow_lead_access', 'lead_scanning_scope_by_device', + 'status', ] labels = { 'name': _('Exhibitor name'), diff --git a/exhibition/models.py b/exhibition/models.py index dc44832..e27ca07 100644 --- a/exhibition/models.py +++ b/exhibition/models.py @@ -99,6 +99,17 @@ class ExhibitorInfo(models.Model): ) allow_voucher_access = models.BooleanField(default=False) allow_lead_access = models.BooleanField(default=False) + STATUS_CHOICES = ( + ('pending', _('Pending Approval')), + ('approved', _('Approved')), + ('rejected', _('Rejected')), + ) + status = models.CharField( + max_length=20, + choices=STATUS_CHOICES, + default='pending', + verbose_name=_('Status') + ) lead_scanning_scope_by_device = models.BooleanField(default=False) class Meta: diff --git a/exhibition/templates/exhibitors/add.html b/exhibition/templates/exhibitors/add.html index 093a303..f5da13e 100644 --- a/exhibition/templates/exhibitors/add.html +++ b/exhibition/templates/exhibitors/add.html @@ -49,8 +49,8 @@

- {% trans "Internal notes" %} - {% bootstrap_field form.comment layout="control" %} + {% trans "Status" %} + {% bootstrap_field form.status layout="control" %}
@@ -67,4 +67,22 @@

+ + {% endblock %} diff --git a/exhibition/templates/exhibitors/exhibitor_info.html b/exhibition/templates/exhibitors/exhibitor_info.html index a4b9cbe..b2a5d11 100644 --- a/exhibition/templates/exhibitors/exhibitor_info.html +++ b/exhibition/templates/exhibitors/exhibitor_info.html @@ -36,12 +36,17 @@

{% trans "Exhibitors" %}

{% for e in exhibitors %} - {% if "can_change_event_settings" in request.eventpermset %} {{ e.name }} + + {{ e.get_status_display }} + {% else %} {{ e.name }} + + {{ e.get_status_display }} + {% endif %} diff --git a/tests/test_main.py b/tests/test_main.py index 1973854..a86f9ed 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -31,6 +31,7 @@ def test_create_exhibitor_info(event): exhibitor.logo.name, ) assert exhibitor.lead_scanning_enabled is True + assert exhibitor.status == "pending" @pytest.mark.django_db