Drop media_data_table property.

Only when creating a new media_data row, we need the table.
So load that locally in media_data_init().
This commit is contained in:
Elrond 2013-02-01 16:33:53 +01:00
parent 1f268deda4
commit 139c6c099f

View File

@ -213,9 +213,10 @@ class MediaEntry(Base, MediaEntryMixin):
media_data = self.media_data
if media_data is None:
# Get the correct table:
table = import_component(self.media_type + '.models:DATA_MODEL')
# No media data, so actually add a new one
media_data = self.media_data_table(
**kwargs)
media_data = table(**kwargs)
# Get the relationship set up.
media_data.get_media_entry = self
else:
@ -223,10 +224,6 @@ class MediaEntry(Base, MediaEntryMixin):
for field, value in kwargs.iteritems():
setattr(media_data, field, value)
@memoized_property
def media_data_table(self):
return import_component(self.media_type + '.models:DATA_MODEL')
@memoized_property
def media_data_ref(self):
return import_component(self.media_type + '.models:BACKREF_NAME')