From 945cae9aae5f74c4d734389ba2a2539bda137f7c Mon Sep 17 00:00:00 2001 From: Joseph Kocherhans Date: Mon, 9 Jan 2006 18:33:14 +0000 Subject: [PATCH] magic-removal: removed django.models.core. It should no longer be needed as of [1888]. git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@1891 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/models/core.py | 43 ------------------------------------------- 1 file changed, 43 deletions(-) delete mode 100644 django/models/core.py diff --git a/django/models/core.py b/django/models/core.py deleted file mode 100644 index 44048aa7ae..0000000000 --- a/django/models/core.py +++ /dev/null @@ -1,43 +0,0 @@ -import base64, md5, random, sys -import cPickle as pickle -from django.db import models -from django.utils.translation import gettext_lazy as _ - -class Package(models.Model): - label = models.CharField(_('label'), maxlength=20, primary_key=True) - name = models.CharField(_('name'), maxlength=30, unique=True) - class Meta: - verbose_name = _('package') - verbose_name_plural = _('packages') - db_table = 'packages' - ordering = ('name',) - - def __repr__(self): - return self.name - -class ContentType(models.Model): - name = models.CharField(_('name'), maxlength=100) - package = models.ForeignKey(Package, db_column='package') - python_module_name = models.CharField(_('python module name'), maxlength=50) - class Meta: - verbose_name = _('content type') - verbose_name_plural = _('content types') - db_table = 'content_types' - ordering = ('package', 'name') - unique_together = (('package', 'python_module_name'),) - - def __repr__(self): - return "%s | %s" % (self.package_id, self.name) - - def get_model_module(self): - "Returns the Python model module for accessing this type of content." - return __import__('django.models.%s.%s' % (self.package_id, self.python_module_name), '', '', ['']) - - def get_object_for_this_type(self, **kwargs): - """ - Returns an object of this type for the keyword arguments given. - Basically, this is a proxy around this object_type's get_object() model - method. The ObjectNotExist exception, if thrown, will not be caught, - so code that calls this method should catch it. - """ - return self.get_model_module().get_object(**kwargs)