1. Jesús Espino
  2. django-visits
Issue #1 resolved

app_label and middleware

Anonymous created an issue

Hi Jesus,

Just tried your neat app. .. and got an error. "add_uri_visit() takes exactly 4 arguments (3 given)" line 11.

The reason is simple: app_label is not submitted by CounterMiddleware.

Good luck!

Aiia

Comments (4)

  1. fredsmith5473894

    What I did was add the string "visits" in middleware.py which is just the name of this app. I'm pretty sure that is what it is supposed to be but not sure if this is the most correct way to do it.

    def process_request(self, request):
            if settings.URI_WITH_GET_PARAMS:
                Visit.objects.add_uri_visit(request, request.get_full_path(), "visits")
            else:
                Visit.objects.add_uri_visit(request, request.path_info, "visits")
    
  2. Joe Willrich Lutalo

    Sorry took this long to update this issue's status, but we fixed this a while back. Check now.

    fredsmith5473894 , no, setting app_name param to visits would assume that each object-uri request being served is for an object belonging to the "visits" Django app, which isn't necessarily true! So, check the new way this is done in middleware.py, or better, pull the latest build.

    Thanks.

  3. Log in to comment