Permalink
Browse files

simplied the initial initialization

  • Loading branch information...
1 parent 7749ee8 commit 761ac224d4c61dee778f31159a88ae195a70dec0 @jefftriplett jefftriplett committed Jan 30, 2010
Showing with 4 additions and 8 deletions.
  1. +4 −8 django_proxy/signals.py
@@ -20,15 +20,11 @@ def __init__(self, instance, created=None):
model = self._get_proxy_model(instance)
self.proxy_model = model()
- if created:
+ try:
+ ctype = ContentType.objects.get_for_model(instance)
+ self.proxy_model = model._default_manager.get(object_id=instance.id, content_type=ctype)
+ except model.DoesNotExist:
self.proxy_model.content_object = instance
- else:
- try:
- ctype = ContentType.objects.get_for_model(instance)
- self.proxy_model = model._default_manager.get(object_id=instance.id, content_type=ctype)
- except model.DoesNotExist:
- self.proxy_model = model()
- self.proxy_model.content_object = instance
def _get_attr(self, attr, obj):
if hasattr(self.content_object.ProxyMeta, attr):

0 comments on commit 761ac22

Please sign in to comment.