﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
22690	'Proxy model contains model fields' error	Craig de Stigter	nobody	"My [https://github.com/craigds/django-typed-models django-typed-models] extension implements a type-field based model inheritance approach for django using proxy models.

It relies on having proxy models with their own fields, which has always worked with minimal hackery until recently.

Now on Django 1.7, we are getting this issue ([https://github.com/craigds/django-typed-models/issues/16 ticket]):

{{{
cdestigter@bob:~/c/tp$ ./manage.py syncdb
eh
Operations to perform:
  Synchronize unmigrated apps: admin, contenttypes, auth, sessions
  Apply all migrations: (none)
Synchronizing apps without migrations:
  Creating tables...
  Installing custom SQL...
  Installing indexes...
Running migrations:
  No migrations needed.
Traceback (most recent call last):
  File ""./manage.py"", line 10, in <module>
    execute_from_command_line(sys.argv)
  File ""/Users/cdestigter/checkout/django/django/core/management/__init__.py"", line 427, in execute_from_command_line
    utility.execute()
  File ""/Users/cdestigter/checkout/django/django/core/management/__init__.py"", line 419, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File ""/Users/cdestigter/checkout/django/django/core/management/base.py"", line 288, in run_from_argv
    self.execute(*args, **options.__dict__)
  File ""/Users/cdestigter/checkout/django/django/core/management/base.py"", line 337, in execute
    output = self.handle(*args, **options)
  File ""/Users/cdestigter/checkout/django/django/core/management/base.py"", line 532, in handle
    return self.handle_noargs(**options)
  File ""/Users/cdestigter/checkout/django/django/core/management/commands/syncdb.py"", line 24, in handle_noargs
    call_command(""migrate"", **options)
  File ""/Users/cdestigter/checkout/django/django/core/management/__init__.py"", line 167, in call_command
    return klass.execute(*args, **defaults)
  File ""/Users/cdestigter/checkout/django/django/core/management/base.py"", line 337, in execute
    output = self.handle(*args, **options)
  File ""/Users/cdestigter/checkout/django/django/core/management/commands/migrate.py"", line 141, in handle
    changes = autodetector.changes(graph=executor.loader.graph)
  File ""/Users/cdestigter/checkout/django/django/db/migrations/autodetector.py"", line 36, in changes
    changes = self._detect_changes()
  File ""/Users/cdestigter/checkout/django/django/db/migrations/autodetector.py"", line 54, in _detect_changes
    new_apps = self.to_state.render()
  File ""/Users/cdestigter/checkout/django/django/db/migrations/state.py"", line 64, in render
    model.render(self.apps)
  File ""/Users/cdestigter/checkout/django/django/db/migrations/state.py"", line 270, in render
    body,
  File ""/Users/cdestigter/checkout/django/django/db/models/base.py"", line 198, in __new__
    raise FieldError(""Proxy model '%s' contains model fields."" % name)
django.core.exceptions.FieldError: Proxy model 'Hub' contains model fields.

}}}

This FieldError seems unnecessary and is not easily overridden without overriding the whole of `ModelBase.__new__`.

Can this FieldError please be removed (or extracted into a method that can be overridden, so I can remove this check for consenting subclasses)?

Otherwise I fear I may end up having to copy all 229 lines of `ModelBase.__new__` into my code just to maintain this.

tested on latest 1.7.x.

Seems related: #22568

Marked as blocker cos it seems like a regression. Doesn't happen on 1.6.x or earlier"	Bug	closed	Database layer (models, ORM)	1.7-beta-2	Release blocker	fixed		cmawebsite@…	Ready for checkin	0	0	0	0	0	0
