I think a custom middleware solution might work here? Just have a custom middleware run initially that adds the instance of your session class to the request object. I haven't tried anything like this before but it might work.
-Sid On Jul 14, 11:42 pm, "T.L" <tonyl7...@gmail.com> wrote: > So, I am using request.sessions in one of my views functions but I > want to add a few more fields to the Session class so it will be > customized for my project. When I tried to go to the Session class > (in django.contrib.sessions.models) and simply adding in an extra > field, and then adding it to my admin (I put the django_session table > to the admin), I got an error saying that attribute didnt exist. My > question is, where do I need to make changes so I can add my own > fields to the Session class. I also tried having another class > inherit the Session class and add fields to the inherited class but > the problem I had with that is I couldnt use request.inheritedClass > where inheritedClass is the class that inherited the Sessions class. > The error I received when I tried doing request.inheritedClass in one > of my views function was this: > 'WSGIRequest' object has no attribute 'inheritedClass'. > To sum it up, can anyone tell me some way to customize the Session > class to my liking? > > Thanks, > Tony -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.