Tuple in Python PYTHON by Ravinder Nath Rajotiya - March 12, 2022March 20, 20220 Tuples Tuples in Python are similar to lists. A tuple is a sequence of comma separated numbers. A tuple can be decared as a sequence by enclosing or without enclosing them inside the () bracket and all elements are separated with commas. Elements in a tuple can be accessed via unpacking or indexing. Following are the two ways to declare the tuple in Python. a). Declaring and accessing tuple using indexing: >>>tup=(3,4,5,6,7) Or >>> tup=3,4,5,6,7 >>>tup1 (3,4,5,6,7) >>>tup[2] 5 >>>tup(3) 6 Since the tuple is immutable, A tuple does not have the append () or insert () method, nor can it be assigned to another element. >>>tup1=(3,4,5,6,7) >>>tup1[0]= 2 will give an error. TypeError: 'tuple' object does not support item assignment Because a tuple is unchangeable, the code is more secure. Therefore,
Introduction to Python PYTHON by Ravinder Nath Rajotiya - February 23, 2022March 13, 20220 Introduction to Python Python is one of the mostly used programming language in the world. Python is a general-purpose interpreted, interactive, object-oriented, and high-level programming language. Guido van Rossum created this during 1985- 1990. Python is an open source programming language and its source code is available under the GNU General Public License (GPL). Some key features of python – Python is Interpreted: Python is processed at runtime by the interpreter. You do not need to compile your program before executing it. This is similar to PERL and PHP. Python is Interactive: You can sit at a Python prompt and interact with the interpreter directly to write your programs. Python is Object-Oriented: Python supports Object-Oriented style or technique of programming
Django- User Profile Management Django by Ravinder Nath Rajotiya - January 13, 2022January 20, 20220 User Profile Management In the previous tutorial Django-User Login and Logout users able to login and logout. There was no user profile when they login. We need to have a user profile. Default Django view model does not have a feature to add user profile picture, We can do it by extending the user model to add more fields, In this tutorial we’ll learn how to use Django signals to run specific functions after certain actions which can be extremely useful for this type of work. We will extend user profile and create a profile model that will have a one-to-one relationship with the user. One-to-one relationship means that one user can have one profile and one profile will be associated with
Django-User Login and Logout Django by Ravinder Nath Rajotiya - January 11, 2022January 15, 20220 User Login and Logout: In this tutorial we are going to see how to create the authentication system for our Django applications so that the users can login, logout. Also the users need to be logged in, in order to access certain pages. The registration page created in the Django- Admin and Users registration post was used only by admin, but the users were not able to login. So, we have to create a login page for the frontend where users will be able to register, login or logout. Django has lot of functionality taking care for us at the backend. So, we get started with using the default LoginView If you want the users to login and have access to certain
Django- Admin and Users registration Django by Ravinder Nath Rajotiya - January 9, 2022January 10, 20220 Introduction Well, one of the important part of dynamic sites is to create users so that one can have access to the database to enter data, to delete , edit or update the data, to authorize users to have an access to certain data set. Django provide an admin page by default. This can be accessed just by typing admin after the url i.e. localhost:8000/admin and you will see a page as seen below: But you can't do anything here right now. We have to first create super admin who will be responsible for the overall management and users with the roles to have access to certain pages or data. Let us first create a superuser from the command-line. Creating super user Well, If you