Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python super on Meta Class from another class

In class Test2 I want to include both the models and fields in its class Meta. Is this possible and how? This is what I have tried...

I have a mixin:

class Test1(object):
        pass
    class Meta:
        fields = ("url",)

class Test2(Test1):
        pass
    class Meta:
        super(Meta) <=== does not work
        models= test
like image 871
Prometheus Avatar asked Sep 30 '14 17:09

Prometheus


1 Answers

Your answer can be found in the Django Documentation

I.E.

from django.db import models

class CommonInfo(models.Model):
    # ...
    class Meta:
        abstract = True
        ordering = ['name']

class Student(CommonInfo):
    # ...
    class Meta(CommonInfo.Meta):
        db_table = 'student_info'
like image 101
Douglas Denhartog Avatar answered Nov 08 '22 14:11

Douglas Denhartog