>
> Ok, well I've solved my immediate problem but clearly need to learn more
> about JavaScript, jQuery and CSRF tokens.
>
But for anyone with a similar URL issue, I did the following;
Added an appname setting to my urls.py
appname = 'shopfront'
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^launch_app/$', views.launch_app, name='launch'),
]
Modified the $.post function to use the URL name mapping which as I
expected meant I now have single function for handling the application
launch.
{% for my_apps in my_apps_list %}
<button type="button" id="app{{ forloop.counter }}">{{ my_apps.app_name }}</
button><br><br>
<script>
$("#app{{ forloop.counter }}").click( function() {
$.post("{% url 'launch' %}", {appname: '{{ my_apps.app_name }}'}, function
() {});
});
</script>
{% endfor %}
Initially this moved me onto CSRF token errors but having temporarily
> disabled this, my function has been executed. Onto the next issue....CSRF
> tokens......
>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/82055563-01b3-4f46-a519-a1c5e15a1006%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.