Skip to content

Instantly share code, notes, and snippets.

Created December 26, 2012 05:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/4378211 to your computer and use it in GitHub Desktop.
Save anonymous/4378211 to your computer and use it in GitHub Desktop.
Stateless Django
from base import BaseImmutable
class ImmutableModel(BaseImmutable):
def __init__(self, django_model):
temp_dict = {}
for field in django_model._meta.fields:
temp_dict[field.name] = getattr(django_model,field.name)
self.__dict__ = temp_dict
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment