Repository: pretix/pretix

Issue:
Hidden payment Links not working after event slug change

Just trying to allow Manual Payments and use the Hidden Link but get the below error in the browser Pretix installed on Debian 10 running as a container on Proxmox:

I'm afraid we could not find the the resource you requested.

The selected event was not found.

Take a step back

And lots of entries in syslog

gunicorn[93]: WARNING 2020-09-28 18:23:24,626 django.request log Not Found:
Hidden payment Links not working after event slug change

Just trying to allow Manual Payments and use the Hidden Link but get the below error in the browser Pretix installed on Debian 10 running as a container on Proxmox:

I'm afraid we could not find the the resource you requested.

The selected event was not found.

Take a step back

And lots of entries in syslog

gunicorn[93]: WARNING 2020-09-28 18:23:24,626 django.request log Not Found:


Discussion:
Can you post the full link (without domain and secret)?

> The selected event was not found.

looks like a non-existing event slug in the URL
Yes it has an old event slug in the URL is there a way to correct as it would appear to have not updated when I changed the slug. 

I recreated a new event and it had the correct slug and worked. 
On further testing when cloning an event or copying into a new event the slug does not update the hidden link.
Can you post the full link (without domain and secret)?

> The selected event was not found.

looks like a non-existing event slug in the URL
Yes it has an old event slug in the URL is there a way to correct as it would appear to have not updated when I changed the slug. 

I recreated a new event and it had the correct slug and worked. 
On further testing when cloning an event or copying into a new event the slug does not update the hidden link.

Resolving patch:
diff --git a/src/pretix/base/migrations/0170_remove_hidden_urls.py b/src/pretix/base/migrations/0170_remove_hidden_urls.py
new file mode 100644
--- /dev/null
+++ b/src/pretix/base/migrations/0170_remove_hidden_urls.py
@@ -0,0 +1,20 @@
+# Generated by Django 3.0.9 on 2020-11-23 15:51
+
+from django.db import migrations
+
+
+def remove_old_settings(app, schema_editor):
+    EventSettingsStore = app.get_model('pretixbase', 'Event_SettingsStore')
+
+    EventSettingsStore.objects.filter(key__startswith='payment_', key__endswith='__hidden_url').delete()
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('pretixbase', '0169_checkinlist_gates'),
+    ]
+
+    operations = [
+        migrations.RunPython(remove_old_settings, migrations.RunPython.noop)
+    ]
diff --git a/src/pretix/control/forms/event.py b/src/pretix/control/forms/event.py
--- a/src/pretix/control/forms/event.py
+++ b/src/pretix/control/forms/event.py
@@ -657,6 +657,8 @@ def clean(self):
         enabled = cleaned_data.get(self.settingspref + '_enabled')
         if not enabled:
             return
+        if cleaned_data.get(self.settingspref + '_hidden_url', None):
+            cleaned_data[self.settingspref + '_hidden_url'] = None
         for k, v in self.fields.items():
             val = cleaned_data.get(k)
             if v._required and not val:


Test patch: