[Fixed]-Django session loses complex object in production, but not in dev

1๐Ÿ‘

โœ…

OK, so as Daniel pointed out, the attributes of the SSC class were class-level instead of instance level. The correct version looks like this now:

    self.created = datetime.datetime.now()
    self.key = ''.join(random.SystemRandom().choice(string.ascii_uppercase + string.digits) for _ in range(6))
    self.jurisdictions = []
    self.taxa = []
    self.strata = []
    self.collections = []
    self.chrons = []
    self.has_images = False

    self.query = None  # The active SQL query, not the actual result records
    self.page_size = 50
    self.current_page = 1
    self.sort_order = 'number'
    self.results = []  # Page of results from paginator
๐Ÿ‘คTomislav Urban

Leave a comment