<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"><channel><title><![CDATA[Learn with KD]]></title><description><![CDATA[Join KD, a seasoned full-stack developer, on a tech journey. Explore coding, cloud, and insights for a holistic learning experience.]]></description><link>https://learn.kdpisda.in</link><image><url>https://substackcdn.com/image/fetch/$s_!zZ6P!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcdf4dba9-88ec-4969-b030-ba6689a02009_500x500.png</url><title>Learn with KD</title><link>https://learn.kdpisda.in</link></image><generator>Substack</generator><lastBuildDate>Sat, 09 May 2026 11:20:01 GMT</lastBuildDate><atom:link href="https://learn.kdpisda.in/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[Kuldeep Pisda]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[kdpisda@substack.com]]></webMaster><itunes:owner><itunes:email><![CDATA[kdpisda@substack.com]]></itunes:email><itunes:name><![CDATA[Kuldeep Pisda]]></itunes:name></itunes:owner><itunes:author><![CDATA[Kuldeep Pisda]]></itunes:author><googleplay:owner><![CDATA[kdpisda@substack.com]]></googleplay:owner><googleplay:email><![CDATA[kdpisda@substack.com]]></googleplay:email><googleplay:author><![CDATA[Kuldeep Pisda]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[Mastering Generic Foreign Keys: Flexible References in Django]]></title><description><![CDATA[Explore the concept of Generic Foreign Keys in Django &#8211; a versatile solution for dynamically referencing multiple tables in your database schema. Learn how to implement these flexible keys and enhance your Django projects' data modeling capabilities.]]></description><link>https://learn.kdpisda.in/p/mastering-generic-foreign-keys-flexible</link><guid isPermaLink="false">https://learn.kdpisda.in/p/mastering-generic-foreign-keys-flexible</guid><dc:creator><![CDATA[Kuldeep Pisda]]></dc:creator><pubDate>Tue, 12 Sep 2023 16:28:46 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/73406fac-4719-44b1-8b77-41334b9e6e7c_420x300.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>This blog post will delve into <strong>Generic Foreign Keys</strong> in Django. We'll explore what they are, when they are helpful, and how to define them in a Django model. </p><p><em>Please note that this post primarily focuses on understanding the concept behind Generic Foreign Keys and does not delve into the debate of whether they are the best choice from a database design perspective or whether they should be used.</em></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://learn.kdpisda.in/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Learn with KD! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><h1>Foreign Keys</h1><blockquote><p>A foreign key is a critical element in a database table, often comprising one or more columns, whose values must correspond to the values in another table's column(s). <strong>FOREIGN KEY</strong> constraints play a crucial role in maintaining referential integrity, ensuring that if a value in one column (A) references a value in another column (B), then column B must exist.</p></blockquote><p>However, <strong>what if we want to establish a reference to any table using a foreign key?</strong> Consider a scenario where we want to keep track of "likes" for various types of content, such as posts and courses.</p><pre><code>class Post(models.Model):
    ...</code></pre><pre><code>class Like(models.Model):
    post = models.ForeignKey(
        Post, 
        on_delete=models.SET_NULL, 
        null=True, 
        blank=True
    )
    user = models.ForeignKey(
        User,
        on_delete=models.SET_NULL, 
        null=True, 
        blank=True
    )</code></pre><p>Suppose we introduce a new model, "Course," and we want to allow users to like courses as well. </p><p>We face a choice: </p><ul><li><p>Create separate models to track likes for each type of content or </p></li><li><p>Employ a single "Like" model with a Generic Foreign Key.</p></li></ul><h1>Generic Foreign Key</h1><p>To understand how Generic Foreign Keys work, let's revisit SQL's standard foreign key concept. <strong>In a typical foreign key, one column references the primary key of a predefined table. We must devise a schema that accommodates this flexibility to make it generic and reference any table.</strong></p><p>In a typical foreign key setup, a single column references the primary key of a specific, predefined table. For instance, consider the following SQL code:</p><pre><code>CREATE TABLE posts (
    post_id SERIAL PRIMARY KEY,
    user_id INT NOT NULL,
    content TEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    -- Add any other columns related to a post here
);

FOREIGN KEY (user_id) REFERENCES users(user_id);</code></pre><p>Here, the &#8220;<code>user_id&#8221;</code> column in the "posts" table references the &#8220;<code>user_id&#8221;</code> column in the "users" table. This enforces referential integrity and ensures that the values in the "user_id" column of "posts" correspond to existing values in the "users" table.</p><p>Now, <strong>let's consider a scenario where we want to create a reference to various tables, not just a specific one.</strong> <strong>SQL doesn't provide a built-in mechanism for this.</strong> To achieve this flexibility, we need to adjust our schema definition.</p><p>To make a foreign key generic and capable of referring to any table, we can create two columns:</p><ol><li><p>A column that stores the primary key value without the constraints of a foreign key.</p></li><li><p>Another column indicates which table the reference pertains to.</p></li></ol><p>In this way, we create a more versatile structure:</p><pre><code>CREATE TABLE likes (
    like_id SERIAL PRIMARY KEY,
    user_id INT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    content_id INT NOT NULL,
    content_type VARCHAR(255) NOT NULL,
    -- Add any other columns related to likes here
);

-- You can define foreign keys to link to the User table.
-- FOREIGN KEY (user_id) REFERENCES User(user_id);
</code></pre><p>In this new setup, the &#8220;<code>content_id&#8221;</code> column stores the primary key value, and the &#8220;<code>content_type&#8221;</code> column specifies the table to which it refers. This approach allows us to reference multiple tables dynamically based on the value in &#8220;<code>content_type&#8221;</code>.</p><p>By employing this schema modification, we can achieve the flexibility needed to create generic foreign keys, enabling us to reference various tables within our database.</p><pre><code>INSERT INTO Like (user_id, content_id, content_type)
VALUES (1, 123, 'posts'); 
-- Assuming user with ID 1 liked post with ID 123

INSERT INTO Like (user_id, content_id, content_type)
VALUES (2, 456, 'courses'); 
-- Assuming user with ID 2 liked course with ID 456

INSERT INTO Like (user_id, content_id, content_type)
VALUES (3, 789, 'digital_goods'); 
-- Assuming user with ID 3 liked digital goods with ID 789</code></pre><p>We can effectively implement generic foreign keys by querying the "<strong>content_type</strong>" key from the "<strong>likes</strong>" table and joining it with the corresponding table in separate queries.</p><div class="pullquote"><p>It's important to note that "content_id" is an integer field that should match the data type of the referenced table's primary key. For instance, if the primary key is a UUID, "content_id" should also be a UUID, or we can use VARCHAR to handle various data types.</p></div><h2>ContentType Model</h2><p>In Django, <strong>table names differ from model names, consisting of the Django app and model name combined.</strong> Django provides an inbuilt model for tracking defined models in your project, known as "ContentType." </p><p>Instead of manually storing this information, we reference the "ContentType" table when defining a Generic Foreign Key in a Django Model.</p><blockquote><p>Django includes a contenttypes application that can track all of the models installed in your Django-powered project, providing a high-level, generic interface for working with your models.<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-1" href="#footnote-1" target="_self">1</a></p></blockquote><p>Here's how it looks in Django:</p><pre><code>from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models


class Like(models.Model):
    user = models.ForeignKey(
        User,
        on_delete=models.SET_NULL, 
        null=True, 
        blank=True
    )
    content_type = models.ForeignKey(
        ContentType, 
        on_delete=models.CASCADE
    )
    object_id = models.PositiveIntegerField()
    content_object = GenericForeignKey("content_type", "object_id")

    class Meta:
        indexes = [
            models.Index(fields=["content_type", "object_id"]),
        ]</code></pre><blockquote><p>Note the index on fields "content_type" and "object_id"; it optimizes fetching records for specific content types, such as Posts, Courses, and Digital Goods.</p></blockquote><h2>GenericForeignKey</h2><blockquote><p>There are three parts to setting up a <code>GenericForeignKey</code>:</p><ol><li><p>Give your model a <code>ForeignKey</code> to <code>ContentType</code>. The usual name for this field is &#8220;content_type&#8221;.</p></li><li><p>Give your model a field that can store primary key values from the models you&#8217;ll be relating to. For most models, this means a <code>PositiveIntegerField</code>. The usual name for this field is &#8220;object_id&#8221;.</p></li><li><p>Give your model a <code>GenericForeignKey</code>, and pass it the names of the two fields described above. If these fields are named &#8220;content_type&#8221; and &#8220;object_id&#8221;, you can omit this &#8211; those are the default field names <code>GenericForeignKey</code> will look for.</p></li></ol><p>Unlike for the <code>ForeignKey</code>, a database index is <em>not</em> automatically created on the <code>GenericForeignKey</code>, so it&#8217;s recommended that you use <code>Meta.indexes</code> to add your own multiple column index. This behavior <a href="https://code.djangoproject.com/ticket/23435">may change</a> in the future.<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-2" href="#footnote-2" target="_self">2</a></p></blockquote><p>Unlike ForeignKey, a database index is not automatically created on the GenericForeignKey, so adding your custom multiple-column index using Meta.indexes is advisable.</p><h2>Working with the ORM</h2><p>There are two approaches to working with GenericForeignKeys:</p><ol><li><p>Passing "content_type" and "object_id" separately or</p></li><li><p>Using "content_object" directly.</p></li></ol><h3><strong>Passing </strong><code>content_type</code> and <code>object_id</code> Separately</h3><h4><strong>Explicit Control</strong></h4><p>Using <code>content_type</code> and <code>object_id</code> separately provides more explicit control over the foreign key relationship. You can set these fields independently, allowing you to manipulate the like object's references as needed.</p><h4><strong>Performance</strong></h4><p>In some cases, especially when working with a large number of likes, directly setting <code>content_type</code> and <code>object_id</code> can be more efficient because it avoids the overhead of creating and managing a content object instance.</p><h4><strong>Complex Relationships</strong></h4><p>Passing them separately can be beneficial when dealing with complex relationships or situations where you must perform additional logic based on the content type and object ID.</p><h4>Example</h4><pre><code># Creating a like for a Post
post_content_type = ContentType.objects.get(
    app_label="cms",
    model="post"
)
user = User.objects.get(id=1)
like = Like(
    user=user,
    object_id=123,    # ID of the post
    content_type=post_content_type,
)
like.save()

# Creating a like for a Course
course_content_type = ContentType.objects.get(
    app_label="cms",
    model="course"
)
user = User.objects.get(id=1)
like = Like(
    user=user,
    object_id=456,    # ID of the course
    content_type=course_content_type,
)
like.save()

# Creating a like for a DigitalGood
dg_content_type = ContentType.objects.get(
    app_label="cms",
    model="digital_good"
)
user = User.objects.get(id=1)
like = Like(
    user=user,
    object_id=789,    # ID of the Digital Good
    content_type=dg_content_type,
)
like.save()</code></pre><h3><strong>Using </strong><code>content_object</code><strong> Directly</strong></h3><h4><strong>Convenience</strong></h4><p>The <code>content_object</code> approach is more convenient and concise in many cases. It allows you to work with content objects directly without explicitly setting <code>content_type</code> and <code>object_id</code>.</p><h4><strong>Readability</strong></h4><p>Code using <code>content_object</code> tends to be more readable and self-explanatory, especially for developers less familiar with the underlying database schema.</p><h4><strong>Django's Design Philosophy</strong></h4><p>Django's ORM is designed to make everyday tasks straightforward, and using <code>content_object</code> aligns with this philosophy.</p><p>In most cases, using content_object directly is recommended because it simplifies your code and improves readability. However, suppose you have specific use cases that require fine-grained control over the foreign key relationship or are working with many records and need to optimize performance. In that case, you might choose to pass content_type and object_id separately.</p><h4>Example</h4><pre><code># Creating a like for a Post
post = Post.objects.get(id=123)
user = User.objects.get(id=1)
like = Like(user=user, content_object=post)
like.save()

# Creating a like for a Course
course = Course.objects.get(id=456)
user = User.objects.get(id=2)
like = Like(user=user, content_object=course)
like.save()

# Creating a like for a DigitalGood
digital_good = DigitalGood.objects.get(id=789)
user = User.objects.get(id=3)
like = Like(user=user, content_object=digital_good)
like.save()</code></pre><h1>Conclusion</h1><p>In conclusion, Generic Foreign Keys in Django provide a powerful way to handle references to multiple tables within your database schema dynamically. While traditional foreign keys bind to specific tables, Generic Foreign Keys can reference various tables based on a content type indicator. This flexibility empowers developers to build more adaptable and extensible data models, enhancing the versatility of their Django projects. Whether you choose to pass &#8220;<code>content_type&#8221;</code> and &#8220;<code>object_id&#8221;</code> separately or use the convenient &#8220;<code>content_object&#8221;</code> Understanding and utilizing Generic Foreign Keys can significantly improve your data modelling capabilities in Django applications.</p><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-1" href="#footnote-anchor-1" class="footnote-number" contenteditable="false" target="_self">1</a><div class="footnote-content"><p>https://docs.djangoproject.com/en/4.2/ref/contrib/contenttypes/#module-django.contrib.contenttypes</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-2" href="#footnote-anchor-2" class="footnote-number" contenteditable="false" target="_self">2</a><div class="footnote-content"><p>https://docs.djangoproject.com/en/4.2/ref/contrib/contenttypes/#django.contrib.contenttypes.fields.GenericForeignKey</p><p></p></div></div>]]></content:encoded></item><item><title><![CDATA[How to structure the Django Project?]]></title><description><![CDATA[Unlock the art of crafting organized and scalable Django projects. Learn best practices for structuring your Django applications, dividing them into resources, and optimizing project management. Elevate your Django development game with this comprehensive guide to project structure and organization.]]></description><link>https://learn.kdpisda.in/p/how-to-structure-the-django-project</link><guid isPermaLink="false">https://learn.kdpisda.in/p/how-to-structure-the-django-project</guid><dc:creator><![CDATA[Kuldeep Pisda]]></dc:creator><pubDate>Thu, 07 Sep 2023 08:36:57 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/a5d310ef-ea12-4aba-a12e-79fa6325b817_420x300.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Django's Command Line Interface (CLI) is a powerful tool for generating well-structured Django projects. However, maintaining that clean structure can become challenging as we create multiple apps, models, views, and routes. In this article, we'll unveil our preferred method for organizing Django projects. This approach has proven invaluable in creating and sustaining an organized and understandable directory structure, even as our Django project evolves and scales.</p><h1>The Default Structure</h1><pre><code>project/
|-- app/
|   |-- migrations/
|   |   |-- __init__.py
|   |-- __init__.py
|   |-- admin.py
|   |-- apps.py
|   |-- models.py
|   |-- tests.py
|   |-- views.py
|-- project/
|   |-- __init__.py
|   |-- settings.py
|   |-- urls.py
|   |-- asgi.py
|   |-- wsgi.py
|-- manage.py
|-- requirements.txt</code></pre><p>When we create an app in Django, a folder is made with the name of the app, and typically, it consists of a <code>migrations</code> folder and several files to configure the admin, models, tests, and views.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://learn.kdpisda.in/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Learn with KD! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>While it is an excellent structure already, the problem arises when the project grows. One of my projects had almost 80+ models. So, we can&#8217;t have a single Python file with thousands of lines. I mean, we can, but then it becomes a lot less readable.</p><p>So then, how do we do it? Making sure we have scope to grow it to a certain point where it is still easier to expand without affecting the readability of it.</p><h1>The Solution</h1><h2>Strategy 1: Organizing Models and Views</h2><p>Over time, the original problem revolved around the increasing size of our Django project's models and view files. Django doesn't strictly enforce placing all models inside the <code>models.py</code> file.</p><p>Instead, it offers the flexibility to structure our project how we see fit. We've devised a simple yet effective solution to address this issue: organizing models and views by placing them in separate files within dedicated directories. The updated project structure would resemble the following:</p><pre><code>project/
|-- app/
|   |-- migrations/
|   |   |-- __init__.py
|   |-- __init__.py
|   |-- admin.py
|   |-- apps.py
|   |-- models/
|   |   |-- __init__.py
|   |   |-- model1.py
|   |   |-- model2.py
|   |   |-- ...
|   |-- views/
|   |   |-- __init__.py
|   |   |-- view1.py
|   |   |-- view2.py
|   |   |-- ...
|   |-- tests.py
|-- project/
|   |-- __init__.py
|   |-- settings.py
|   |-- urls.py
|   |-- asgi.py
|   |-- wsgi.py
|-- manage.py
|-- requirements.txt</code></pre><p>By adopting this approach, we maintain a clean and modular project structure, ensuring that our models and views remain organized and readable as our project grows.</p><h3>models Directory</h3><p>The presence of an <code>__init__.py</code> file in the models&#8217; directory serves several important purposes:</p><h4>Namespace Organization</h4><p>By declaring the models&#8217; directory as a package with <code>__init__.py</code>, we establish an explicit namespace for our models. This allows us to organize and structure our models into multiple files while maintaining them within the same logical package. This becomes increasingly beneficial as our project grows and we introduce numerous models.</p><h4>Import Convenience</h4><p>The <code>__init__.py</code> file allows us to easily import our models from other parts of our app or project. For instance, we can import a model like this:</p><pre><code><code>from app.models import MyModel</code></code></pre><h3>views Directory</h3><p>Similarly, in the views directory, the <code>__init__.py</code> file plays a vital role:</p><h4>Namespace Organization</h4><p>It aids in organizing our views into separate files within the views package. Each view file can focus on specific views or functionality, enhancing the overall code maintainability.</p><h4>Import Convenience</h4><p>With the <code>__init__.py</code> file in place; we can effortlessly import our view functions or classes from the views directory into other parts of our code. This includes usage in our URL routing (<code>urls.py</code>) or different views.</p><p>By including these <code>__init__.py</code> files, we improve our Django project's organization, structure, and maintainability, making it easier to manage as it continues to evolve and expand.</p><h2>Strategy 2: Taking It a Step Further</h2><p>While Strategy 1 addresses our problem effectively, we can refine it further to enhance our project's structure and maintainability.</p><p>But before we delve into these improvements, let's take a moment to discuss the concept of apps in Django.</p><h3>Creating Apps in Django</h3><p>Before we proceed, it's essential to understand the technical definition of an app within a Django project, as per the official documentation<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-1" href="#footnote-1" target="_self">1</a>:</p><blockquote><p>Applications include some combination of models, views, templates, template tags, static files, URLs, middleware, etc. They&#8217;re generally wired into projects with the <code>INSTALLED_APPS</code> setting and optionally with other mechanisms such as URLconfs, the <code>MIDDLEWARE</code> setting, or template inheritance.</p></blockquote><h3>Dividing Apps Based on Business Functions</h3><p>When structuring my Django projects, dividing them based on the core business functions they serve is crucial. This approach enhances project organization and makes managing and maintaining over time easier.</p><p>For instance, let's take the example of a Content Management System (CMS) I built in Django. Here's how I typically divide it into multiple apps:</p><ol><li><p><strong>CMS App</strong>: I create models and views for the fundamental shared resources that define the CMS in this app. This includes entities like categories, tags, posts, and more.</p></li><li><p><strong>IAM (Identity and Access Management) App</strong>: To handle user authentication, extend user models, and manage roles and permissions, I create a dedicated IAM app. This keeps authentication-related code separate and well-organized.</p></li><li><p><strong>Notification App</strong>: For managing various types of notifications, whether they are in-app notifications, emails, browser notifications, or others, I established a distinct notification app. This centralized approach ensures efficient notification handling throughout the project.</p></li></ol><p>By structuring the project this way, instead of randomly creating apps for every model, we align each app with a specific business function. This promotes clarity and maintainability and streamlines the development process, making it easier to scale and expand the project as business requirements evolve.</p><p>This strategy enhances the organization of the Django project and aligns development efforts with the underlying business objectives, ensuring a more cohesive and efficient project structure.</p><h3>Creating Resources in the Django App</h3><p>Let's delve deeper into what constitutes a resource in my context of a Django app:</p><h4>What is a Resource?</h4><p>I define a resource as a cohesive collection of components that work together to fulfil a specific functionality. These components typically include Models, Views or ViewSets, related Tests, and Serializers. I further split the app into resources to maintain an organised codebase, each representing a distinct functional unit.</p><h3>Resource Structure</h3><p>The project structure I typically follow looks like the following:</p><pre><code>project/
|-- app/
|   |-- resource1/
|   |   |-- models.py
|   |   |-- views.py
|   |   |-- admins.py
|   |   |-- serializers.py
|   |   |-- filters.py
|   |   |-- tests/
|   |   |   |-- test_1.py
|   |   |   |-- test_2.py
|   |   |   |-- ...
|   |-- resource2/
|   |   |-- models.py
|   |   |-- views.py
|   |   |-- admins.py
|   |   |-- serializers.py
|   |   |-- filters.py
|   |   |-- tests/
|   |   |   |-- test_1.py
|   |   |   |-- test_2.py
|   |   |   |-- ...
|   |-- migrations/
|   |   |-- __init__.py
|   |   |-- ...
|   |-- urls.py
|-- project/
|   |-- __init__.py
|   |-- settings.py
|   |-- urls.py
|   |-- asgi.py
|   |-- wsgi.py
|-- manage.py
|-- requirements.txt</code></pre><h4><strong>Model as a Resource</strong></h4><p>Regarding whether the name of a model can be considered a resource, it depends. A resource typically encompasses similar models that are closely related. If the models within the <code>models.py</code> file of a resource directory are closely related and serve a common purpose, then naming the resource after the primary model makes sense. However, if the models are not closely related, keeping them in separate resource directories is advisable.</p><p>This project structure has proven effective for me over time, but it's essential to remember that project organization can vary based on individual preferences and project requirements. Feel free to adapt and modify it to suit your needs and preferences.</p><h1>Conclusion</h1><p>In conclusion, the structure and organization of a Django project play a pivotal role in its maintainability and scalability. Throughout this discussion, we've explored strategies and best practices for creating a well-structured Django project and how to divide it into smaller, manageable units called resources.</p><p>By dividing our project into resources based on business functions, we achieve clarity and maintainability, making it easier to navigate and extend as our project evolves. Each resource encapsulates related models, views, tests, serializers, and filters, creating a modular and organized codebase.</p><p>It's important to note that while the project structure outlined here has proven effective, it's not a one-size-fits-all solution. Adaptations can be made to align with specific project requirements and personal preferences.</p><p>Ultimately, a well-organized Django project, with clear resource boundaries and thoughtful structuring, contributes significantly to project success. It promotes maintainability, teamwork, and adaptability, ensuring your Django application remains robust and adaptable as it grows and evolves.</p><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-1" href="#footnote-anchor-1" class="footnote-number" contenteditable="false" target="_self">1</a><div class="footnote-content"><p>https://docs.djangoproject.com/en/4.2/ref/applications/</p><p></p></div></div>]]></content:encoded></item><item><title><![CDATA[Getting Started]]></title><description><![CDATA[Hi Guys,]]></description><link>https://learn.kdpisda.in/p/getting-started</link><guid isPermaLink="false">https://learn.kdpisda.in/p/getting-started</guid><dc:creator><![CDATA[Kuldeep Pisda]]></dc:creator><pubDate>Sat, 29 May 2021 16:04:37 GMT</pubDate><enclosure url="https://bucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com/public/images/2ca74066-2a19-4e0a-b7fd-703a7165a1c8_500x500.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hi Guys,</p><p>I did not get any confirmations; hence I did not do the session today. But, we will do a session tomorrow from 11 AM.</p><p>Please let me know if you have any other questions. Below are the details to join the session.</p><p>Kuldeep Pisda is inviting you to a scheduled Zoom meeting.<br>Topic: Getting Started | Code with KD<br>Time: May 30, 2021, 11:00 AM Mumbai, Kolkata, New Delhi<br>Join Zoom Meeting<br><a href="https://zoom.us/j/98279956004?pwd=NGJiUk02Y0wrVkxJdi91YW0yTDdTQT09">https://zoom.us/j/98279956004?pwd=NGJiUk02Y0wrVkxJdi91YW0yTDdTQT09</a><br>Meeting ID: 982 7995 6000<br>Passcode: P8Xr0q</p><p>Thanks and Regards,<br>Kuldeep Pisda</p>]]></content:encoded></item><item><title><![CDATA[Topics to discuss in the first session]]></title><description><![CDATA[Hi!]]></description><link>https://learn.kdpisda.in/p/topics-to-discuss-in-the-first-session</link><guid isPermaLink="false">https://learn.kdpisda.in/p/topics-to-discuss-in-the-first-session</guid><dc:creator><![CDATA[Kuldeep Pisda]]></dc:creator><pubDate>Fri, 28 May 2021 04:47:15 GMT</pubDate><enclosure url="https://bucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com/public/images/2ca74066-2a19-4e0a-b7fd-703a7165a1c8_500x500.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hi! Kuldeep here,<br>Tomorrow in the morning, I am hoping to have our first session on web development.</p><p>Topics I will be covering.</p><ol><li><p>What is web development?</p></li><li><p>Different aspects of web development</p></li><li><p>Web Development for non-CS students</p></li><li><p>Getting started with web development</p></li><li><p>Roadmap for Web Development as a Career Option</p></li></ol><p>Feel free to share any other topics/questions that we should cover. I am thinking of a 10-12 AM tomorrow, i.e. 29th May slot for the session. Feel free to suggest yours if you have any other suggestions.</p>]]></content:encoded></item><item><title><![CDATA[Let's code web together]]></title><description><![CDATA[Welcome to Code with KD,]]></description><link>https://learn.kdpisda.in/p/coming-soon</link><guid isPermaLink="false">https://learn.kdpisda.in/p/coming-soon</guid><dc:creator><![CDATA[Kuldeep Pisda]]></dc:creator><pubDate>Wed, 26 May 2021 09:59:00 GMT</pubDate><enclosure url="https://bucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com/public/images/27a86d0c-5bd8-46f7-83ae-206524cfa501_500x500.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Welcome to Code with KD,</p><p>I am a full stack developer and currently working at Goldcast Inc as a backend developer. I am starting a series on Web Development which will consist of weekly live sessions. I was hoping you could find me on <a href="https://www.linkedin.com/in/kuldeep-pisda/">LinkedIn</a>.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://learn.kdpisda.in/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://learn.kdpisda.in/subscribe?"><span>Subscribe now</span></a></p><p>In the meantime, <a href="https://learn.kdpisda.in/p/coming-soon?utm_source=substack&utm_medium=email&utm_content=share&action=share">tell your friends</a>!</p>]]></content:encoded></item></channel></rss>