<?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:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Robert Kimaiyo on Medium]]></title>
        <description><![CDATA[Stories by Robert Kimaiyo on Medium]]></description>
        <link>https://medium.com/@rkiptoo5244?source=rss-c04dca921a75------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*HC6UvnXdZxbh86ZH</url>
            <title>Stories by Robert Kimaiyo on Medium</title>
            <link>https://medium.com/@rkiptoo5244?source=rss-c04dca921a75------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 20:38:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rkiptoo5244/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Django Rest framework]]></title>
            <link>https://medium.com/@rkiptoo5244/django-rest-framework-b026f039f838?source=rss-c04dca921a75------2</link>
            <guid isPermaLink="false">https://medium.com/p/b026f039f838</guid>
            <dc:creator><![CDATA[Robert Kimaiyo]]></dc:creator>
            <pubDate>Wed, 31 Jul 2024 21:32:19 GMT</pubDate>
            <atom:updated>2024-07-31T21:32:19.161Z</atom:updated>
            <content:encoded><![CDATA[<p>Whats DjangoRestFramework?</p><ul><li>It is a powerful Python framework used for developing web applications, It is easy to build applications with it for Python developers. Djangorestframework is an open-source where developers build and maintain the applications for free without funding.</li></ul><p><strong>Features of Djangorestframework</strong></p><ul><li>It is open-source.</li><li>It is easy to build applications with it</li><li>It has a lot of community support from the developers.</li></ul><p>A good use case to develop an application using the Django Rest Framework.</p><p>Start by creating a virtual environment if you are on Windows you can use this command</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/335/1*OpypcWJ6GQmbfrZ2KQ7Z8Q.png" /><figcaption>c</figcaption></figure><ul><li>Creating virtual environment using Linux machine is illustrated below</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/649/1*bbixYFN0uXiBgKmuJAGDFQ.png" /></figure><ul><li>The process of creating a new Django Rest Framework follows the pattern below. Ensure you have installed the above packages.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*nCcCnXUhjTiLpThTp0kMGA.png" /></figure><ul><li>We are creating a book collection API using the Django Rest Framework. Make sure to follow the process until we successfully run the application.</li></ul><p>Create an app application inside the Django Rest Framework</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/658/1*6ZAwbmj3P06ObJ5X0kNXPQ.png" /></figure><ul><li>Add the app you created to the list of installed apps and add rest_framework.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/619/1*PmU4ZywPVYSOE1yoM7vVdA.png" /><figcaption>installed apps</figcaption></figure><ul><li>In the books directory find a model.py file and add the models below to store the data about the book</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/1*ayNVKW6DSidtAzavWjyW2Q.png" /><figcaption>models</figcaption></figure><ul><li>In Django, create a serializers.py file that will assist in serializing the model you have created.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*5IRFvZ8ttf4HNTw-f8PO4g.png" /><figcaption>serializers.py</figcaption></figure><ul><li>In the books folder, create the view that will assist in defining how to create and list books.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/569/1*dAUjf15vMUaDum9imFuR0Q.png" /><figcaption>views.py</figcaption></figure><ul><li>In the project’s book directory, we need to set up the URLs.py file to define the routing for the previously created app.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/561/1*5FA7bUiutO384ZDn5KtGKA.png" /><figcaption>urls.py</figcaption></figure><ul><li>Create the root Urls.py for all project</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/556/1*x9F8XDBWa89bFumVRPQa2w.png" /></figure><ul><li>Running migrations is a crucial step in the Django Rest Framework development process to ensure that the database schema is synchronized with the changes made to the models, enabling the successful functioning of the application.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/543/1*p0Th_wRlsxfE7nbMHHpHpw.png" /></figure><ul><li>Create a superuser to access the Django admin:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/527/1*ljoi4gI8ruL9kAdl9ks5-g.png" /><figcaption>superuser</figcaption></figure><ul><li>Django run the server</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/527/1*R24Oy9l3tRpZg-p5qml9IQ.png" /><figcaption>run server</figcaption></figure><p>Test the API endpoints as listed below</p><p>List all books: <strong>GET /api/books/<br></strong>Create a book: <strong>POST /api/books/</strong><br>Retrieve<strong> </strong>a<strong> </strong>single<strong> </strong>book: <strong>GET /api/books/{id}/</strong><br>Update a book: <strong>PUT /api/books/{id}/</strong><br>Delete a book: <strong>DELETE /api/books/{id}/</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b026f039f838" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is the best tool for building a generative AI platform: GPTs or Assistants?]]></title>
            <link>https://medium.com/@rkiptoo5244/whats-the-difference-between-gpts-assistants-5e52c9e4bac6?source=rss-c04dca921a75------2</link>
            <guid isPermaLink="false">https://medium.com/p/5e52c9e4bac6</guid>
            <dc:creator><![CDATA[Robert Kimaiyo]]></dc:creator>
            <pubDate>Mon, 19 Feb 2024 13:08:13 GMT</pubDate>
            <atom:updated>2024-02-19T20:27:56.638Z</atom:updated>
            <content:encoded><![CDATA[<p>. GPTs are known as (Generative Pre-trained Transformers)</p><p>During OpenAI DevDay the CEO of OpenAI announced the introduction of the GPT store which was going to act as a database to store multiple GPTs developed within the community. According to the CEO, the development of GPTs was going to be easy since it doesn’t require coding knowledge. The process of creating a custom GPT was through combining knowledge, skills and custom instructions. One of the key functions was to upload a PDF to the chatGPT to learn what was in the data. The best GPTs will be invented by the community according to the CEO&#39;s words during OpenAI DevDay.</p><p>Example of GPTs currently available in OpenAI</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZojHD7Fa_-eiq1k6zhk3_w.png" /></figure><p>These are the examples of GPTs and many more that are currently available in GPT stores.</p><p><strong>How to create GPTs using OpenAI Interface</strong></p><p>The first key issue is you make sure you have chatGPT Plus meaning you should have upgraded your free ChatGPT.</p><ol><li>Log into your ChatGpt you will see the Explore button at the top left-hand side</li><li>Click the Explore GPTs button as shown below.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/252/1*zarJnoL0YSALNZuJGMg2WQ.png" /></figure><p>3. After clicking the explore button above it will take you to the explore page as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/917/1*0MMEIRrU56W_XDqpBnJVlw.png" /><figcaption>Explore page</figcaption></figure><p>4. Click on the top-right where you will see my GPTs, Create</p><p>you will have to click on the Create button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/211/1*RWmICj7NL3ndSEwrQ0b7Tg.png" /><figcaption>Create GPTs</figcaption></figure><p><strong>Prompts</strong></p><p>When starting you will have to Prompt ChatGPT and it will ask you some random questions eg what will the name of your GPT be? That means you will have to create a name for your custom GPTs(Generative Pre-trained Transformers)</p><p>The models are trained to produce human-like responses based on the input they receive. The model excels at the Natural Language Model the tasks include Question Answering, Summarization, Translation and Chat Completion. GPTs achieve this through pre-training and fine-tuning The model learns to predict the next words according to the data trained on.</p><p><strong>Examples of Custom GTPs Include:</strong></p><ol><li><strong>Codey</strong></li></ol><p>This is a custom GPT trained mainly for Coding purposes if you require a debugging tool you can ask Codey since it is good at Coding. If you are looking for a tool to assist you during writing, correcting and deploying your code look no further than Codey GPT. It will help you master whats Coding and syntax of different coding languages eg Java, Python and Javascript.</p><p><strong>Examples of integrated GPTs to the system</strong></p><p><strong>Disadvantages of GPTs</strong></p><ol><li>For you to get access to GPTs you must be a ChatGPT plus user meaning you must have upgraded your OpenAI.</li><li>Creating GPTs you will not store it locally meaning ChatGPT will have access to your Data.</li><li>You will not be able to check who is consuming your GPTs.</li></ol><p><strong>Advantages of GPTs</strong></p><ol><li>GPTs are easy to develop since it doesn’t require coding.</li><li>You can generate revenue by creating your GPTs and making them available for the public to use.</li><li>You don’t require a deployment service since ChatGPT will store it on their GPT store.</li></ol><p><strong>Note</strong></p><p>. If you’re creating a service that uses your company’s data, you need to consider data safety before training GPT with your data, as it could raise privacy concerns.</p><p><strong>Assistants</strong></p><p>What are Assistants according to OpenAI?</p><p>According to OpenAI Assistants help you build AI assistants within your applications. An Assistant has instructions that can leverage models, tools and knowledge The Assistant currently supports 3 types of tools: Code Interpreter, Retrieval, and Function calling. You can explore the capabilities of the Assistants by using the playground,</p><blockquote>Calls to the Assistants API require that you pass a beta HTTP header. This is handled automatically if you’re using OpenAI’s official Python or Node.js SDKs.</blockquote><p>The process of creating Assistants is as follows: create a thread</p><p>How to create A thread:</p><ul><li>code to create a thread below</li></ul><blockquote>thread = client.beta.threads.creates()</blockquote><blockquote>print(thread)</blockquote><ul><li>Create a message to the thread</li></ul><blockquote>message = client.beta.threads.messages.create(</blockquote><blockquote>thread_id = thread.id,</blockquote><blockquote>role = “user”</blockquote><blockquote>content = “solve this maths equation: 2x + 5 = 11”</blockquote><blockquote>)</blockquote><p>print(message)</p><p>. Run the Assistant</p><blockquote>run = client.beta.threads.runs.create(</blockquote><blockquote>thread_id = thread.id,</blockquote><blockquote>assistant_id = assistant.id</blockquote><p>. To display the Assistant Response</p><blockquote>run = client.beta.threads.runs.retrieve(</blockquote><blockquote>thread_id = thread.id</blockquote><blockquote>run_id = run.id</blockquote><blockquote>)</blockquote><blockquote>messages = client.beta.threads.messages.list(</blockquote><blockquote>thread_id = thread.id</blockquote><blockquote>)</blockquote><blockquote>for message in reserved(messages);</blockquote><blockquote>print(message.role + “ : “ + message</blockquote><blockquote>content[0].text.value</blockquote><p><strong>Advantages of Assistants</strong></p><ol><li>You can upload a document of up to 100 GB.</li><li>The organization team can access the created Assistants.</li><li>Unlike GPTs, the Assistants can be used by regular users without upgrading their chatGPT.</li></ol><p><strong>Limitations of Assistants</strong></p><ol><li>You cannot upload a large document to Assistants.</li><li>The Assistants are yet to support the creation of images by processing the user input.</li></ol><p>3. Support for DALL·E or Browsing as a tool.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5e52c9e4bac6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[n8n Workflow]]></title>
            <link>https://medium.com/@rkiptoo5244/n8n-workflow-40a4657d6451?source=rss-c04dca921a75------2</link>
            <guid isPermaLink="false">https://medium.com/p/40a4657d6451</guid>
            <dc:creator><![CDATA[Robert Kimaiyo]]></dc:creator>
            <pubDate>Tue, 13 Feb 2024 15:44:45 GMT</pubDate>
            <atom:updated>2024-02-13T15:44:45.674Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Gmail messages to Google Sheets.</strong></p><p>The first node is to set when the trigger should occur for this application we are setting it to run at a certain time eg midnight (cron job)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/449/1*oCcLaPUr-i_sKMcynkDGKA.png" /></figure><p>From the above trigger, we can see that we have set it to have a trigger time on when the application should run.</p><p><strong>The second workflow is Gmail</strong>.</p><p>For the Gmail workflow, we will have to set our credentials for it to run and fetch the messages. After setting the credentials we have to set the instance in which data should be fetched eg Resource should be set to <strong>Message </strong>and<strong> </strong>Operation should be set to <strong>Get Many</strong>. If you set it to Return All you will have to wait since you may have a lot of messages in your inbox for us not to wait for it to get all the messages we will have to set a limit eg <strong>120.</strong></p><p>Finally, we will have to set received after so as not to fetch just some random messages from the inbox.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/449/1*PbVB45HdYLLsBBtPmIqmlg.png" /></figure><p><strong>Third Node Filter</strong></p><p>The filter node will be used to filter the response we get from the previous node which is the Gmail node.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/379/1*zfa2xi99JrIO76UNWVJ_WQ.png" /><figcaption>unread</figcaption></figure><p><strong>Google Sheets</strong></p><p>The node for Google Sheets will receive the data from the filter and map to the rows of the sheet. Google sheet should be set to append row</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/379/1*hFxgMAA0V3MEQnjQ6aexng.png" /></figure><p>The operation should be set to Append Row and the document should be listed like the above diagram list shown.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jhro7JnWyJh3yUXB2rsHMw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=40a4657d6451" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[N8N Workflows]]></title>
            <link>https://medium.com/@rkiptoo5244/n8n-workflows-9572e4f82fdd?source=rss-c04dca921a75------2</link>
            <guid isPermaLink="false">https://medium.com/p/9572e4f82fdd</guid>
            <dc:creator><![CDATA[Robert Kimaiyo]]></dc:creator>
            <pubDate>Tue, 06 Feb 2024 15:29:01 GMT</pubDate>
            <atom:updated>2024-02-06T15:29:01.200Z</atom:updated>
            <content:encoded><![CDATA[<h4>N8N is a tool that assists during limitless Integration.</h4><p>The n8n tool can be installed and hosted locally or you can log in to n8n.io to sign up and start using the system. Even though you will require a card for you to sign up to the system. N8n will give you a 7-day free trial without charging you any fees.</p><p>N8n is an open-source tool that helps developers integrate services easily without the knowledge of coding. For you to get started learning and creating your workflows you can visit n8n quickstart under the n8n documentation.</p><p><strong>N8N WORKFLOWS</strong></p><p>For you start creating your workflows ensure you have signed in to <a href="https://n8n.io/">https://n8n.io/</a></p><p>Start creating workflows</p><p>Head to n8n after signup you will get access to my workspace.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/457/1*kBnpz0Wil2XGqseDpSsNOg.png" /></figure><p>Please provide your n8n account name (e.g. master) for confirmation. This is the account name you used during signup.</p><p>After successful login, you will be redirected to your workspace where you will have to interact with the workflows and you will select the one which you would like to work on with.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/261/1*deHbE6CJgTO5vEN_efciEA.png" /></figure><p>You will have to select Add Workflow for you to start working with the workflow you are required to use.</p><p>My workflow after you have selected the workflow a blank page will appear on your system where you will have to start working on creating your full workflow until you ensure you have tested the flow and it is working as expected.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/359/1*Peli-qK9RTiBrXlgg_W48A.png" /><figcaption>starter flow</figcaption></figure><p>You will click on the plus icon and multiple apps will appear above it and you will have to select the one you want.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/364/1*cx5fPgBzYrNqWn_VIYsiOw.png" /><figcaption>Search nodes.</figcaption></figure><p>In the above picture, you will have to search for the node that you required to work with eg Twitter, Brevo and many more.</p><p>We are going to select the first node and it is going to be a schedule trigger meaning it works automatically after setting the timeline eg. to work daily or on a time basis eg some hours for it to run. As demonstrated below For the example we are setting it to work after every 1 hour.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/351/1*Ji6Bx7rCIOiIVJiWj_pFPw.png" /></figure><p>When you click Test it will output the message as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/1*aKStdjlttpAOxOYA04Lo4Q.png" /><figcaption>Result</figcaption></figure><p>The next node we are selecting is Google Drive.</p><p>We have to connect the previous node to Google Drive when a certain timeline stated is reached to start the workflow automatically without manually starting or clicking on the instance to run. Before we complete the setup of the workflow we first test the workflow manually by clicking the test button at the top right of the node instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zS2AhQPfA0pp-ec57tg8rQ.png" /></figure><p>To map data from the first node to Google Drive by creating a file with the data taken from the node that was executed first. The node will have to carry out mapping of the data. From n8n trigger =&gt; Google Drive.</p><p>The final node is a Google sheet which we will use to map data from Google Drive to create a sheet in the Google sheet and to store the record in the files for easy retrieval. The Google sheet will act as our database for us to see how the database is mapped</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IsmhqUMz29Y0IaUVJCJawA.png" /><figcaption>Google sheet</figcaption></figure><p>The data will be mapped from the previous node to the current node.</p><p>We can confirm if the data were mapped by checking our Google sheets.</p><p>Finally, this is how our workflow will look like after we have completed setting up everything that is required. After the workflow has been finished you are required to activate the test instance.</p><p><strong>Complete workflow</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/1*so6riYppzx0G4SFamxkh4g.png" /><figcaption>Flows</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9572e4f82fdd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Make Scenarios]]></title>
            <link>https://medium.com/@rkiptoo5244/make-scenarios-c41a4bab3c7b?source=rss-c04dca921a75------2</link>
            <guid isPermaLink="false">https://medium.com/p/c41a4bab3c7b</guid>
            <dc:creator><![CDATA[Robert Kimaiyo]]></dc:creator>
            <pubDate>Sat, 13 Jan 2024 20:47:15 GMT</pubDate>
            <atom:updated>2024-01-13T20:47:15.318Z</atom:updated>
            <content:encoded><![CDATA[<p>To start creating Scenarios in make <a href="https://www.make.com/en/help/app/make#connectmake">https://www.make.com/en/help/app/make#connectmake</a></p><ol><li>Create an account in Make</li><li>Login to make</li></ol><h3><strong>Creating a scenario</strong></h3><p>For Make to automate your tasks for you, you have to create a scenario. A scenario comprises <a href="https://www.make.com/en/help/modules/types-of-modules.html">modules</a> that indicate how data should be transferred and transformed between apps/services.</p><p><em>There are 4 steps to creating a scenario:</em></p><ol><li><a href="https://www.make.com/en/help/scenarios/creating-a-scenario.html#step-1--choose-your-apps">Choose your apps</a></li><li>Build your scenarios</li><li>Test your scenarios</li><li>Activate your scenarios</li></ol><p>Examples of scenarios I have created</p><ol><li>We are checking emails to see if it was sent on a weekend.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/767/1*xy7D2wnewoK5XPew50isuw.png" /></figure><p>The Router helps to router the required permission on the Gmail.</p><p>Go to create a new scenarios</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*ve3oeCCB-utvRvKaT_o_LQ.png" /></figure><p>Select watch emails</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/753/1*aGks6tTNKRxSE3Di9VxT2g.png" /></figure><p>Click ok to finish the setup module</p><p>On the bottom of the page, you will see the tools available select Router</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/488/1*LDBMI0kOAJqL2MpwszUf9Q.png" /></figure><p>We will have to configure the above setup to meet our standards, We want to check for the emails that are sent to us on the weekend.</p><p>If they are emails that are sent to us on the weekend we have to filter and route a certain response to the sender eg I will get back to you on a weekday.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c41a4bab3c7b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Django Functional Based Views]]></title>
            <link>https://medium.com/@rkiptoo5244/django-functional-based-views-37c1d560d154?source=rss-c04dca921a75------2</link>
            <guid isPermaLink="false">https://medium.com/p/37c1d560d154</guid>
            <category><![CDATA[django-class-based-views]]></category>
            <category><![CDATA[django]]></category>
            <dc:creator><![CDATA[Robert Kimaiyo]]></dc:creator>
            <pubDate>Fri, 01 Dec 2023 10:51:07 GMT</pubDate>
            <atom:updated>2023-12-01T10:51:07.847Z</atom:updated>
            <content:encoded><![CDATA[<h4>1: Function-Based Views (FBVs)</h4><p>Function-Based Views (FBVs) are an alternative approach to organizing code in web development frameworks. Unlike Class-Based Views, FBVs are defined as simple functions rather than classes. FBVs provide a straightforward and concise way to handle the logic of processing requests and generating responses.</p><p>In FBVs, each view is implemented as a separate function that takes a request as its argument and returns a response. This allows you to define the behavior of different views in a modular and flexible manner. You can have as many FBVs as you need, each responsible for a specific functionality or page of your application.</p><p>Here’s an example of how FBVs can be used in Django:</p><p>python<br>from django.http import HttpResponse</p><p>def home(request):<br> # Logic for processing the request<br> # Generate the appropriate response<br> return HttpResponse(“Welcome to the home page!”)</p><p>def about(request):<br> # Logic for processing the request<br> # Generate the appropriate response<br> return HttpResponse(“This is the about page.”)</p><p>def contact(request):<br> # Logic for processing the request<br> # Generate the appropriate response<br> return HttpResponse(“Contact us at <a href="/service/mailto:example@example.com">example@example.com</a>.”)</p><p>In this example, we have three FBVs: `home`, `about`, and `contact`. Each function takes a `request` as an argument and returns an `HttpResponse` object with the appropriate content. The logic for processing the request and generating the response is handled within each function.</p><p>FBVs are often used for smaller or less complex applications where the functionality can be implemented with a single function. They provide a more straightforward approach compared to Class-Based Views.</p><p>2: URL Configuration for FBVs</p><p>To map FBVs to URLs in Django, you need to configure the `urls.py` file. This allows you to define the URL patterns that will be associated with each view.</p><p>Here’s an example of how the URL configuration can be done for FBVs:</p><p>python<br>from django.urls import path<br>from . import views</p><p>urlpatterns = [<br> path(‘home/’, views.home, name=’home’),<br> path(‘about/’, views.about, name=’about’),<br> path(‘contact/’, views.contact, name=’contact’),<br>]<br>```</p><p>In this example, each view function is mapped to a specific URL pattern using the `path()` function. The first argument of `path()` is the URL pattern (e.g., `’home/’`, `’about/’`, `’contact/’`), followed by the corresponding view function (`views.home`, `views.about`, `views.contact`). The `name` parameter provides a unique identifier for each URL, which can be used to reference the URL in templates or other parts of the code.</p><p>By configuring the URLs in this way, when a user visits the corresponding URL (e.g., `/home/`), Django will call the associated view function (`views.home`) and generate the appropriate response.</p><p>Understanding how to configure URLs for FBVs is crucial as it allows your views to be accessible through specific URLs, enabling users to interact with different pages and functionalities of your Django application.</p><p>Certainly! Here’s a detailed structure of a page explaining the above Class-Based Views example in two pages:</p><p><strong><em>Introduction to Class-Based Views</em></strong></p><p><strong>Title: Class-Based Views in Django</strong><br>Class-Based Views are a powerful feature in Django that allow us to handle different HTTP methods (GET, POST, PUT, DELETE) using class-based implementations. In this guide, we will explore the structure and components of Class-Based Views in Django.</p><p>1: Importing Required Dependencies<br>To get started with Class-Based Views, we need to import the necessary dependencies. In our example, we import the following:</p><p>- `View` from `django.views`<br>- `HttpResponse` from `django.http`<br>- `render` from `django.shortcuts`</p><p>2: Defining the Class-Based View<br>In Django, we define a class for our Class-Based View. For example, we have a class called `MyView` that extends the `View` class. This allows us to handle different HTTP methods by implementing the corresponding methods (`get()`, `post()`, `put()`, `delete()`).</p><p>Section 3: Handling GET Requests<br>Inside the `get()` method, we can implement the logic to handle GET requests. In our example, we render a template using the `render()` function. We pass the request, template name, and an empty context dictionary.</p><p>Section 4: Handling POST Requests<br>For POST requests, we implement the `post()` method. In our example, we return an `HttpResponse` with a message indicating that the POST request has been handled.</p><p>2: Handling PUT and DELETE Requests</p><p>Title: Handling PUT and DELETE Requests with Class-Based Views</p><p>Introduction:<br>In the previous page, we learned about handling GET and POST requests using Class-Based Views in Django. On this page, we will explore how to handle PUT and DELETE requests.</p><ul><li>Handling PUT Requests<br>To handle PUT requests, we implement the `put()` method in our Class-Based View. In our example, we include placeholder code to update an existing resource based on the provided data.</li><li>Handling DELETE Requests<br>For DELETE requests, we implement the `delete()` method. In our example, we include placeholder code to delete a resource or perform any other necessary operations.</li><li>Customizing the Template and Context<br>In our example, we use a template called ‘my_template.html’ for rendering the response. You can customize this template based on your requirements. Additionally, you can pass any relevant data to the template by updating the context dictionary in the `get()` method.</li><li>Conclusion:<br>Class-Based Views provide a flexible and organized way to handle different HTTP methods in Django. By implementing the appropriate methods in our Class-Based View, we can effectively handle GET, POST, PUT, and DELETE requests.</li></ul><p>Note: This is a simplified explanation of Class-Based Views in Django. For more advanced usage and customization options, refer to the official Django documentation.</p><p>I hope this explanation helps! Let me know if you have any further questions.</p><p><strong>Code Snippets</strong></p><p><strong><em>Class-Based-Views</em></strong></p><p>from django.views.generic import TemplateView</p><p># Create your views here.</p><p>class HomePageView(TemplateView):</p><p>template_name = ‘home.html’</p><p>class AboutPageView(TemplateView):</p><p>template_name = ‘about.html’</p><p>class SearchResultsView(TemplateView):</p><p>template_name = ‘search_results.html’</p><p><strong>urls.py</strong></p><p>from django.urls import path</p><p>from .views import HomePageView, AboutPageView, SearchResultsView</p><p>urlpatterns = [</p><p>path(‘’, HomePageView.as_view(), name=’home’),</p><p>path(‘about/’, AboutPageView.as_view(), name=’about’),</p><p>path(‘search/’, SearchResultsView.as_view(), name=’search’),</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=37c1d560d154" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to create a Django Project on Windows.]]></title>
            <link>https://medium.com/@rkiptoo5244/how-to-create-a-django-project-on-windows-9693e3606d2e?source=rss-c04dca921a75------2</link>
            <guid isPermaLink="false">https://medium.com/p/9693e3606d2e</guid>
            <dc:creator><![CDATA[Robert Kimaiyo]]></dc:creator>
            <pubDate>Tue, 21 Nov 2023 10:34:53 GMT</pubDate>
            <atom:updated>2023-11-21T10:34:53.112Z</atom:updated>
            <content:encoded><![CDATA[<p>Django is an open source and it is completely Free.</p><p>It is easy to build for beginners also.</p><p>It encourages rapid Development.</p><p>Django makes it easy to build web applications using Python.</p><p>Django is a backend server web framework that is written using the Python Programming Language</p><ul><li>Django is a high-level Python web application framework known for its quick development and clean design.</li><li>It is popular among web developers due to its ease of use.</li></ul><p>Django follows the Model-View-Controller (MVC) architecture.</p><p><strong>MVC architecture</strong></p><p><strong>Model — </strong>The model is the Logical data structure behind the complete application and is represented by a database (Mysql, Postgres)</p><p><strong>View —</strong> The View is the user interface that you see in the browser whenever you visit a website.</p><p><strong>Controller — </strong>The Controller is the middleman that connects the view and model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/534/1*pV7kMghFDnlpEbLEqDXwng.png" /><figcaption><strong>MVC architecture</strong></figcaption></figure><p><strong>For example </strong>— A user will enter a URL in their browser, and that request will go through the internet protocols(HTTP), to the server, which will call the Django.</p><p>When a URL is received by Django, it checks the urls.py file and calls the matching view from views.py</p><p>The view checks for relevant models which are imported from models.py. The view then sends data to a specified template in the template folder containing HTML and Django tags</p><p><strong>Advantages of Django</strong></p><p>l. Loose Coupling.</p><p>2. Scalable.</p><p>3. Rapid Development.</p><h3><strong>To start a Django Project.</strong></h3><p>Create a virtual environment in Windows using the command:</p><ul><li>python3 -m venv env</li></ul><p>(Where the env is the environment name you can call it any name)</p><ul><li>Activate the environment in Windows using this command(env\Scripts\activate)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vwp9n8tTR83gvuqmVUuCSA.jpeg" /></figure><p>Install the Django in your project folder</p><ul><li>pip install django</li><li>pip install django==4.1(It installs the specified version)</li></ul><p>To check Django version run the command</p><ul><li>django-admin — version</li><li>pip freeze &gt; requirements.txt</li></ul><p>Start to create the project</p><ul><li>django-admin startproject crm .</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/168/1*dY4mrWhrOffQT_ajzfCS1g.jpeg" /></figure><p>(CRM) Create a project with this name and ensure it is placed in the stated folder. Adding a period after the project name ensures it is created in the specified folder.</p><p>The manage.py file is the backbone of your Django application. Making any changes to it can result in critical errors or even cause the application to fail. Therefore, you mustn&#39;t modify the manage.py file, as it ensures the smooth running of your application.</p><p><strong>Running Migrations</strong></p><ul><li><em>python manage.py makemigrations</em></li><li><em>python manage.py migrate</em></li></ul><p><strong>Running the code</strong></p><p>python manage.py runserver</p><blockquote>The server will run on localhost:8000</blockquote><p>Thats the default port used in the Django application</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9693e3606d2e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Airtable Interfaces]]></title>
            <link>https://medium.com/@rkiptoo5244/airtable-interfaces-8c613654a920?source=rss-c04dca921a75------2</link>
            <guid isPermaLink="false">https://medium.com/p/8c613654a920</guid>
            <category><![CDATA[interfaces]]></category>
            <category><![CDATA[airtable]]></category>
            <dc:creator><![CDATA[Robert Kimaiyo]]></dc:creator>
            <pubDate>Sat, 09 Sep 2023 12:55:36 GMT</pubDate>
            <atom:updated>2023-09-09T12:55:36.793Z</atom:updated>
            <content:encoded><![CDATA[<p>Creating an application from Airtable interfaces requires following a specific process.</p><p>Login to your Airtable account if you already have an Airtable account otherwise sign up to create an account if you are new to Airtable.</p><p>After logging in, select your workspace. For example, I selected the corporate organizational chart that I had previously created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i0EMdf9fsGQlClpEvUs-Yw.jpeg" /><figcaption><strong>myworkspace</strong></figcaption></figure><p>This will take you to your base homepage where you will be able to access your data. You will see three features at the top of the page on the left side after the title of the page: Data, Automation, and Interface. Select the Interface feature from the options above to start creating the interface application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/657/1*RsLtxqYsVpwPC-szvZ0dmA.jpeg" /><figcaption>select</figcaption></figure><p><strong>Create an Interface</strong></p><p>The name of the Interface?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*AVHHA3SuwkKic_oBp67-RA.jpeg" /><figcaption>Name</figcaption></figure><p>Choose a Layout eg Blank</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D0wmZ8a_R-W1Cig9WinwEA.jpeg" /></figure><p>From the above selection, our page is now empty. We need to start adding resources to the page, such as selecting, dragging, and dropping.</p><p>Airtable provides several different interfaces that you can use to view and manipulate your data, such as a grid view, calendar view, gallery view, and Kanban view. Each interface is designed to help you visualize your data in a different way, and you can switch between them depending on your needs.</p><p>Selected Gallery View for data display interface.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nbNaWVYp0r6q-Ne_Nv-R2w.jpeg" /><figcaption>Gallery</figcaption></figure><p>If you want to filter data by status, select the “contractor” filter. This will show only the records with the status of “contractor”. If you don’t select this filter, all records except those with the contractor status will be displayed. This feature helps to minimize the amount of irrelevant information shown, making it easier to find the data you need.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xZsr5bgLkx9snk6pxtTr1w.jpeg" /></figure><p>The graph display in Airtable is an excellent tool that allows users to clearly and effectively represent the arrangement of resources</p><p>Graph representation of records.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*0q1nUjjdp5pz7cOQ9XWb0A.jpeg" /><figcaption>graph</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8c613654a920" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>