Wednesday, May 18, 2016

Why not working exampe from Django docs

https://docs.djangoproject.com/en/1.9/topics/http/sessions/#example

from django.contrib.sessions.backends.db import SessionStore as DBStore  from django.contrib.sessions.base_session import AbstractBaseSession  from django.db import models    class CustomSession(AbstractBaseSession):      account_id = models.IntegerField(null=True, db_index=True)        class Meta:          app_label = 'mysessions'        @classmethod      def get_session_store_class(cls):          return SessionStore    class SessionStore(DBStore):      @classmethod      def get_model_class(cls):          return CustomSession        def create_model_instance(self, data):          obj = super(SessionStore, self).create_model_instance(data)          try:              account_id = int(data.get('_auth_user_id'))          except (ValueError, TypeError):              account_id = None          obj.account_id = account_id          return obj

In settings registered as next:

SESSION_ENGINE = 'apps.app_sessions.backends.extended_session_store'


When I made attempt create migrations, Django - silent

In [6]: !./manage.py makemigrations  No changes detected

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/66583aa8-0e69-4590-9420-6db734267ec6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment