Innovate anywhere, anytime withruncode.io Your cloud-based dev studio.

MicroPyramidBlog

Explore a blog dedicated to a wide spectrum of topics including Django, Python, Machine Learning, Salesforce, Angular, React, Flutter, Svelte, LINUX, and Amazon Web Services.

Django - Migrating from Function Based Views to Class Based Views

The single most significant advantage in Django class-based views is inheritance. On a large project it's likely that we will have lots of similar views. instead of writing the repeated code we can simply have our views inherit from a base view.

Integration of 2Checkout with Django

Payment Gateways which facilitate communication within banks and Security is an integral component of all payment gateways, as sensitive data such as Credit Card Numbers need to be protected from any fraudulent parties.We are having payment gateways like paypal,braintree,payumoney,2checkout... In this post,we will see how to integrate 2checkout with our django application.

How to Create Initial Django Migrations for Existing DB Schema

Django provides the comfort database migrations from its version 1.8, with which we can avoid the usage of third party packages like south. Adding migrations to new apps is straightforward - they come preconfigured to accept migrations, and so just run make migrations once you’ve made some changes. But if your app already has models and database tables, and doesn’t have migrations yet or you got your migrations messed up, you’ll need to convert your app to use migrations.

How to Create Custom User Model or Extend User Model in Django

Django provides built in authentication which is good for most of the cases, but you may have needs that are being served with the existing system. For Ex: You want 'email' for authentication purpose rather than Django's username field and you want an extra field called 'display_name' as full name for the logged in User. To meet the above requirements, we need to customize Django's built-in user model or substitute a completely customized model.

Customizing Django REST API Serializers

Customizing Django REST API Serializers

Understanding Routers in Django-Rest-Framework

By using routers in django-rest-framework we can avoid writing of url patterns for different views. Routers will save a lot of time for developing the API for larger projects. Routers generates standardized url patterns for better maintenance of url structure. We can expect consistent behaviour from viewsets and routers. We can also avoid repetitive code in views.

How to Document API Requests using Django Rest Swagger

Django Rest Swagger is used to Document your API for eg., Listing all Your project Rest API's in the browser with brief description about the API. In Developing an application, we will write our required API's. To Document these API's we use Django Rest Swagger.

Django Conditional Expressions in Queries

Reduce database queries in django with Conditional Expressions. By using Conditional Expressions we can use "If...Elif...Else" expressions while querying the database so that we can reduce the number of queries to the database and increase the response time. If we don't use conditional expressions in queries we have to write raw SQL queries or we have to hit/query the database for multiple times. That's the reason Django included Conditional Expressions from version 1.8

Querying with Django Q Objects

Querying with Django Q objects: Q object encapsulates a SQL expression in a Python object that can be used in database-related operations. Using Q objects we can make complex queries with less and simple code.

Django Unit Test Cases with Forms and Views

By writing unit test cases, you can evaluate each code component in the initial stage itself and it'll improve your app/code performance. Which is the best practice to test your code and you can easily determine if there are any errors.