Python django.apps.apps.cache_clear() Examples

The following are 6 code examples of django.apps.apps.cache_clear(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module django.apps.apps , or try the search function .
Example #1
Source File: options.py    From GTDWeb with GNU General Public License v2.0 6 votes vote down vote up
def _expire_cache(self, forward=True, reverse=True):
        # This method is usually called by apps.cache_clear(), when the
        # registry is finalized, or when a new field is added.
        properties_to_expire = []
        if forward:
            properties_to_expire.extend(self.FORWARD_PROPERTIES)
        if reverse and not self.abstract:
            properties_to_expire.extend(self.REVERSE_PROPERTIES)

        for cache_key in properties_to_expire:
            try:
                delattr(self, cache_key)
            except AttributeError:
                pass

        self._get_fields_cache = {} 
Example #2
Source File: options.py    From openhgsenti with Apache License 2.0 6 votes vote down vote up
def _expire_cache(self, forward=True, reverse=True):
        # This method is usually called by apps.cache_clear(), when the
        # registry is finalized, or when a new field is added.
        properties_to_expire = []
        if forward:
            properties_to_expire.extend(self.FORWARD_PROPERTIES)
        if reverse and not self.abstract:
            properties_to_expire.extend(self.REVERSE_PROPERTIES)

        for cache_key in properties_to_expire:
            try:
                delattr(self, cache_key)
            except AttributeError:
                pass

        self._get_fields_cache = {} 
Example #3
Source File: options.py    From bioforum with MIT License 5 votes vote down vote up
def _expire_cache(self, forward=True, reverse=True):
        # This method is usually called by apps.cache_clear(), when the
        # registry is finalized, or when a new field is added.
        if forward:
            for cache_key in self.FORWARD_PROPERTIES:
                if cache_key in self.__dict__:
                    delattr(self, cache_key)
        if reverse and not self.abstract:
            for cache_key in self.REVERSE_PROPERTIES:
                if cache_key in self.__dict__:
                    delattr(self, cache_key)
        self._get_fields_cache = {} 
Example #4
Source File: options.py    From Hands-On-Application-Development-with-PyCharm with MIT License 5 votes vote down vote up
def _expire_cache(self, forward=True, reverse=True):
        # This method is usually called by apps.cache_clear(), when the
        # registry is finalized, or when a new field is added.
        if forward:
            for cache_key in self.FORWARD_PROPERTIES:
                if cache_key in self.__dict__:
                    delattr(self, cache_key)
        if reverse and not self.abstract:
            for cache_key in self.REVERSE_PROPERTIES:
                if cache_key in self.__dict__:
                    delattr(self, cache_key)
        self._get_fields_cache = {} 
Example #5
Source File: options.py    From python with Apache License 2.0 5 votes vote down vote up
def _expire_cache(self, forward=True, reverse=True):
        # This method is usually called by apps.cache_clear(), when the
        # registry is finalized, or when a new field is added.
        if forward:
            for cache_key in self.FORWARD_PROPERTIES:
                if cache_key in self.__dict__:
                    delattr(self, cache_key)
        if reverse and not self.abstract:
            for cache_key in self.REVERSE_PROPERTIES:
                if cache_key in self.__dict__:
                    delattr(self, cache_key)
        self._get_fields_cache = {} 
Example #6
Source File: options.py    From python2017 with MIT License 5 votes vote down vote up
def _expire_cache(self, forward=True, reverse=True):
        # This method is usually called by apps.cache_clear(), when the
        # registry is finalized, or when a new field is added.
        if forward:
            for cache_key in self.FORWARD_PROPERTIES:
                if cache_key in self.__dict__:
                    delattr(self, cache_key)
        if reverse and not self.abstract:
            for cache_key in self.REVERSE_PROPERTIES:
                if cache_key in self.__dict__:
                    delattr(self, cache_key)
        self._get_fields_cache = {}