Skip to main content

Posts

WHAT IS DJANGO AUTHENTICATION?AND HOW TO MANUALLY WRITE THE CODE FOR THE SIGNUP, LOGIN AND LOGOUT?

In this post we see how to manually write the code for the user Registeration , Login and Logout. firstly we have to start a project and than start an app:      django-admin startproject user-authentication     $ cd user-authentication     $ python manage.py startapp accounts Once we have created an app we have to add this app in the INSTALLED_APPS  in settings.py. Than we have to add the path of the accounts app: "main project urls.py" from  django.contrib  import  admin from  django.urls  import  path,include from  django.conf  import  settings urlpatterns = [     path( 'accounts/' ,include( 'accounts.urls' )),     path( 'admin/' , admin.site.urls), ] if  settings.DEBUG:     urlpatterns=urlpatterns+static(settings.MEDIA_URL, document_root =           settings.MEDIA_ROOT)   ...

How to upload a csv file in django?

csv file:--> It stands for comma separated value files.It is in the form of the tabular format and we can open it in Microsoft Excel. Now see how we can upload it in the django..first we create a project in django.to create a project the commands are as follows:           django-admin startproject csv      $ cd csv      $ python manage.py startapp csvfile Once we have created an app we have to add this app in the INSTALLED_APPS  in settings.py. In the models.py we have to created two class one is Bank and other is Branch. from  django.db  import  models class   Bank ( models . Model ):     name = models.CharField( max_length = 50 )      class   Meta :         ordering = ( 'name' ,)      def   __str__ ( self ):          return   " {} ...