<?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>DEV Community: kkipngenokoech </title>
    <description>The latest articles on DEV Community by kkipngenokoech  (@kkipngenokoech).</description>
    <link>https://dev.to/kkipngenokoech</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%2F1000194%2F1748e5fa-f483-4a60-92cd-1c0d289f86d2.jpeg</url>
      <title>DEV Community: kkipngenokoech </title>
      <link>https://dev.to/kkipngenokoech</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kkipngenokoech"/>
    <language>en</language>
    <item>
      <title>django.contrib.auth.models</title>
      <dc:creator>kkipngenokoech </dc:creator>
      <pubDate>Tue, 25 Apr 2023 04:29:06 +0000</pubDate>
      <link>https://dev.to/kkipngenokoech/djangocontribauthmodels-5coe</link>
      <guid>https://dev.to/kkipngenokoech/djangocontribauthmodels-5coe</guid>
      <description>&lt;p&gt;The django.contrib.auth.models path is an essential part of Django's built-in authentication system, providing models and functionality for user authentication, permissions, groups, and user profiles.&lt;/p&gt;

&lt;p&gt;this is a module in django that provides the models for user authentication and authorization&lt;/p&gt;

&lt;p&gt;this module provides a couple of models:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;User  - This  model represents a user account and stores information such as username and password, email. it also includes authentication, password management and user permissions methods.&lt;/li&gt;
&lt;li&gt;Group - This model represents a user group which is used to manage user permissions and assign permissions as a group&lt;/li&gt;
&lt;li&gt;Permission - This model represents a user permission that can be granted to a user&lt;/li&gt;
&lt;li&gt;AbstractUser - This model represents a base class that provides a customizeable user model. it includes fields such as username, email and password as well as customizable  fields for addtional data&lt;/li&gt;
&lt;li&gt;AbstractBaseUser - This model represents another base class that provides a more customized user model, it includes fields such as username(custom username field), email and password.&lt;/li&gt;
&lt;li&gt;PermissionMixin - This is a mixin class that can be used to add permissions to custom user models it includes fields for permissions and methods for checking permissions&lt;/li&gt;
&lt;li&gt;BaseUserManager - This is a base class that for custom user managers which are used to customize the creation of and management of user accounts&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;One of the most significant advantages of using the django.contrib.auth.models path is that it is highly customizable. Developers can extend the User model to include additional fields or functionality, or they can create custom authentication backends to authenticate users against custom data sources.&lt;/p&gt;

&lt;p&gt;Another advantage of using the built-in authentication system in Django is that it integrates well with other Django modules and functionality, such as the admin site, forms, and templates.&lt;/p&gt;

&lt;p&gt;the django.contrib.auth.models path in Django provides a solid foundation for user authentication and authorization in Django applications. Its comprehensive set of models and functionality allow developers to easily implement user management features, such as permissions, groups, and user profiles, while its customizable nature allows for flexibility and extensibility.&lt;/p&gt;

&lt;p&gt;By using the django.contrib.auth.models path, developers can ensure that their Django applications have a reliable and secure authentication system that integrates well with other Django modules and functionality. With its ease of use and flexibility, the built-in authentication system in Django can save developers time and effort in implementing user authentication and authorization features, enabling them to focus on building other core features of their application.&lt;/p&gt;

</description>
      <category>django</category>
      <category>beginners</category>
      <category>backend</category>
      <category>python</category>
    </item>
    <item>
      <title>DJANGO CUSTOM USER MODEL</title>
      <dc:creator>kkipngenokoech </dc:creator>
      <pubDate>Mon, 24 Apr 2023 19:18:48 +0000</pubDate>
      <link>https://dev.to/kkipngenokoech/django-custom-user-model-54n1</link>
      <guid>https://dev.to/kkipngenokoech/django-custom-user-model-54n1</guid>
      <description>&lt;p&gt;Django Auth is a built-in authentication framework in Django that provides a secure way to handle user authentication, permissions, and access control. It allows you to easily create user authentication and authorization systems for your web application, without having to build everything from scratch.&lt;/p&gt;

&lt;p&gt;Django Auth provides a wide range of features such as user registration, login, logout, password management, and user permissions. It also includes support for various authentication methods such as username and password, email and password, OAuth, and more.&lt;/p&gt;

&lt;p&gt;To use Django Auth, you need to add the authentication middleware to your project's settings, and also include the &lt;code&gt;django.contrib.auth&lt;/code&gt; application in your project's installed apps. After that, you can start using the authentication system by creating users, managing their permissions, and authenticating them.&lt;/p&gt;

&lt;p&gt;Django Auth also comes with a set of built-in views and templates that you can use to create user-facing authentication and registration pages for your web application. You can customize these views and templates to fit your specific needs, or you can create your own custom views and templates.&lt;/p&gt;

&lt;h2&gt;
  
  
  But why would one choose a custom user model?
&lt;/h2&gt;

&lt;p&gt;There are several reasons why you might want to use a custom user model in Django:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Additional fields: The built-in Django User model comes with a fixed set of fields such as username, email, password, etc. If you need to store additional user data or modify the existing fields, you can create a custom user model with the fields that you need.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Unique identifier: By default, the Django User model uses the username field as the unique identifier. However, if you want to use a different field such as email, you can create a custom user model with the unique identifier set to the field of your choice.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Integration with other systems: If your application needs to integrate with external authentication systems such as LDAP or OAuth, you may need to create a custom user model to support the required fields and authentication methods.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Domain-specific requirements: If your application has specific requirements that are not met by the built-in User model, such as different password hashing algorithms or custom authentication methods, a custom user model can help you implement these requirements.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Future-proofing: Creating a custom user model from the start can help future-proof your application against changes to the built-in User model or changes to your application's requirements.&lt;/p&gt;
&lt;h2&gt;
  
  
  how to create a custom user model
&lt;/h2&gt;

&lt;p&gt;Here's an example of how you can create a custom user model in Django:&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;1.Create a new Django app: In your project directory, create a new app that will contain your custom user model. You can do this using the python manage.py startapp command.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Extend the AbstractBaseUser class: In your new app, create a new model that extends the AbstractBaseUser class from the Django contrib.auth.models module. This model will be used as your custom user model.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Define fields: In your custom user model, define the fields that you need. At a minimum, you will need to define a unique identifier field (such as email or username) and a password field.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Define a UserManager: Create a custom manager class for your user model by extending the BaseUserManager class. This will allow you to customize the way user accounts are created and managed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Override required methods: Override the get_full_name and get_short_name methods to define how to retrieve the user's name.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Set AUTH_USER_MODEL: In your project's settings, set AUTH_USER_MODEL to the path of your custom user model. This tells Django to use your custom user model instead of the built-in User model.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In summary, a custom user model in Django is a powerful tool that can help you meet your specific application requirements, provide flexibility, and future-proof your application. By creating a custom user model, you can extend the built-in User model or replace it entirely with your own model, allowing you to add additional fields, define a unique identifier, and customize authentication and authorization methods.&lt;/p&gt;

&lt;p&gt;When creating a custom user model, it's important to carefully consider your application requirements and the potential trade-offs. You may need to implement additional features such as authentication and authorization methods or custom managers. Additionally, migrating to a custom user model can be a complex process, so it's essential to plan and test thoroughly before making the switch.&lt;/p&gt;

</description>
      <category>django</category>
      <category>backend</category>
      <category>beginners</category>
      <category>webdev</category>
    </item>
    <item>
      <title>ADDING GIT REMOTE ORIGIN</title>
      <dc:creator>kkipngenokoech </dc:creator>
      <pubDate>Fri, 27 Jan 2023 05:16:01 +0000</pubDate>
      <link>https://dev.to/kkipngenokoech/adding-git-remote-origin-4ljo</link>
      <guid>https://dev.to/kkipngenokoech/adding-git-remote-origin-4ljo</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9jhxtiqq579zhg0i5ktc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9jhxtiqq579zhg0i5ktc.png" alt="Image description" width="289" height="174"&gt;&lt;/a&gt;&lt;br&gt;
Git is a source code management tool used in DevOps. It is a free and open-source version control system used to efficiently manage small to very large projects. Git is a version control system that allows multiple developers to collaborate on non-linear development by tracking changes in the source code.&lt;/p&gt;

&lt;p&gt;step 1&lt;br&gt;
Delete the .git directory present in your local environment&lt;/p&gt;

&lt;p&gt;&lt;code&gt;rm -rf .git&lt;/code&gt;&lt;br&gt;
this removes specific files or a group of files from a Git repository. Git rm’s primary function is to remove tracked files from the Git index. Furthermore, git rm can be used to remove files from the staging index as well as the working directory.&lt;/p&gt;

&lt;p&gt;so this means that there’s no longer a link between our local working directory and the remote repository&lt;/p&gt;

&lt;p&gt;step 2&lt;br&gt;
after removing the .git we are going to then initialize a new git repository by using the command&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git init&lt;/code&gt;&lt;br&gt;
this command creates a blank new repository&lt;/p&gt;

&lt;p&gt;so we need to start tracking this files, we start creating versions of it and to do this we are going to use the git add -A command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git add -A&lt;/code&gt;&lt;br&gt;
the flag -A command means to track all files present.&lt;/p&gt;

&lt;p&gt;after adding our files to our git repository we are going to commit them using the git commit command&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git commit -m 'commit message'&lt;/code&gt;&lt;br&gt;
when we try to push this code to the GitHub we are going to encounter an error&lt;/p&gt;

&lt;p&gt;this is because we have not defined the connection between our local working repository and the remote repository in GitHub.&lt;/p&gt;

&lt;p&gt;step 3&lt;br&gt;
so here we are going to do just as you see in the recommendation you have been given by git, git really does a lot to ensure that we have a easy time interacting with it&lt;/p&gt;

&lt;p&gt;git remote add   takes two parameters, name and url.&lt;/p&gt;

&lt;p&gt;name parameter means the name of the branch in which your code is going to reside in, most people prefer origin&lt;/p&gt;

&lt;p&gt;the url is the http url found in your github repository&lt;/p&gt;

&lt;p&gt;copy that code and run in your terminal&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git remote add origin &amp;lt;paste your url here&amp;gt;&lt;/code&gt;&lt;br&gt;
then push your code to your remote repository branch&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git push origin&lt;/code&gt;&lt;br&gt;
if you get an error saying “The current branch main has no upstream branch.” then you need to run this command&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git push --set-upstream origin main&lt;/code&gt;&lt;br&gt;
with that you have set a remote origin and have pushed your code to github!&lt;/p&gt;

</description>
      <category>gratitude</category>
    </item>
  </channel>
</rss>
