Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Remove special-casing for proxy/unmanaged models

  • Loading branch information...
commit 45e5eedea99ed5aaa1df8ab505527566097e2328 1 parent 49d1e6b
Andrew Godwin authored September 22, 2012

Showing 1 changed file with 4 additions and 10 deletions. Show diff stats Hide diff stats

  1. 14  django/db/backends/schema.py
14  django/db/backends/schema.py
@@ -159,14 +159,11 @@ def effective_default(self, field):
159 159
 
160 160
     # Actions
161 161
 
162  
-    def create_model(self, model, force=False):
  162
+    def create_model(self, model):
163 163
         """
164 164
         Takes a model and creates a table for it in the database.
165 165
         Will also create any accompanying indexes or unique constraints.
166 166
         """
167  
-        # Do nothing if this is an unmanaged or proxy model
168  
-        if not force and (not model._meta.managed or model._meta.proxy):
169  
-            return
170 167
         # Create column SQL, add FK deferreds if needed
171 168
         column_sqls = []
172 169
         params = []
@@ -226,15 +223,12 @@ def create_model(self, model, force=False):
226 223
         self.execute(sql, params)
227 224
         # Make M2M tables
228 225
         for field in model._meta.local_many_to_many:
229  
-            self.create_model(field.rel.through, force=True)
  226
+            self.create_model(field.rel.through)
230 227
 
231  
-    def delete_model(self, model, force=False):
  228
+    def delete_model(self, model):
232 229
         """
233 230
         Deletes a model from the database.
234 231
         """
235  
-        # Do nothing if this is an unmanaged or proxy model
236  
-        if not force and (not model._meta.managed or model._meta.proxy):
237  
-            return
238 232
         # Delete the table
239 233
         self.execute(self.sql_delete_table % {
240 234
             "table": self.quote_name(model._meta.db_table),
@@ -300,7 +294,7 @@ def create_field(self, model, field, keep_default=False):
300 294
         """
301 295
         # Special-case implicit M2M tables
302 296
         if isinstance(field, ManyToManyField) and field.rel.through._meta.auto_created:
303  
-            return self.create_model(field.rel.through, force=True)
  297
+            return self.create_model(field.rel.through)
304 298
         # Get the column's definition
305 299
         definition, params = self.column_sql(model, field, include_default=True)
306 300
         # It might not actually have a column behind it

0 notes on commit 45e5eed

Please sign in to comment.
Something went wrong with that request. Please try again.