Anonymous avatar Anonymous committed 450d7ae

Replay Meta options to superclass

Comments (0)

Files changed (1)


             # This is not a I18nModel subclass, so ignore it
             return ModelBase.__new__(mcs, name, bases, attrs)
-        attr_meta = attrs.pop('Meta', None)
+        attr_meta = attrs.get('Meta', None)
         # First determine what the source model is (and throw if unknown)
         # attribute in model's Meta options:
         source = getattr(attr_meta, 'source_model', None)
+        # Remove the source_model attribute if any, pass on exception
+        try:
+            del attrs['Meta'].source_model
+        except AttributeError:
+            pass
         if source and type(source) in [str, unicode]:
             # The source is a string, so we need to find out what the developer
             # meant by that. Possibly a class or a model.
         # First look at the ``translation_fields`` Meta options
         fields = getattr(attr_meta, 'translation_fields', [])
+        # Remove translation_fields attribute if any, pass on exception
+        try:
+            del attrs['Meta'].translation_fields
+        except AttributeError:
+            pass
         if not fields:
             # No fields were found, so let's grab all CharField, SlugField,
             # and TextField from the source model.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.