urlconf не используется для соответствия параметрам request.GET вашего URL.Вы делаете это в представлении.
вы либо хотите, чтобы ваши URL выглядели так:
http://localhost:8000/toggle_fave/7/
, и сопоставьте его, используя:
url(r'^toggle_fave/(?P<post_id>\d+)/$', 'core.views.toggle_fave', name="toggle_fave"),
с вашим представлением, котороевыглядит так:
def toggle_fave(request, post_id):
post = get_object_or_404(Post, pk=post_id)
...
или
http://localhost:8000/toggle_fave/?post_id=7
и ваши urls.py:
url(r'^toggle_fave/$', 'core.views.toggle_fave', name="toggle_fave"),
и views.py:
def toggle_fave(request):
post_id = request.GET.get('post_id', '')
if post_id:
post = get_object_or_404(Post, pk=post_id)
...