Modele Django dla istniejącej bazy danych
#Auto-generate the models
python manage.py inspectdb
#Save this as a file by using standard Unix output redirection:
python manage.py inspectdb > models.py
#By default, inspectdb creates unmanaged models. That is, managed = False in the model’s Meta class tells Django not to manage each table’s creation, modification, and deletion:
class Person(models.Model):
id = models.IntegerField(primary_key=True)
first_name = models.CharField(max_length=70)
class Meta:
managed = False
db_table = 'CENSUS_PERSONS'
Areeb Ahmar