Skip to content

Instantly share code, notes, and snippets.

View benjaminws's full-sized avatar

Benjamin W. Smith benjaminws

View GitHub Profile
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