Loading...
Loading...
Unlock expert Django model creation strategies with this actionable checklist. Optimize fields, relationships, performance, and scalability for efficient backend development and superior web app performance.
You are a senior Django backend engineer. Generate a comprehensive, step-by-step checklist for creating and optimizing Django models based on the following project requirements: [INSERT YOUR PROJECT DESCRIPTION, ENTITIES, AND DATA NEEDS HERE]. Structure your response as a clear, actionable checklist divided into key sections. Use bullet points with checkboxes (e.g., - [ ] Item) for easy tracking. Include code examples where relevant. **Checklist Sections:** **1. Planning and Data Structure** - [ ] Outline core entities, attributes, and relationships (e.g., one-to-many, many-to-many). - [ ] Identify primary keys, unique constraints, and required fields. - [ ] Sketch ER diagram or list models with fields. **2. Field Definition Best Practices** - [ ] Select precise field types (e.g., CharField(max_length=255), PositiveIntegerField). - [ ] Add validators (e.g., MaxLengthValidator, EmailValidator). - [ ] Use default values and null/blank appropriately. - [ ] Define choices for categorical data with tuples. **3. Relationships and Integrity** - [ ] Implement ForeignKey with on_delete=.CASCADE or PROTECT as needed. - [ ] Use OneToOneField for extensions. - [ ] Configure ManyToManyField with through models for extra fields. - [ ] Add related_name for reverse queries. **4. Model Optimization** - [ ] Apply db_index=True on frequently queried fields. - [ ] Use unique_together or indexes in Meta class. - [ ] Leverage select_related() and prefetch_related() in queries. - [ ] Consider denormalization for read-heavy operations. **5. Advanced Features** - [ ] Create abstract base models for shared fields/methods. - [ ] Define custom managers and QuerySets. - [ ] Add __str__(), get_absolute_url(), and custom methods. - [ ] Implement model validation with clean() or full_clean(). **6. Meta Options and Migrations** - [ ] Set ordering, verbose_name, and permissions in Meta. - [ ] Use db_table for custom table names. - [ ] Generate and review migrations with makemigrations. **7. Testing and Documentation** - [ ] Write model tests for creation, updates, and queries. - [ ] Add docstrings and comments for complex logic. - [ ] Profile queries with Django Debug Toolbar. End with a sample models.py code snippet tailored to the project. Ensure all recommendations follow Django best practices for scalability, performance, and maintainability.
Structured web research using ChatGPT's browsing capability. Systematic source evaluation, fact-checking, and synthesis with proper citations.
Design production-ready ChatGPT API integrations. Covers authentication, streaming, function calling, structured outputs, and cost optimization with the latest OpenAI SDK.
Step-by-step data analysis pipeline using ChatGPT's Code Interpreter. Upload CSV/Excel files for cleaning, visualization, statistical analysis, and insights.
Optimize ChatGPT's memory feature for persistent context. Teaches how to structure memories, manage what's stored, and leverage personalization effectively.
Generate precise, creative DALL-E 3 prompts. Handles style specifications, aspect ratios, composition rules, and iterative refinement for stunning AI-generated images.
Leverage ChatGPT Canvas mode for iterative document editing, code review, and collaborative writing with inline suggestions and tracked changes.