diff --git a/passbook/core/api/applications.py b/passbook/core/api/applications.py index 9e4930c46..f0b4c69e2 100644 --- a/passbook/core/api/applications.py +++ b/passbook/core/api/applications.py @@ -15,11 +15,13 @@ class ApplicationSerializer(ModelSerializer): "pk", "name", "slug", - "launch_url", - "icon_url", - "provider", - "policies", "skip_authorization", + "provider", + "meta_launch_url", + "meta_icon_url", + "meta_description", + "meta_publisher", + "policies", ] diff --git a/passbook/core/forms/applications.py b/passbook/core/forms/applications.py index 0d6756585..4ed05137c 100644 --- a/passbook/core/forms/applications.py +++ b/passbook/core/forms/applications.py @@ -19,19 +19,23 @@ class ApplicationForm(forms.ModelForm): fields = [ "name", "slug", - "launch_url", - "icon_url", - "provider", - "policies", "skip_authorization", + "provider", + "meta_launch_url", + "meta_icon_url", + "meta_description", + "meta_publisher", + "policies", ] widgets = { "name": forms.TextInput(), - "launch_url": forms.TextInput(), - "icon_url": forms.TextInput(), + "meta_launch_url": forms.TextInput(), + "meta_icon_url": forms.TextInput(), + "meta_publisher": forms.TextInput(), "policies": FilteredSelectMultiple(_("policies"), False), } labels = { - "launch_url": _("Launch URL"), - "icon_url": _("Icon URL"), + "meta_launch_url": _("Launch URL"), + "meta_icon_url": _("Icon URL"), } + help_texts = {"policies": _("Policies required to access this Application.")} diff --git a/passbook/core/migrations/0008_auto_20200220_1242.py b/passbook/core/migrations/0008_auto_20200220_1242.py new file mode 100644 index 000000000..fe35fffe1 --- /dev/null +++ b/passbook/core/migrations/0008_auto_20200220_1242.py @@ -0,0 +1,29 @@ +# Generated by Django 3.0.3 on 2020-02-20 12:42 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("passbook_core", "0007_auto_20200217_1934"), + ] + + operations = [ + migrations.RenameField( + model_name="application", old_name="icon_url", new_name="meta_icon_url", + ), + migrations.RenameField( + model_name="application", old_name="launch_url", new_name="meta_launch_url", + ), + migrations.AddField( + model_name="application", + name="meta_description", + field=models.TextField(blank=True, null=True), + ), + migrations.AddField( + model_name="application", + name="meta_publisher", + field=models.TextField(blank=True, null=True), + ), + ] diff --git a/passbook/core/models.py b/passbook/core/models.py index bcd00b43b..1d718a6f7 100644 --- a/passbook/core/models.py +++ b/passbook/core/models.py @@ -143,16 +143,19 @@ class Application(ExportModelOperationsMixin("application"), PolicyModel): name = models.TextField() slug = models.SlugField() - launch_url = models.URLField(null=True, blank=True) - icon_url = models.TextField(null=True, blank=True) + skip_authorization = models.BooleanField(default=False) provider = models.OneToOneField( "Provider", null=True, blank=True, default=None, on_delete=models.SET_DEFAULT ) - skip_authorization = models.BooleanField(default=False) + + meta_launch_url = models.URLField(null=True, blank=True) + meta_icon_url = models.TextField(null=True, blank=True) + meta_description = models.TextField(null=True, blank=True) + meta_publisher = models.TextField(null=True, blank=True) objects = InheritanceManager() - def get_provider(self): + def get_provider(self) -> Optional[Provider]: """Get casted provider instance""" if not self.provider: return None @@ -167,6 +170,7 @@ class Source(ExportModelOperationsMixin("source"), PolicyModel): name = models.TextField() slug = models.SlugField() + enabled = models.BooleanField(default=True) property_mappings = models.ManyToManyField( "PropertyMapping", default=None, blank=True