I keep getting this error not sure what i am doing wrong!!

Traceback (most recent call last):
  File 
"C:\Users\IBM_ADMIN\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\utils\autoreload.py",
 
line 225, in wrapper
    fn(*args, **kwargs)
  File 
"C:\Users\IBM_ADMIN\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\management\commands\runserver.py",
 
line 109, in inner_run
    autoreload.raise_last_exception()
  File 
"C:\Users\IBM_ADMIN\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\utils\autoreload.py",
 
line 248, in raise_last_exception
    raise _exception[1]
  File 
"C:\Users\IBM_ADMIN\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\management\__init__.py",
 
line 337, in execute
    autoreload.check_errors(django.setup)()
  File 
"C:\Users\IBM_ADMIN\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\utils\autoreload.py",
 
line 225, in wrapper
    fn(*args, **kwargs)
  File 
"C:\Users\IBM_ADMIN\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\__init__.py",
 
line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File 
"C:\Users\IBM_ADMIN\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\apps\registry.py",
 
line 120, in populate
    app_config.ready()
  File 
"C:\Users\IBM_ADMIN\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\contrib\admin\apps.py",
 
line 24, in ready
    self.module.autodiscover()
  File 
"C:\Users\IBM_ADMIN\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\contrib\admin\__init__.py",
 
line 26, in autodiscover
    autodiscover_modules('admin', register_to=site)
  File 
"C:\Users\IBM_ADMIN\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\utils\module_loading.py",
 
line 47, in autodiscover_modules
    import_module('%s.%s' % (app_config.name, module_to_search))
  File 
"C:\Users\IBM_ADMIN\AppData\Local\Programs\Python\Python37-32\lib\importlib\__init__.py",
 
line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in 
_call_with_frames_removed
  File "C:\Users\IBM_ADMIN\TrainingCentral\NHT\admin.py", line 38, in 
<module>
    admin.site.register([NHTTrainer, NHTTrainerInline])
  File 
"C:\Users\IBM_ADMIN\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\contrib\admin\sites.py",
 
line 103, in register
    if model._meta.abstract:
AttributeError: type object 'NHTTrainerInline' has no attribute '_meta'


Models:

from django.db import models
from TRAC.models import Candidate


# Create your models here.
location = (
    ('Bangalore-EGL', 'Bangalore-EGL'),
    ('Bangalore-MTP', 'Bangalore-MTP'),
    ('Pune', 'Pune'),
    ('Noida', 'Noida'),
    ('Gurgaon', 'Gurgaon'),
    ('Hyderabad', 'Hyderabad'),
)


class NHTTrainer(models.Model):
    employee_id = models.CharField(max_length=9, primary_key=True)
    first_name = models.CharField(max_length=100)
    middle_name = models.CharField(max_length=100)
    last_name = models.CharField(max_length=200)
    created = models.DateField(auto_now_add=True)
    updated = models.DateField(auto_now_add=True)

    def __str__(self):
        return self.first_name + " " + self.middle_name + " " + self.last_name

    class Meta:
        verbose_name_plural = "NHT Trainers"
        verbose_name = "NHT Trainer"


class NHTBatch(models.Model):
    BatchID = models.CharField(max_length=100, primary_key=True)
    start_date = models.DateField()
    end_date = models.DateField()
    location = models.CharField(max_length=200, choices=location)
    total_days_in_training = models.IntegerField(default=5)
    total_number_of_agents = models.IntegerField()
    trainer = models.ForeignKey(NHTTrainer, on_delete=models.DO_NOTHING)

    def __str__(self):
        return self.BatchID

    class Meta:
        verbose_name_plural = "Batches"


class NHTraineeDetails(Candidate):
    employeeID = models.CharField(max_length=9)
    NHTBatch = models.ForeignKey(NHTBatch, on_delete=models.DO_NOTHING)

    class Meta:
        verbose_name_plural = "NHT Trainee Details"



Admin:

from django.contrib import admin
from .models import *
# Register your models here.


class NHTTrainerInline(admin.TabularInline):
    model = NHTTrainer
    fk_name = "NHTTrainer"


class NHTraineeDetailsInline(admin.TabularInline):
    model = NHTraineeDetails
    fk_name = "NHTraineeDetails"


class NHTBatchInline(admin.TabularInline):
    model = NHTBatch
    fk_name = "NHTBatch"


class AdminInline(admin.ModelAdmin):
    inlines = [
        NHTTrainerInline,
        NHTraineeDetailsInline,
        NHTBatchInline,
        ]

    class Meta:
        verbose_name_plural = "Add Batches"


admin.site.register([NHTTrainer, NHTTrainerInline])
admin.site.register([NHTraineeDetails, NHTraineeDetailsInline])
admin.site.register([NHTBatch, NHTBatchInline])
admin.site.register(AdminInline)



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d13dfe3e-efe3-4af4-a61c-753f944377be%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to