django-ajax-selects

Django 403 forbidden error ajax (with csrf token) GET

半世苍凉 提交于 2019-12-12 04:06:01
问题 I'm using django-ajax-selects to select a city from my database. When typing in the field, I get a 403 error (GET method). Here's the catch, it worked yesterday, and I didn't touch anything relevant. Console log Forbidden (Permission denied): /lookups/ajax_lookup/city [30/Jan/2016 15:54:01]"GET /lookups/ajax_lookup/city?term=Lyon HTTP/1.1" 403 22 My form <form enctype="multipart/form-data" id="JobOfferForm" action="" method="POST"> {% csrf_token %} <div class="row"> <div class="input-field

How to get Django-Ajax-Selects to work in Django Admin?

天涯浪子 提交于 2019-12-11 02:55:31
问题 Django Ajax Selects Here's what I did, to no avail: Added ajax_select to my INSTALLED_APPS in settings.py Added (r'ajax_select', include('ajax_select.urls')), to urls.py Added this to settings.py : AJAX_LOOKUP_CHANNELS = { 'postal_code': {'model': 'places.PostalCode', 'search_field': 'code'} } Added this to admin.py : class AddressAdmin(admin.ModelAdmin): form = make_ajax_form(Address, {'postal_code':'postal_code'}) admin.site.register(Address, AddressAdmin) When I tried viewing the relevant

django-ajax-selects app: How do I create a new object when there isn't already one in the database?

☆樱花仙子☆ 提交于 2019-12-07 15:22:27
问题 I'm using django-ajax-selects, which is a freely available django app providing jquery autocomplete functionality. I've got it working - i.e. it is autocompleting the form fields I want it to. But I have a problem... I'm using it in a ModelForm which adds Partnership objects to the database: class Skater(models.Model): name = models.CharField(max_length=64) surname = models.CharField(max_length=64) gender = models.CharField(max_length=1, choices=GENDER_CHOICES) class Partnership(models.Model)

django-ajax-selects app: How do I create a new object when there isn't already one in the database?

孤街醉人 提交于 2019-12-05 21:07:11
I'm using django-ajax-selects , which is a freely available django app providing jquery autocomplete functionality. I've got it working - i.e. it is autocompleting the form fields I want it to. But I have a problem... I'm using it in a ModelForm which adds Partnership objects to the database: class Skater(models.Model): name = models.CharField(max_length=64) surname = models.CharField(max_length=64) gender = models.CharField(max_length=1, choices=GENDER_CHOICES) class Partnership(models.Model): female_partner = models.ForeignKey(Skater, limit_choices_to = {'gender': FEMALE}, related_name=