Вопрос

I'm using django-voting: https://github.com/brosner/django-voting/tree/master/voting And after my post, I'm redirected here: http://www.iana.org/domains/example/#c40

<form method="POST" action="/comments/{{ comment.id }}/up/vote/">
     {% csrf_token %}
     <button type="submit">Thumbs Up!</button>
</form>

The vote is created and I can see it in the admin.

No where in my application do I have this kind of redirect. Nor can I find this line of code in django-voting where it would have this redirect. Has this happened to anyone else, if so how'd you solve this?

I just want to be redirected the same page after the casted the vote. So I tried <input type="hidden" name="next" value="{{ event.get_absolute_url }}" /> thinking that it might override. But this doesn't seem to work. Suggestions?

Это было полезно?

Решение

I'm guessing that somewhere in your logic you redirect to "example.com". example.com is owned by the IANA and redirects to http://www.iana.org/domains/example/.

Also, the "#c40" at the end of the url makes me think that Django is trying to redirect back to some page with a c40 anchor, possibly in order to have the thing you just voted on in view.

Другие советы

Are you using the Sites framework? (Do you have a Sites model in your admin?) If yes, this may be due to having an instance of a Site model with the domain name "example.org" which is the default.

Furthermore, there may be a fixture that reloads 'example.org' into the Sites each time you do something with the database, such as a migration with South, for example.

That redirect happens when you hit one of the example domains, listed in RFC 2606.

There's something somewhere in your code that's pushing to example.com or another one of the example domains.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top