Doragonsureiyā
zeus
How to get latest entry form db tables in django
zeus
Ok I need only the last registered person details then I can pass it to my template
chipolino
zeus
chipolino
from not form
zeus
chipolino
Thank you ❤️
maybe there is a function in django last then it is not necessary to sort in reverse order only in direct
zeus
Suren
query = self.request.GET.get('q')
sights = Sights.objects.filter(
Q(title__icontains=query) |
Q(content__icontains=query)
)
how to reply that query is not found, if it is not found?
.
hi
the form just does not appeare
and i couldn't find out where the problem is
here is the view
def updateWorker(request,pk): formName = 'Worker'
worker = Staff.objects.get(worker_id=pk) form = StaffForm(instance=worker)
if request.method == 'POST':
worker.name = request.POST.get('name') worker.age = request.POST.get('age')
worker.address = request.POST.get('address') worker.department = request.POST.get('department')
worker.title = request.POST.get('title')
worker.email = request.POST.get('email') worker.phone = request.POST.get('phone')
worker.salary = request.POST.get('salary')
worker.rate = request.POST.get('rate') worker.save()
return redirect('home')
context = {formName:'formName',form:'form',worker:'worker'} return render(request, 'users/test1.html',context)
Chayeb
.
Chayeb
rtg
Hi! I continue with error in DJANGO-ALLAUTH using google API: Access blocked: The request from this application is invalid....Error 400: redirect_uri_mismatch
rtg
Does anyone master this tool?
rtg
Now is ok, i delete the "Orígenes autorizados de JavaScript" url and now is ok
rtg
now only have URI redirect http://localhost:8000/accounts/google/login/callback/ And other (Javascript... is null). But is ok.
rtg
thanks!
Mirco
Doragonsureiyā
thanks!
You're welcome! 😊
.
hello
i made a view to update an object but when i send the form i still get this error {{Cannot assign "'2'": "Staff.department" must be a "Department" instance.}}
in models i've made a field to replace the id with "worker_id" is this the probelm ?
the model:
class Staff(models.Model): name = models.CharField(max_length=200,null=True)
age = models.IntegerField() address = models.CharField(max_length=25,null=True)
worker_id = models.AutoField(primary_key=True)
V
[ {“Dg set”: “Diesel generator”}, {“Organization”: “Organisation”}, {“Group”: “Organization”}, {“Orange”: “Kinnu”}, {“Orange”: “narangi”} ]
Expected Output:
[[“Organization”, “Organisation”, “Group”], [“Dg set”, “Diesel generator”], [“Orange”, “Kinnu”, “narangi”]]
Peter
[ {“Dg set”: “Diesel generator”}, {“Organization”: “Organisation”}, {“Group”: “Organization”}, {“Orange”: “Kinnu”}, {“Orange”: “narangi”} ]
Expected Output:
[[“Organization”, “Organisation”, “Group”], [“Dg set”, “Diesel generator”], [“Orange”, “Kinnu”, “narangi”]]
Share view responsible for this output too for quicker help
h
Hey all, hope you are doing great. I have one small question to ask, why the initialization of middlewares happens from bottom to top? To explain it a bit more lets say I have 2 custom middleware A and B and I have added a print statement at the init function now the one thing I noticed is that the print statement for B is executed first and then the A part. As the initialization happens as soon as we start the dev server I do not get why the execution of initialization is bottom to top?
Thanks
C.
I try to use gunicorn deploy django at windows but I have an error ModuleNotFoundError: No module named 'fcntl'
Muhammadali
Muhammadali
if you want deploy to ubuntu server I’ll help with my pleasure
C.
Thanks a lot for your kind support
Muhammadali
UnforgivenIII
hey guys can u pls tell road map to find good job in django
داودخان
AttributeError: 'DjangoTestAdapter' object has no attribute 'factory'
getting this error in test
Baqer
داودخان
Pavel
Hello friends, could someone point me to the most noticeable errors in the project. No one has ever reviewed my code, so I may not be aware of many mistakes and bad practices. Thanks to those who respond.
Github: https://github.com/welel/noted
Adorilson
Pavel
Same
Hello. Does anyone know why when I add whitenoise to my Django project in production, it only shows me a Server Error 500 and no message in the console?
Riad
Should I learn html rendering stuffs in django? Web development now a days are heavily api based. Is there any point to learn html rendering?
chipolino
chipolino
Riad
chipolino
in spa you use html layout elements
chipolino
for example in react
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(<h1>Hello world!</h1>);
chipolino
Using raw html css is too boing and tedious now, SPA is everywhere.
const root = ReactDOM.createRoot(
document.getElementById('root')
);
function tick() {
const element = (
<div>
<h1>Hello, world!</h1>
<h2>It is {new Date().toLocaleTimeString()}.</h2>
</div>
);
root.render(element);}
setInterval(tick, 1000);
Riad
I am fluent in DRF, and hesitating should I learn django templating or not
chipolino
chipolino
in yout study list
Same
Same
I am trying to deploy a production project in Render, so I resorted to Whitenoise to handle static files as it is what the render documentation recommends, but I have not been successful in deploying
chipolino
chipolino
do you use proxy server in your project?
Same
chipolino
did you read this doc?
https://whitenoise.evans.io/en/latest/django.html
Same
chipolino
chipolino
is it library?
Same
or PythonAnyWhere
chipolino
try to run the project on local machine
chipolino
use docker docker-compos or venv if you can
chipolino
try to get css for example or js from simple http request in browser by full adress
chipolino
try to start new empty project and just add WhiteNoise
Doragonsureiyā
Are you looking for Django REST Framework documentation?
Here you have it: https://www.django-rest-framework.org/
Ashish
Hello sir,i am new in python so i really don't know much,so please can you help me to find a solution of the problem
Write a programme to implement 8-puzzle using steepest ascent hill climbing in python?