[Answered ]-Django-Admin with models from external database not saving or filtering

1👍

The .using is not sufficient. Django performs unique checks, that omit the using. You can however fix this by overriding the _default_manager:

from django.db.models import Manager


class PaisesManager(Manager):
    def get_queryset(self, *args, **kwargs):
        return super().get_queryset(*args, **kwargs).using('external')


class Paises(models.Model):
    id_country = models.IntegerField(db_column='ID_COUNTRY', primary_key=True)
    country_name = models.TextField(
        db_column='COUNTRY_NAME', blank=True, null=True
    )
    country_phone_code = models.IntegerField(
        db_column='COUNTRY_PHONE_CODE', blank=True, null=True
    )

    class Meta:
        managed = False
        db_table = 'PAISES'
        verbose_name_plural = 'Paises'
        base_manager_name = 'objects'
        default_manager_name = 'objects'

    def __str__(self):
        return self.country_name

    objects = PraisesManager()

It is actually quite remarkable that a lot of the "mechanics" of Django are using-unaware.

Leave a comment