Posts

Showing posts with the label Django

CRUD Operations using Django | CRUD Operation | Create Data | Read Data | Update Data | Delete Data | Django Framework | The ACX

 CRUD Operations using Django Create Data       def index(request): if request.method == 'POST' : fm=student(request.POST) if fm.is_valid(): nm = fm.cleaned_data[ 'name' ] em = fm.cleaned_data[ 'email' ] pw = fm.cleaned_data[ 'password' ] reg = User( name =nm, email =em, password =pw) reg.save() else : fm=student() return render(request, 'index.html' ,{ 'form' :fm}) Read Data      def Show_data(request): stud = User.objects.all() return render(request, 'Showdata.html' ,{ 'stu' :stud}) Update Data      def Update_data(request): if request.method == 'POST' :         pi=User.objects.get( pk =id) fm=student(request.POST, instance=pi) if fm.is_valid(): nm = fm.cleaned_data[ 'name' ] em = fm.cleaned_data[ 'email' ] pw = fm.cleaned_data[ 'password' ] ...

How to Start Django Project | Helloworld app Using Django Framework | Python Django tutorial for beginners | Getting started with Django | Django Framework | The ACX

Image
1. Create a new virtual environment, install Django, and then activate it.   (pip install django) 2. Creating a project (django-admin startproject mysite) Let’s look at what startproject created: These files are: manage.py: A command-line utility that lets you interact with this Django project in various ways. You can read all the details about manage.py in django-admin and manage.py. __init__.py: An empty file that tells Python that this directory should be considered a Python package. If you’re a Python beginner, read more about packages in the official Python docs. settings.py: Settings/configuration for this Django project. Django settings will tell you all about how settings work. urls.py: The URL declarations for this Django project; a “table of contents” of your Django-powered site. You can read more about URLs in URL dispatcher. asgi.py: An entry-point for ASGI-compatible web servers to serve your project. See How to deploy with ASGI for more details. wsgi.py: An entry...