Reputation: 1028
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.
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
<form enctype="multipart/form-data" id="JobOfferForm" action="" method="POST">
{% csrf_token %}
<div class="row">
<div class="input-field col s12">
<p class="grey-text">Ville</p>
{{ jobOfferForm.city }}
</div>
</div>
<button class="btn waves-effect waves-light" name="jobOfferFormOK" type="submit">Sauvegarder</button>
</form>
Thanks in advance.
Upvotes: 0
Views: 478
Reputation: 1028
I have figured it out!
I forgot to include a check_auth
method in my CityLookup
, so it worked only for staff users... I should have read the documentation better.
def check_auth(self, request):
if not request.user.is_authenticated() or not request.user.has_beta_access:
raise PermissionDenied
Now it works!
Upvotes: 1