<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Lisa Mosweta</title>
    <description>The latest articles on Forem by Lisa Mosweta (@lisamswt).</description>
    <link>https://forem.com/lisamswt</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3289770%2F23e2fbaf-2020-453d-b3f6-999cecd1ffc2.png</url>
      <title>Forem: Lisa Mosweta</title>
      <link>https://forem.com/lisamswt</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/lisamswt"/>
    <language>en</language>
    <item>
      <title>django event management</title>
      <dc:creator>Lisa Mosweta</dc:creator>
      <pubDate>Fri, 18 Jul 2025 06:51:37 +0000</pubDate>
      <link>https://forem.com/lisamswt/django-event-management-2024</link>
      <guid>https://forem.com/lisamswt/django-event-management-2024</guid>
      <description></description>
    </item>
    <item>
      <title>Day 5: Understanding MVC as I continue my dive into Django</title>
      <dc:creator>Lisa Mosweta</dc:creator>
      <pubDate>Tue, 01 Jul 2025 16:17:21 +0000</pubDate>
      <link>https://forem.com/lisamswt/day-5-understanding-mvc-and-djangos-take-on-it-1i7h</link>
      <guid>https://forem.com/lisamswt/day-5-understanding-mvc-and-djangos-take-on-it-1i7h</guid>
      <description>&lt;h2&gt;
  
  
  So like this is all I learnt today about MVC
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;MVC&lt;/strong&gt; stands for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Model – Handles data and business logic.&lt;/li&gt;
&lt;li&gt;View – Displays data to the user.&lt;/li&gt;
&lt;li&gt;Controller – Accepts user input and processes it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Hence, each has it’s own responsibility in keeping our code clean and organized.&lt;/p&gt;

&lt;h2&gt;
  
  
  Django's Twist:
&lt;/h2&gt;

&lt;p&gt;From what I’ve learned Django uses the MTV architecture, which maps like this:&lt;/p&gt;

&lt;p&gt;Django MTV  Traditional MVC Purpose&lt;br&gt;
Model   Model   Handles the data, database, and business logic&lt;br&gt;
Template    View    Displays the data to the user (HTML, CSS)&lt;br&gt;
View    Controller  Handles the logic and connects everything&lt;/p&gt;

&lt;p&gt;Yup, Django’s “View” is actually the Controller in the traditional sense, and the “Template” is the actual View.&lt;br&gt;
Crazy I know.&lt;/p&gt;

&lt;h2&gt;
  
  
  This matters cause…
&lt;/h2&gt;

&lt;p&gt;Understanding this mapping clears up confusion when navigating Django projects. To ease more understanding, this is what each component looks like in action:&lt;/p&gt;

&lt;p&gt;Model (&lt;code&gt;models.py&lt;/code&gt;): Defines your database structure.&lt;br&gt;
View (&lt;code&gt;views.py&lt;/code&gt;): Contains the logic to fetch data and choose what template to render.&lt;br&gt;
Template (&lt;code&gt;.html files&lt;/code&gt;): Renders the UI using context passed from the view.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Building a Basic Django App Example&lt;/strong&gt;&lt;br&gt;
Here’s a quick overview of how these parts fit together in a blog app:&lt;/p&gt;

&lt;h1&gt;
  
  
  models.py
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Post(models.Model):
    title = models.CharField(max_length=200)
    content = models.TextField()

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  views.py
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def post_list(request):
    posts = Post.objects.all()
    return render(request, 'blog/post_list.html', {'posts': posts})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!-- post_list.html --&amp;gt;
  &amp;lt;h2&amp;gt;{{ post.title }}&amp;lt;/h2&amp;gt;
  &amp;lt;p&amp;gt;{{ post.content }}&amp;lt;/p&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  My last take on MVC is that…
&lt;/h2&gt;

&lt;p&gt;While Django uses different naming conventions, it follows the same principles of MVC. &lt;/p&gt;

&lt;p&gt;Anyways, I’m Learning to embrace the MTV structure since it is key to mastering Django and building clean and efficient apps.&lt;/p&gt;

&lt;p&gt;Alright that’s it for today, peace&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Day 4: First Django Project</title>
      <dc:creator>Lisa Mosweta</dc:creator>
      <pubDate>Mon, 30 Jun 2025 17:26:22 +0000</pubDate>
      <link>https://forem.com/lisamswt/day-4-learning-about-django-32b4</link>
      <guid>https://forem.com/lisamswt/day-4-learning-about-django-32b4</guid>
      <description>&lt;p&gt;Today has been crazyyyy anyways I created a Django project with two applications each having their own templates and all.&lt;br&gt;
What I was to do:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use Django’s project and app architecture&lt;/li&gt;
&lt;li&gt;Link two apps: trousers and tops&lt;/li&gt;
&lt;li&gt;Display templates for each app with an awesome look cause you know ;)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  &lt;em&gt;Step 1&lt;/em&gt;: Setting Up the Virtual Environment
&lt;/h2&gt;

&lt;p&gt;Installed virtualenv (if not already installed):&lt;/p&gt;

&lt;p&gt;sudo apt install python3-venv&lt;/p&gt;

&lt;p&gt;Created a virtual environment inside the project folder:&lt;/p&gt;

&lt;p&gt;python3 -m venv venv&lt;/p&gt;

&lt;p&gt;This created a venv/ folder containing an isolated Python environment with its own pip, python, and site-packages.&lt;/p&gt;

&lt;p&gt;Activated the virtual environment:&lt;/p&gt;

&lt;p&gt;source venv/bin/activate&lt;/p&gt;

&lt;p&gt;Your terminal prompt changes to indicate the virtual environment is active (e.g., (venv)). To deactivate, run:&lt;/p&gt;

&lt;p&gt;deactivate&lt;/p&gt;

&lt;p&gt;Installed Django inside the virtual environment:&lt;/p&gt;

&lt;p&gt;python -m pip install django&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;em&gt;Step 2&lt;/em&gt;: Starting the Django Project
&lt;/h2&gt;

&lt;p&gt;Created a new Django project named boutique:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;django-admin startproject boutique
cd boutique
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The folder structure now looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;boutique/
    manage.py
    boutique/
        __init__.py
        settings.py
        urls.py
        asgi.py
        wsgi.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;em&gt;Step 3&lt;/em&gt;: Creating Django Apps
&lt;/h2&gt;

&lt;p&gt;Created two apps named trousers and tops:&lt;/p&gt;

&lt;p&gt;python manage.py startapp trousers&lt;br&gt;
python manage.py startapp tops&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;a href="https://dev.tourl"&gt;&lt;em&gt;Step 4&lt;/em&gt;&lt;/a&gt;: Creating Models That Interact
&lt;/h2&gt;

&lt;p&gt;In trousers/models.py, defined a Trouser model:&lt;/p&gt;

&lt;p&gt;from django.db import models&lt;/p&gt;

&lt;p&gt;class Trouser(models.Model):&lt;br&gt;
    name = models.CharField(max_length=100)&lt;br&gt;
    brand = models.CharField(max_length=100)&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def __str__(self):
    return f"{self.name} by {self.brand}"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;In tops/models.py, imported Trouser and defined a Top model that links to Trouser via a foreign key (for example, if a top is styled to match a trouser):&lt;/p&gt;

&lt;p&gt;from django.db import models&lt;br&gt;
from trousers.models import Trouser&lt;/p&gt;

&lt;p&gt;class Top(models.Model):&lt;br&gt;
    name = models.CharField(max_length=100)&lt;br&gt;
    color = models.CharField(max_length=50)&lt;br&gt;
    matching_trouser = models.ForeignKey(Trouser, on_delete=models.CASCADE)&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def __str__(self):
    return f"{self.name} in {self.color}"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Ran migrations to apply these changes:&lt;/p&gt;

&lt;p&gt;python manage.py makemigrations&lt;br&gt;
python manage.py migrate&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;em&gt;[Step 5]&lt;/em&gt;(url): Creating Simple Views
&lt;/h2&gt;

&lt;p&gt;In trousers/views.py, created a view to list all trousers:&lt;/p&gt;

&lt;p&gt;from django.shortcuts import render&lt;br&gt;
from .models import Trouser&lt;/p&gt;

&lt;p&gt;def trouser_list(request):&lt;br&gt;
    trousers = Trouser.objects.all()&lt;br&gt;
    return render(request, 'trousers/trousers.html', {'trousers': trousers})&lt;/p&gt;

&lt;p&gt;In tops/views.py, created a view to list all tops:&lt;/p&gt;

&lt;p&gt;from django.shortcuts import render&lt;br&gt;
from .models import Top&lt;/p&gt;

&lt;p&gt;def top_list(request):&lt;br&gt;
    tops = Top.objects.all()&lt;br&gt;
    return render(request, 'tops/tops.html', {'tops': tops})&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;em&gt;Step 6&lt;/em&gt;: Linking Templates with Style
&lt;/h2&gt;

&lt;p&gt;Each app has its own templates directory (trousers/templates/trousers/ and tops/templates/tops/).&lt;/p&gt;

&lt;p&gt;Used Bootstrap and a light CSS gradient background to make the pages look clean and polished.&lt;/p&gt;

&lt;p&gt;Example: trousers/templates/trousers/trousers.html&lt;/p&gt;


&lt;br&gt;
  &lt;br&gt;
    &lt;h2&gt;👖 Trousers Collection&lt;/h2&gt;
&lt;br&gt;
    &lt;ul&gt;
&lt;/ul&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    &amp;lt;li&amp;gt;{{ trouser.name }} by {{ trouser.brand }}&amp;lt;/li&amp;gt;

&amp;lt;/ul&amp;gt;
&amp;lt;a href="/tops/"&amp;gt;View Tops&amp;lt;/a&amp;gt;
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;&lt;br&gt;&lt;br&gt;
&lt;br&gt;&lt;br&gt;
Example: tops/templates/tops/tops.html&lt;/p&gt;


&lt;br&gt;
  &lt;br&gt;
    &lt;h2&gt;👚 Tops Collection&lt;/h2&gt;
&lt;br&gt;
    &lt;ul&gt;
&lt;/ul&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;/ul&amp;gt;
&amp;lt;a href="/trousers/"&amp;gt;View Trousers&amp;lt;/a&amp;gt;
&lt;/code&gt;&lt;/pre&gt;




&lt;h2&gt;
  
  
  &lt;em&gt;Step 7&lt;/em&gt;: Setting Up URLs to Connect Everything
&lt;/h2&gt;

&lt;p&gt;Created a urls.py in each app folder.&lt;/p&gt;

&lt;p&gt;trousers/urls.py:&lt;/p&gt;

&lt;p&gt;from django.urls import path&lt;br&gt;
from .views import trouser_list&lt;/p&gt;

&lt;p&gt;urlpatterns = [&lt;br&gt;
    path('', trouser_list, name='trouser-list'),&lt;br&gt;
]&lt;br&gt;
tops/urls.py:&lt;/p&gt;

&lt;p&gt;from django.urls import path&lt;br&gt;
from .views import top_list&lt;/p&gt;

&lt;p&gt;urlpatterns = [&lt;br&gt;
    path('', top_list, name='top-list'),&lt;br&gt;
]&lt;br&gt;
Included these app URLs in the main project’s boutique/urls.py:&lt;/p&gt;

&lt;p&gt;from django.contrib import admin&lt;br&gt;
from django.urls import path, include&lt;/p&gt;

&lt;p&gt;urlpatterns = [&lt;br&gt;
    path('admin/', admin.site.urls),&lt;br&gt;
    path('trousers/', include('trousers.urls')),&lt;br&gt;
    path('tops/', include('tops.urls')),&lt;br&gt;
]&lt;br&gt;
Now you can visit:&lt;/p&gt;

&lt;p&gt;/trousers/ to see the list of trousers&lt;/p&gt;

&lt;p&gt;/tops/ to view the tops and their matching trousers&lt;/p&gt;

&lt;p&gt;It’s only the beginning, breath&lt;/p&gt;

</description>
      <category>webdev</category>
    </item>
    <item>
      <title>What I have grasped from learning about git</title>
      <dc:creator>Lisa Mosweta</dc:creator>
      <pubDate>Thu, 26 Jun 2025 11:39:37 +0000</pubDate>
      <link>https://forem.com/lisamswt/what-i-have-grasped-from-learning-about-git-4paf</link>
      <guid>https://forem.com/lisamswt/what-i-have-grasped-from-learning-about-git-4paf</guid>
      <description>&lt;p&gt;&lt;strong&gt;&lt;em&gt;INTRODUCTION&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
I have learnt a lot of stuff but to be specific I will just narrow most of the information down.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Forking&lt;/strong&gt;&lt;br&gt;
So this is the creating of  a personal copy of someone else’s repository on GitHub.It is usually useful when you want to contribute to a project without affecting the original repo.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Collaboration&lt;/strong&gt;&lt;br&gt;
It allows multiple contributors with different roles.&lt;br&gt;
Collaborators can also clone, commit and push each other's code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pull Requests&lt;/strong&gt;&lt;br&gt;
This is a way to propose changes from one repo to another and it is often from a fork to the original repo.&lt;br&gt;
Team members can also changes before merging.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Merge Conflicts&lt;/strong&gt;&lt;br&gt;
This occurs when changes in two branches conflict and Git can’t merge them automatically.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code Review&lt;/strong&gt;&lt;br&gt;
Helps improve code quality, catch bugs, and ensure consistent coding standards.&lt;/p&gt;

&lt;p&gt;** GitHub Issues**&lt;br&gt;
Used to track bugs, feature requests, tasks, or enhancements.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Git Commands&lt;/strong&gt;&lt;br&gt;
There are multiple git commands such as:&lt;br&gt;
git init: Initialize a new Git repo.&lt;br&gt;
git pull: Get latest changes from remote.&lt;br&gt;
git push: Send your changes to the remote repo.&lt;br&gt;
just to name a few.&lt;/p&gt;

&lt;p&gt;Pushing Changes to GitHub&lt;br&gt;
After making and committing changes locally and that you are connected to the branch:&lt;br&gt;
You are supposed to use git push origin  to send changes to GitHub.&lt;br&gt;
It Ensures that your local work is saved in the remote repository.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Yeah, that is what I have learnt for today&lt;/em&gt;.&lt;/p&gt;

</description>
      <category>git</category>
      <category>github</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>How I set up the tools I needed for my journey in Python/ django</title>
      <dc:creator>Lisa Mosweta</dc:creator>
      <pubDate>Tue, 24 Jun 2025 21:24:35 +0000</pubDate>
      <link>https://forem.com/lisamswt/how-i-set-up-the-tools-i-needed-for-my-journey-in-python-django-4n5i</link>
      <guid>https://forem.com/lisamswt/how-i-set-up-the-tools-i-needed-for-my-journey-in-python-django-4n5i</guid>
      <description>&lt;p&gt;&lt;em&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
Hey so these past few days I’ve been taking the initiative to set up some software tools needed for my journey in python/django.&lt;br&gt;
Here’s a breakdown of how I got everything working, from Git to Python, VS code and Docker too.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Git&lt;/strong&gt;&lt;br&gt;
First thing I did was make sure Git was installed and properly configured.&lt;br&gt;
Did this by getting the link to the git website and downloading it.&lt;br&gt;
I also configured my user details:&lt;br&gt;
git config --global user.name "lisamswt"&lt;br&gt;
git config --global user.email "&lt;a href="mailto:lisanyamache05@gmail.com"&gt;lisanyamache05@gmail.com&lt;/a&gt;"&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Python&lt;/strong&gt;&lt;br&gt;
It is Python 3.13 to be exact.&lt;br&gt;
I Downloaded it from python.org&lt;br&gt;
Where I clicked on Windows installer before adding python to path and clicking install.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;VSCode (my text editor)&lt;/strong&gt;&lt;br&gt;
It had been the easiest to download.&lt;br&gt;
Plus it has a lot of extensions hence easy to customise.&lt;br&gt;
I downloaded it from: &lt;a href="https://code.visualstudio.com/" rel="noopener noreferrer"&gt;https://code.visualstudio.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Docker&lt;/strong&gt;&lt;br&gt;
I Installed Docker Desktop for windows on:&lt;br&gt;
&lt;a href="https://www.docker.com/products/docker-desktop" rel="noopener noreferrer"&gt;https://www.docker.com/products/docker-desktop&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
Now I can gain and apply the skills I’ll learn and create great projects with them.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
