Click here to Skip to main content
15,885,768 members
Everything / Django

Django

Django

Great Reads

by Danny Chu
Learn how to detect if client has JavaScript enabled or disabled at your backend webserver
by Ahmed Bouchefra
In this tutorial, we’ll see by example how to create a CRUD application from scratch and step by step. We’ll see how to configure a MySQL database, enable the admin interface, and create the django views.
by Mikhail Smirnov
How to create a tool that helps to collect​ and analyze vital statistics information about users in one place​ using JavaScript.
by Programming Tutorials by Tests4Geeks
Django is all about making programmers more productive. As a web application framework, it provides tools and structure to help web developers get their work done fast.

Latest Articles

by Manoj Mohan 07
Use Django to visualize download stats of Python packages and gain insights into package popularity and usage trends
by Arctype SQL
When solving a problem that requires you to link a user's session data to their actual user object, Postgres comes in handy.
by Gen1us2k
Run GeoDjango on Elasticbeanstalk container using Python
by Ahmed Bouchefra
In this tutorial, we’ll see by example how to create a CRUD application from scratch and step by step. We’ll see how to configure a MySQL database, enable the admin interface, and create the django views.

All Articles

Sort by Score

Django 

29 Nov 2017 by Danny Chu
Learn how to detect if client has JavaScript enabled or disabled at your backend webserver
29 Jan 2019 by Richard MacCutchan
I just ran your code and got the following result: {'item_0': 'apples'} {'item_0': 'apples', 'item_1': 'banana'} {'item_0': 'apples', 'item_1': 'banana', 'item_2': 'oranges'} {'item_0': 'apples', 'item_1': 'banana', 'item_2': 'oranges', 'item_3': 'peaches'} {'item_0': 'apples', 'item_1':...
15 Jan 2020 by Ahmed Bouchefra
In this tutorial, we’ll see by example how to create a CRUD application from scratch and step by step. We’ll see how to configure a MySQL database, enable the admin interface, and create the django views.
22 Jun 2015 by Mikhail Smirnov
How to create a tool that helps to collect​ and analyze vital statistics information about users in one place​ using JavaScript.
9 Jan 2018 by Programming Tutorials by Tests4Geeks
Django is all about making programmers more productive. As a web application framework, it provides tools and structure to help web developers get their work done fast.
9 Jan 2018 by Programming Tutorials by Tests4Geeks
Django REST Framework tutorial
3 Jul 2019 by Cloudster
Deploy a 360 image gallery with Django, Bootstrap, Python, A-Frame, and PostgreSQL
15 Jul 2019 by Cloudster
Run command line Linux apps inside of Django to rapidly process 360 degree images.
20 Aug 2019 by Cloudster
Use Django logins to accept user "likes" and content submission
18 May 2020 by OriginalGriff
And what if request.method is not 'POST'? What values do username, password, and user contain then? That's what the error message means: you are trying to use a variable value, but you have never assigned a value to it.
22 Nov 2021 by Peter_in_2780
You can't. Http POST passes the name and value of the input element, not the ID. You need to use the value attribute to distinguish different buttons in a radio group. See HTML input type="radio"[^]
17 May 2015 by Sergey Alexandrovich Kryukov
Here: https://www.djangopackages.com/grids/g/charts[^].—SA
7 Jul 2017 by David_Wimbley
Since you mention this is for self development and learning new skills, my suggestion would be to break down your "problem" into smaller pieces are start tackling your desired functionality as separate "issues". This way you'll start with a basis of web development and move up towards...
6 May 2018 by Jochen Arndt
The datetime is not stored in the format "May 7, 2018, 11:33 a.m." in the database. It is returned formatted in that way by some function used to query the databse. SQLite knows three different formats to specify dates and times: Datatypes In SQLite Version 3[^]: TEXT as ISO8601 strings...
15 Dec 2019 by Ahmed Bouchefra
How to send Ajax requests in Django 2 and Python 3.7 to add CRUD operations in your application and manipulate your Django models and database without having to refresh your web pages each time
15 Dec 2019 by Ahmed Bouchefra
A Django 2 CRUD example application using generic class based views using the latest Python 3.7 version
31 Mar 2020 by Nelek
Sorry... but it is your final year project and you give the impression of not having a clue on what was taught during the year. You are not asking anything. You are just giving your assignment and trying to get us do it for you. That's not going...
31 Mar 2020 by OriginalGriff
We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, it's part of your grades and it wouldn't be at all fair for us to do it all for you. So we need you to...
31 Mar 2020 by Patrice T
Quote: Hope you are all well from Corona Personally, I prefer Chimay and Orval. :) Quote: I tried my best to make a exam scheduling module but could not do that. So please help me. The problem is that your description is so vague that I can...
6 Aug 2020 by Member 14844261
Hey guys, I am developing a Django website and I have the following models (simplified): class Profile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) opinions = JSONField(default=default_opinions) class...
8 Apr 2022 by markkuk
The map() function[^] returns an iterator and you must convert it to a list before you can serialize it. return JsonResponse(list(sw_list), safe=False)
4 Jul 2022 by HellySoni
I have one excel file which have candidate details such as name,position,place,email and date. And I am importing that file into my project for bulk import, but it is gives error while importing date column even if I stored date in excel in...
4 Jul 2022 by HellySoni
Thank you all for your response I tried to convert it with xldate and it is successfully inserted with this line of code. CreatedDate = datetime.datetime(*xlrd.xldate_as_tuple(sheet.cell(r, 7).value,book.datemode))
26 Aug 2022 by Richard MacCutchan
The problem is that every time you call update_dict it creates a new printerdict variable. So it only ever adds one item to the dictionary and then terminates the function. You need to create the dictionary as a global, so it exists beyond the...
20 Nov 2022 by OriginalGriff
"." is not a module name. See Iulian Onofrei's solution: https://stackoverflow.com/questions/9439480/from-import-vs-import[^]
21 Nov 2022 by Kornfeld Eliyahu Peter
It is only possible if base.html functioning as a base/master page - which is not supported in plain html, but supported in many development packages... Like Django templating... Django | Creating and Using MasterPages[^]
23 Jan 2023 by Dave Kreskowiak
That's not the best approach. You should be taking the data you used to generate the HTML table and just generate the Excel or CSV file instead. Converting the HTML to Excel or CSV is unwise as the only data type you're going to get is a string,...
16 Feb 2023 by Manoj Mohan 07
Use Django to visualize download stats of Python packages and gain insights into package popularity and usage trends
22 Aug 2023 by Dave Kreskowiak
This code executes once, when the page loads: var videos = document.querySelectorAll('video'); for(var i=0; i
22 Aug 2023 by Richard Deeming
The standard approach for handling events on new elements which don't exist when you assign the event handler is to use event delegation[^]. You wire up the handler to a parent element, and check the target to ensure that it's an element you want...
16 Feb 2024 by Andre Oosthuizen
You have basically answered your own question without knowing it - Quote: Then I made my consumers.py (here I'm a little bit confused, isn't it better to refer to my room unique_id instead of name, since the ID is unique and not the name in my...
23 Oct 2013 by daizhan
In Django1.5 documentation , there is a section about related_name. the last paragraph is "If you’d prefer Django not to create a backwards relation, set related_name to '+' or end it with '+'. For example, this will ensure that the User model won’t have a backwards relation to this model:user =...
7 Nov 2013 by Sergey Alexandrovich Kryukov
If you mean http://en.wikipedia.org/wiki/Pygame[^], http://www.pygame.org[^], I don't think it can target Web applications.If your goal includes using Python on client side (this is how I could interpret your "run it on the Web browser"), look at pyjs instead, which targets both Web and...
30 Nov 2013 by daizhan
I want to show different page for different device, such as PC and mobile. Is there any way to tell the user-agent in request, and pass the result(the type of device) to the corresponding view? I don't want to differentiate between them in each view.what i can find is subclass the View class...
10 Dec 2013 by askquez
I have created Djnago project in eclipse. Unfortunately, i am facing issue when i run the projectImportError at / No module named urlsHere Error PageEclipse Projecturls.py Contentfrom django.conf.urls import patterns, include, urlfrom django.contrib import...
3 Jan 2014 by Jkri Jay
i was upload file in google app engine using django i was success in upload file as well as data and i was seen the file in blob viewer but how can download that file using django code?i can not retrieve the list of file which is uploaded and also i was get that file.
6 Jan 2014 by Member 10508281
I am using Django 1.6 and i create one login API and create session on login. problem is that when i am already logged in and try to login again i got new session variable. i want same variable.Login APIdef login(request): """Documentation for login function. the login function is used...
3 Mar 2014 by Vidhu Shah
I was following a django tutorial online (Mike Hibbert's) and at tutuorial 4 he completed the basic articles app and at one point he goes to the url with the extension '/articles/all', all of his objects show up, wheres as when i try it, only the first one appears... its works perfectly when i...
1 Mar 2014 by Peter Leow
Ask the owner ((Mike Hibbert).
4 Mar 2014 by nameJulian
You have to add your project to PYTHONPATH in eclipse. Go to preferences -> PyDev - PYTHONPATH and add your project.
16 Mar 2014 by askquez
i am newbie to django and developing rest api using Django rest framework gis. Previously i was using sql query for transform geometryselect id,name,round(value::numeric,2) as value, st_transform(geometry, 3857) as geometry from my_modelclass MyModel(models.Model): name =...
22 Mar 2014 by christo4040
The below code is for my like button. The button itself comes through on the html document where it is supposed to be. But it seems that nothing happens when clicked. I have no idea how to make the code work, so that a user can click the button, and it actually gets stored in the database. Can...
27 Mar 2014 by askquez
I am trying to transform geometry column in django, here is my modelclass Network(models.Model): name = models.CharField(max_length=50, blank=True) alias = models.CharField(max_length=100, blank=True) geometry = models.GeometryField(srid=3857, null=True,...
7 Jul 2014 by 09hadi
Hello everyone, I recently started working with Python django (a compulsion by my company). I have been trying to get it working but it keeps on giving me errors. Can anyone please help me with this? I am getting "ImportError at / No module named 'models'"I am following this...
23 Aug 2014 by JustCurious'1
Hello There. I am working on a small website and I need to send thread-post data through JSON.This is the JSON object django serves:[{"text":"Some sample text","id":"21","title":"Test Thread"}]I saved this as a .js file and the following Javascript code works fine:
5 Sep 2014 by Member 11062637
I have made a custom group.How can i display all user groups present, as radio buttons (in template) so that user can select only one group while creating a user account & on save button, currently selected user group should be set as group of new user account?
26 Sep 2015 by Member 12013439
I have to learn Django but I have no experience in building web applications or anything related to databases.I have learnt Python but don't know where to begin Django.I have found many resources about it but most of it doesn't make a lot of sense.How do I begin , Can someone please help me ?
27 Sep 2015 by Palash Mondal_
Please have a look at this video tutorial series on Django:Try Django Tutorial 1 of 21[^]
28 Sep 2015 by jakecook
I would say the quickest way to learn a new framework is working on a project with that framework. You can either create a new website from scratch using Django or check Github for other people's Django project.
19 Nov 2015 by Member 12153818
I am trying to develop a log in web application that can be accessed by multiple clients. So far I have made a simple log in page, using a template in python tools for visual studio, in visual studio 2013. The log in function works, getting data from a dqlite3 database. I have created a...
13 Jan 2016 by DeDenker
For non blocking TCP communication look at Gevent module
14 Jan 2016 by prowler421
Hey,I tried to install django after python installation (3.4.0 version), the problem began when i tried to run the simple command: "pip install django" via the cmd - it did nothing (descending line and writes nothing). I forced it to apply the installation using the command: "python -m pip...
20 Jan 2016 by Anand Moorthy
Is there any way to restrict the ajax call when it's called by outside of the app, i am running a django app which calls the ajax when we go the index page and it's returning some json out. My problem is my app have to run the ajax call only when it's called from my webapp alone. If it's called...
3 Feb 2016 by Member 12306946
I'm trying to make a code-name(*i.e: Test Post will be TP-1, TP-2 ...*) thing on Django. There is **news** model, and **post** model i got. When user create news title hence post's codename will be according it's news's title. For example the `news.title='Test News'` then assume that I...
28 Apr 2016 by Member 12490003
I have been recently tasked with the development of a web application and I need to make sure the path I have chosen to approach the problem is a good one.The web application is supposed to be some kind of dashboard, in which people login and get some analytical info, mostly in the shape of...
28 Apr 2016 by VR Karthikeyan
I would suggest Angular JS for front end development, it is a nice and rapid development framework from google. And developing responsive, neat and stylish UI from scratch takes long time for beginners, so just use UI frameworks like bootstrap or google material UI. You can use google charts...
13 Aug 2016 by Member 12564006
I explain my problem as better as I can:I have a program written in 3 modules. I want to save some data from a site (Now I'm using a local host to make tests) to some variables and show some variables' value in the index page in this way:1.- [Script: Text_Variable]
13 Aug 2016 by Member 12564006
I have a script which pretend to create a form in my site and receive the response, let's call it script.py.This script needs to call a function in views.py:opc = newproject.views.Menu_Options(request, ask, Options)This function needs to use request.POST, so needs to receive "request"...
13 Aug 2016 by Member 12564006
please, I need help with that "request" object that is making me despair...I read that theoretically "request" in views is an "HttpRequest" object but I have a script which needs to call a views.py function, which needs to use that "request" so receive it as argument.Then I tried to...
13 Aug 2016 by Member 12564006
I fixed it! I realised that I forgot to pass the "request" parameter when I call my script main funcion. That's why my external script "didn't know" what "request" was.
13 Aug 2016 by Member 12564006
I fixed it! I realised that I forgot to pass the "request" parameter when I call my script main funcion. That's why my external script "didn't know" what "request" was.
13 Aug 2016 by Member 12564006
I fixed it! I realised that I forgot to pass the "request" parameter when I call my script main funcion. That's why my external script "didn't know" what "request" was.
7 Sep 2016 by Member 12258122
Hello All,I am very new to Django and I already have a working code for uploading multiple files. The problem I am having is that when I hit the upload button, it takes me to another page. How can I make it to stay at the page where the upload button is clicked. Also, I would a...
3 Oct 2016 by Bhuvanesh A
in my project , i want block a IP for accessing my site in django (create unwanted traffic or unwanted access the server that purpose)What I have tried:i don't know from where to start and where to finish, now i'm only have concept like above mentiond
3 Oct 2016 by F-ES Sitecore
django block ip - Google Search[^]
3 Oct 2016 by Karthik_Mahalingam
ask here Django view/track Tickets[^]Code.Django[^]
12 Nov 2016 by virusx1984
I've defined a model class in MyApp/models.py:class Machine_Category(models.Model): category = models.CharField(max_length = 100) def __str__(self): return self.categoryclass Machine(models.Model): machine_id = models.CharField(max_length = 100) ...
10 Jan 2017 by Member 12943415
Hi, I am trying to integrate my existing code into django. How do i access models.py from my external code.I tried putting it in the same apps directory it did not work. Is there a way ? My Case: I have a web parsing code that takes data from the web and prints it. I want to integrate it...
2 Jul 2020 by nishantsinghchandel
The option is not visible in template file.What I have tried: Title
28 Mar 2017 by Raymond WY Tang
I'm implementing a django and will deploy to Azure, as the wfastcgi got errors several times before, so I changed it to httpplatformhandler, unfortunately, as I reviewed the log, I always get server error 500 while running, but I really cannot catch the errors where it came from, so, could...
16 Apr 2017 by Richard MacCutchan
Django python - Google Search[^].
29 May 2017 by Farah M. Chaaban
Hello i don't know what is the problem with my template. My template is decomposed into 3 types of radio buttons : Long, short, long and short When i click on each radio button a form appears. Till now everything is okay. But i want to put in the form of radio button "long and short", two...
29 May 2017 by Farah M. Chaaban
problem code project - Album on Imgur[^]
11 Jul 2017 by David_Wimbley
You can use both, they are both frameworks intended to make your life easier. If you go the route of django or angular you should probably start with their respective sites to look through their documentation and tutorials. Getting started | Django documentation | Django[^] Angular -...
18 Sep 2017 by Andriken
i have no idea what happen to django , i am using django 1.8.6 and with python 3.5.2 i am working on form's and the form's validation like field validation work's well but i noticed the validation error for empty field was'nt rasing an error, by default django set required field to True , and...
27 Nov 2017 by Member 13520270
I'm trying to build a messaging app. Here's my model, class Message(models.Model): sender = models.ForeignKey(User, related_name="sender") receiver = models.ForeignKey(User, related_name="receiver") msg_content = models.TextField() created_at =...
22 Nov 2017 by vijith.squadz
You can use "pyodbc" module to connect to Hive.
27 Nov 2017 by Dhruv Singh
In the template, use an if condition that checks your receiver and sender for a particular message. Something like {% if abc.receiver == request.user %} # this means that the current user is the receiver {% endif %} Similarly you should be able to do it for abc.sender. You'll need to pass...
11 Dec 2017 by Yashit Maheshwary
Here's what I mean. I have this model: from places.fields import PlacesField class Lol(models.Model): source = PlacesField() destination = PlacesField() The issue is that whenever I select the source location, the same is selected for the destination and vice versa. What I have tried: ...
2 Jan 2018 by Member 13604642
Here is my custom permission template tag(templatetags/init.py, user_perm.py): from django import template from django.contrib.auth.models import Permission from django.shortcuts import get_object_or_404 register = template.Library() @register.filter(name='has_perm') def has_perm(user,...
26 Jan 2018 by Member 12731696
Hello all I have already install djang-celery-beat in an other python environment with python 3.5 and django 1.11. But when i am trying to install the same in an environment with python 3.6 and django 2.0, it FAILS and throws some error that i cannot find any reference in the net. Please help...
26 Jan 2018 by Richard MacCutchan
extensions/_libastro.c:3:20: fatal error: Python.h: No such file or directory You need to find out why this header file is missing from the distribution. Check the directories listed on the -I options of the gcc command preceding the error message.
6 May 2018 by codeXprojectX
Hello friends, I am trying to fetch records of certain date range in Django, i googled to see if i can get some solution but nothing seems to work. Date time saved in database is "May 7, 2018, 11:33 a.m." and the date format i get from html is in "2018-05-01". Because the date format is...
26 May 2018 by codeXprojectX
I have a html code with two tabs(Users and Groups)..Now,when i click on first tab,i should display the "Users" tab content by dynamically fetching records from database and similarly for second tab "Groups" tab contents. But i am having problem fetching the second tab-content and displaying...
13 Aug 2018 by Ruban Bharath
I Have two tables Name-fields(username,age) Type-fields(gender) These are my two tables and i want to copy these data and merge them into a new separate table like this using sqlite3 output table-fields(username,age,gender) make me out of this question What I have tried: i have tried...
8 Nov 2018 by SaeedPol
When I make django project on visual studio there is no admin page. Can anyone help me how to set up the admin page in visual studio? I mean the admin.py page. Which commands should be run. I have tried many methods but none succeeded. thanks Saeed What I have tried: I have tried many...
4 Jan 2019 by Member 14108446
Hi everyone, I am currently learning Djnago and situation is the following. I have a legacy database, I connected it to Django. In this database I have names of schools. I have written a code in python that uses those names and returns lat and lng from Google API. Here is the code: def...
29 Jan 2019 by Member 12743673
How to sort the dynamic updated dictionary data every time new keys are updated in the dictionary? It gives me a random order for the keys whenever i try to print the dictionary after updating. mydict ={"item_0": "apples"} print(mydict) mydict.update(item_1="banana") print(mydict)...
4 Apr 2019 by Member 14145830
It's my first question in this forum :D so my question is why do i need a web api to link between django and other js frameworks for example django with angular? And is it necessary to build a web api like (rest api) to link between back end and front end? Thanks a lot. What I have tried: ...
11 Feb 2019 by Member 14068174
Guys I am tried to relate my url in anchor tag of my html file but I am getting a no reverse match error ,The file i am trying to relate is having the right location also it, been initialised in views and urls too . Here,s the views.py code for this relative view from django.shortcuts import...
15 Feb 2019 by Member 14068174
Hello I am trying to make a decision based radio buttons, I am trying to land the client on the page based on which radio button he checked but it lands me on same page no matter if I choose another button. It stills loads me to the same page The code is below: views.py def index(request):...
20 Feb 2019 by Member 14068174
Hey guys I am trying to make a blog in django.It has two html files . Index.html and blog.html, the index.html consists the links to blog.html , The index has a overview to the actual post. And the blog.html conbsists actual posts ,I have rendered them by for loop ,But The problem I am gettings...
25 Feb 2019 by Member 14068174
Hey guys I am trying to make a comment form in django but the problem I am facing is that while posting that comment ,It gets posted on every other post .. I want it to display specific to the post where the user will comment as a normal comment form works. Here's the views.py def...
4 Apr 2019 by Bohdan Stupak
Because Django is not js library. It's a Python-based server framework. So your JS library communicates with a server via REST Api
7 Apr 2019 by SaeedPol
Hello I've added an external library in djangDjangoave installed in installed apps but when I try to migrate the model I keep getting this error: Error is: ?: (admin.E408) 'django.contrib.auth.middleware.AuthenticationMiddleware' must be in MIDDLEWARE in order to use the admin application. ?:...
26 Apr 2019 by Brandon Cavinee
I am making my first application with Django. The goal is to have a table rendered from my SQlite database that displays the current inventory of laboratory reagents. Once a reagent is taken out of storage a user will be able to hit a subtract button to subtract from the current inventory....
12 May 2019 by Member 14365934
how to dispaly data in dropdown when i click on first dropdown item ,means related or filtered data suppose i click on city dropdown all the city related devices from same table will be displayed for perticular city in python django What I have tried: -----views.py--------- def...
24 Jul 2019 by Member 14539300
I’ve a model that gives details about a stadium. Once user is on the page of stadium, there’ll be list of other stadiums which are in neighbouring vicinity to current stadium, along with their distances from current stadium. I want to implement this in django. So, suppose there are two stadiums...
24 Jul 2019 by Gerry Schmitz
They're ALL "neighbors"; the only difference is the "distance". You're asking the wrong questions. Given a stadium, find (at run rime) all other stadiums within 10k (for example); not, "who are my neighbors?" All it requires is Lat/Long and the ability to calculate a distance between 2 points...