title: Registering derived child class of abstract class in admin.py in django 2.2
body: <p>Does anyone know, how to register <strong>child class derived from abstract class</strong> in  admin.py (the abstract class is in file abstract_models.py file) I tried major solution in the web but does not seem to work. It is possible as pointed by various contributors but don't know what I am doing wrong! </p>
  
  <p>My folder structure is like this</p>
  
  <p>'''</p>
  
  <pre><code>gaasc/ &lt;- project folder
  
       contain urls.py, admin.py,models.py,etc
  
  gaasc_apps/&lt;- contains all apps
  
      core/
         abstract_models.py
         models.py
         admin.py,...
  
      about_app/
        models.py, 
        admin.py
        urls.py
  </code></pre>
  
  <p>'''</p>
  
  <p>I am trying to leverage abstract class inside <strong>core app</strong> to models inside <strong>about_app app</strong>. Yes, between different apps.</p>
  
  <p>Steps followed:</p>
  
  <ol>
  <li><p>create abstract_models.py and define abstract class</p></li>
  <li><p>import it in core/models.py</p></li>
  </ol>
  
  <p>3.import the abstract class from core/models.py inside about_app/models.py</p>
  
  <ol start="4">
  <li>register the class in about_app/models.py to admin.py(in about_app/)</li>
  </ol>
  
  <p><strong>abstract_models.py</strong> file(inside core/abstract_models.py) has</p>
  
  <pre><code>import uuid
  from django.db import models
  
  
  class AbstractTimeStampModel(models.Model):
       """TimeStampModel that holds created_date and updated_date       field"""
       id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
       created_date = models.DateTimeField("Created date", auto_now_add=True)
       updated_date = models.DateTimeField("Updated date", auto_now=True)
  
      def __str__(self):
          return self.created_date
  
      class Meta:
          abstract = True
  
  class AbstractTextAreaOnly(AbstractTimeStampModel):
       """Abstract class for textfield"""
  
      about = models.TextField(
          verbose_name="Description",
          blank=True
      )
  
      def __str__(self):
          return "Textonly class-"+self.id
  
      class Meta:
          ordering = ['created_date']
  </code></pre>
  
  <p><strong>models.py</strong> in core/models.py</p>
  
  <pre><code>from django.db import models
  from .abstract_models import (
        AbstractTextAreaOnly,
  )
  </code></pre>
  
  <p>Now I want to use this abstract class in about_app/
  So my derived class in <strong>models.py</strong> inside <strong>about_app/models.py</strong> looks:</p>
  
  <pre><code>  from django.db import models
    from gaasc_apps.core.models import(
        AbstractTextAreaOnly,
    )
  
    class GeneralInformation(AbstractTextAreaOnly):
       '''
       Gives general information of college
       '''
  
       class Meta():
           db_table = "general_information"
           verbose_name="General information"
           ordering=['created_date']
  </code></pre>
  
  <p><strong>What I tried:</strong></p>
  
  <p>I tried to registering using following ways:</p>
  
  <p><strong>method1:</strong></p>
  
  <p>in admin.py in <strong>about_app/admin.py</strong>:</p>
  
  <pre><code>from django.contrib import admin
  from .models import (
      GeneralInformation,
  )
  
  @register(GeneralInformation)
  class GeneralInformationAdmin(admin.ModelAdmin):
      pass
  </code></pre>
  
  <p><strong>method 2:</strong></p>
  
  <p>in about_app/admin.py</p>
  
  <pre><code>from django.contrib import admin
  from .models import (
      GeneralInformation,
  )
  
  class GeneralInformationAdmin(admin.ModelAdmin):
     pass
  
  admin.site.register(GeneralInformation,GeneralInformationAdmin)
  </code></pre>
  
  <p><strong>method3:</strong></p>
  
  <p>in about_app/admin.py</p>
  
  <pre><code>  ......
    class GeneralInformationAdmin(admin.ModelAdmin):
       readonly_fields = ('id','about','created_date','updated_date')
       list_display=('id','about','created_date')
       fieldsets=[
          ('Id',{'fields':['id']}),
          ('About',{'fields':['about']}),
          ('Created_Date',{'fields':['created_date']}),
       ]
  
       admin.site.register(GeneralInformation,GeneralInformationAdmin)
  </code></pre>
  
  <p>With all this solution GeneralInformation is not shown in admin panal/dashboard of django.
  The solution seems to be simple but I don't know why its not working?
  Some solution I tried are here:</p>
  
  <p><a href="https://stackoverflow.com/questions/54514324/how-to-register-inherited-sub-class-in-admin-py-file-in-django">How to register inherited sub class in admin.py file in django?</a> </p>
  
  <p><a href="https://stackoverflow.com/questions/7376102/django-admin-model-inheritance-is-it-possible">Django admin model Inheritance is it possible?</a></p>
  
  <p><a href="https://stackoverflow.com/questions/24026203/register-abstract-model-in-admin-django-1-6">Register abstract model in admin django 1.6</a></p>
  
  <p>VERSION:
  Django-2.2
  python-3.6</p>