Anonymous
So please how do i come through with phonenumber_fields in forms.py some one please show me syntax...include the widgets,google ain't helping
Randy
I add the AdminCookieSessionMiddleware class to Settings in MIDDLEWARE, which inherits from SessionMiddleware and in which process_request is overridden. But for some reason, when entering the page, the Middleware data does not work (they make a print in the overridden method)
Cheikh
Django
Eilia
Hi plz send a shot from your urls.py
William
Hello all, I have a User model with 3 roles Teacher, Student, Admin as the choices. I wanted to have only users whose role is Teacher in TeacherSerializer. So, like this for Students and Admins. When I creating Batch wise course I have to assign a Tutor(Teacher) in the api url under tutor I anted to show the users who are teachers. Who aren't teachers should not be included in that list
Skv
Check spellings are correct or not
Sumit
Hi, How can I develop a graphql api with django and neo4j?
Eilia
You miss a " path('', views.home, name='home') change it to path(''", views.home, name='home')
Eilia
++++
Eilia
Is your urls.py app look like this ?(check for typos) from django.contrib import admin from django.urls import path, include from django.urls.conf import include urlpatterns = [ path('', include('calc.urls')), path('admin/', admin.site.urls), ]
Anonymous
its urlpatterns[] and do not import include again.
Raju
Hi Expects..I am new to django..is it good to go ahead with mongodb..I need to develop app where need to read data from different collections and do patter identification of similar issues...pls suggest if this is not right
Anonymous
did you remove the 2nd include import?
Anonymous
use from django.urls import path ,include remive the 2nd import
Anonymous
remove*
Anonymous
from django.contrib import admin from django.urls import path, include urlpatterns = [ path("", include('calc.urls')), path('admin/', admin.site.urls), ]
Anonymous
share your calc urls.py file code
Anonymous
here also use urlpatterns..
Anonymous
from django.urls import path from . import views urlpatterns = [ path("", views.home, name='home') ]
Anonymous
use this.
Macurrent
Do i need to learn python data visualization as a django dev?? or will we use data visualization in django??
Anonymous
can you push your code on github?
Anonymous
ok mail me your zoom link on codehundred100@gmail.com
Rami
you imported HttpResponse from two different places, maybe that's the issue. Import just what you need: from django.http import HttpResponse
Anonymous
if you are comfortable with english then i would recommend follow corey schafer.
Anonymous
ok..
kunmi_od
I think so
Mo
where the parameters of get and post functions in django rest api (view.py) should be determined so we can see them in swagger ui parameters section?
William
Hello all, I have a User model with 3 roles Teacher, Student, Admin as the choices. I wanted to have only users whose role is Teacher in TeacherSerializer. So, like this for Students and Admins. When I creating a Batch wise course I have to assign a Tutor(Teacher) in the API URL under tutor I wanted to show the users who are teachers. Who aren't teachers should not be included in that list?
William
Does anybody know?
Anonymous
Heroku do not renders media from my app after some time, is there any alternative of heroku where we can put live project for free.
Macurrent
Is there an official site that guides on how to use django and materializecss?? I have seen some sites but am not sure about them eg 1. https://pypi.org/project/django-materialize-css/
Macurrent
Am looking for the right way to use materializecss with django
cj
https://daniel.feldroy.com/when-to-use-mongodb-with-django.html
cj
Any one pls suggest?
read that link ☝🏻
Raju
Thanks
Anonymous
cj
and this blog is 3 year older
so, imagine then how much better are relational databases now, if they were that good 3 years ago, they are much much better now, so no reason to use mongodb with django at all ¯\_(ツ)_/¯
cj
i am currently using mongo with django
nobody tell you can't... the point is: "you shouldn't"
Anonymous
😒
T I T T U
How to install command in ubuntu for start project in Django
pat
How to install command in ubuntu for start project in Django
First install a virtuel environment with Sudo apt install python3 python3-venv Then go to the folder you want to install django with the command cd /home/yourname/desktop/mydjangoproject Install the virtuel environnement in this project folder python3 - m venv djenv Launch the virtual environment with source djenv/bin/activate You will see the word djenv in front of your terminal line Install django in this environment python3 - m pip install django Then start your project django-admin startproject nameofyourproject Test it with python manage.py runserver Go to the address given in my case 127.0.0.1/8000
pat
I have a simple question myself : I have a folder with multiple .json files How can I open the content of these files then show them in a html page in django? Halp please
Adnan
I have a simple question myself : I have a folder with multiple .json files How can I open the content of these files then show them in a html page in django? Halp please
read the json files and load them with json module then use render method by adding the data you have loaded from json files
Adnan
In views.py?
yes in views.py simply but you can research better way
Owolabi
you can pass context to serializer
I figured it out. I passed the user id through the get_serializer_context() method which allowed me to access it for my validation on the serializer class. Thanks.
Anonymous
Pass remote user id in headers and it should intercept and authenticate the request
Akhil
Hello Everyone, I am Upgrading from django 1.6 to 2.2. Already having a legacy database with lot of generic relations in the project. Can anyone help to how should the django_content_type table should be populated. Should I use the same table from the exisiting db and fake the initial migration. Will it work?? Can django handle the rest of the part? as the relations will not break? Is there any chance to occur a problem for future migrations ?? Or Is there any other method for creating entries in django_content_type? Also, any documentation or links regarding this could possibly a great help! THANKS!
Vishnu
Why we use get_absolute_url and save method in model classes??
Odus
Why we use get_absolute_url and save method in model classes??
get_absolute_url is a function that handles rendering the resource detail page.
Shreya
I have one simple question: I have a browse button(to upload some files) By default it looks for the last opened directory. But i want to open directory of my choice. Can anyone please help me out.
Khumoyun
Hello, project: Django==3.1 Can I append custom app index in my DJango adminstration? If yes how? examples? P.S: I need display duplicate records from my_table
Sumit
hi, I want to display my image as url as follows 127.0.0.1:8000/media/images/product123.jpeg
Sumit
How, can I do this?
Sumit
I am storing my image as follows image = models.ImageField(upload_to="images")
Njain
Hello all can you please give me suggestions abou invoice number in django how i can give invoice number views and auto increment when a new order is prepare
Randy
https://dpaste.org/SEA6 Authorization passes, but the user does NOT appear in the session (in the request user does not appear in views)
Cheikh
Error Django.conf.urls can't import path
Anonymous
How to convert html file to pdf
Shoxrux
How can I change position of custom mixins fields in django admin ?
Sahil
i've psql db on clever cloud and django on heroku I can access remote db locally but seems to fail on deployment (programming error, relation X doesn't exist)
Sahil
but I'm able to access it locally..
Conditional elector of HRE
Hi everyone! Why ValueError: The view polls.views.login_user didn't return an HttpResponse object. It returned None instead. Here is the views.py code: def login_user (request): if request.method == 'POST': # create a form instance and populate it with data from the request: form = UserLoginForm (request.POST) # check whether it's valid: if form.is_valid (): name_user = form.cleaned_data ['user'] email_user = form.cleaned_data ['email_user'] password = form.cleaned_data ['password'] form.save () user = authenticate (request, username = name_user, email = email_user, password = password) if user is not None: login (request, user) # Redirect to a success page. else: print ("Incorrect data") return render (request, "polls / login.html", {"form": form}) I want him to take information from the form and login the user
Randy
https://dpaste.org/SEA6 Authorization passes, but the user does NOT appear in the session (in the request user does not appear in views)
Mukhil
bro i can't open http://127.0.0.1:8000/Desktop%20Printers already add path in url path('Desktop%20Printers',views.test,name='test'), any issue for space ( % ) models.py your_choices = ( ('Desktop Printers', u'Desktop Printers'), ('Industrial Printers', u'Industrial Printers'), ('Direct Thermal Printers', u'Direct Thermal Printers') ) printer_type = models.CharField(max_length=160, choices=your_choices, null=True, blank=True)