Skip to content

Commit

Permalink
use cached properties #21
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelkuty committed Oct 20, 2015
1 parent 5a6800e commit 88e696b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions horizon_contrib/forms/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from django import http
from django.forms import models as model_forms
from django.utils.translation import ugettext_lazy as _
from django.utils.functional import cached_property
from django.views import generic
from horizon import exceptions
from horizon_contrib.common import content_type as ct
Expand Down Expand Up @@ -152,7 +153,7 @@ class ModelModalView(ModalFormView):

class ModelFormMixin(object):

@property
@cached_property
def object(self):

try:
Expand All @@ -161,10 +162,9 @@ def object(self):
raise e
return obj

@property
@cached_property
def model(self):
# TODO if not content_type FW find in our registry
# TODO cache or memonized
return ct.get_class(self.kwargs["cls_name"])

def get_form_class(self):
Expand Down

0 comments on commit 88e696b

Please sign in to comment.