database-design

How to protect objects from deletion in Django?

How to protect objects from deletion in Django? Question: I have a settings app inside my project, and every record in DB table that this app uses, represents particular setting. And it is important that settings always must be consistent, so Im looking for way to protect them from accidental deletion by admin-panel users, or …

Total answers: 3

Django Selective Dumpdata

Django Selective Dumpdata Question: Is it possible to selectively filter which records Django’s dumpdata management command outputs? I have a few models, each with millions of rows, and I only want to dump records in one model fitting a specific criteria, as well as all foreign-key linked records referencing any of those records. Consider this …

Total answers: 6

how do simple SQLAlchemy relationships work?

how do simple SQLAlchemy relationships work? Question: I’m no database expert — I just know the basics, really. I’ve picked up SQLAlchemy for a small project, and I’m using the declarative base configuration rather than the “normal” way. This way seems a lot simpler. However, while setting up my database schema, I realized I don’t …

Total answers: 1

Django models – how to filter number of ForeignKey objects

Django models – how to filter number of ForeignKey objects Question: I have a models A and B, that are like this: class A(models.Model): title = models.CharField(max_length=20) (…) class B(models.Model): date = models.DateTimeField(auto_now_add=True) (…) a = models.ForeignKey(A) Now I have some A and B objects, and I’d like to get a query that selects all …

Total answers: 4