ZeroCool
Hello, I'm starting and I see that Django has an admin, do you always use that? Do you have a tutorial that explains how to implement an html, css template? ie change all the login and administrator?
Ôscar
Your data will remain there and wont be erased or modified until you do so
Charly
Ôscar
Ôscar
But you didn't tell me that
Charly
Ôscar
Charly
The context where your app runs is not persistent.
Ôscar
The storage system is different I know
Ôscar
Charly
Sofia
Anyone can suggest good and some complex project for resume in Django?
Andrej
CRINIT
I am looking for repository to track nearest lat long from my list of hotels which includes longitude latitude in api form DRF?
vsn
hey, I am trying to build a dynamic seat allocation for like bus according to the layout can you guys help me building logic for it like build seat according to the layout and provide dynamic number for the seat.
~Ronnie
How can I customize dj-rest-auth password reset email and change the {{ site_name }} to point to another link i.e https://thepivotclubku.co.ke
Arslan
Hello guys, who knows how to exclude a field from the output in ORM, that is, I write models.Car.objects.all(), all fields are displayed, but I need to exclude one, please help thanks in advance
~Ronnie
Through the object query manager there's an exclude method.
Arslan
Through exclude, I can find a field with a specific value, and I need to remove a field with any value
~Ronnie
Yeah check docs
~Ronnie
https://docs.djangoproject.com/en/4.1/topics/db/queries/
Rojitech
Rojitech
Rojitech
Exclusive
Maks
Hi! Please help:- I created a django project and it worked good, but after reinstallation Python it stops works. I have made VENV and install all packages from requirements.txt but project still does not work. What is the problem? I did not touch any line of code and before Python reinstallation all works good but after nothing works. (((
D
D
I hAVE searched but i didn't find Anything
...
Field defines a relation with model username
...
How to solve this error
Avina
Hey guys.
How can I connect frontend pages to backend?
In tutorials they first write the django code & then create templates.
But how can I do the opposite?
Mirco
Avina
Tnx for your reply 👍🏻
navid
hello everyone
I'm learning how the ajax response works in django
and as i understood ajax works with json data
my question is do i have to write serializers to create json data or working with built in django JsonResponse does the job?
also what would a more experienced programmer do for such projects?writing a serializer or just using the JsonResponse?
Viren
Can anyone tell me how to deploy Django rest app with react on aws ec2?
Sumit
Anyone know how do I use ccextractor with python or django
Mirco
Doragonsureiyā
Anyone know how do I use ccextractor with python or django
Don't ask meta questions like:
"Any user of $x here?"
"Anyone used technology $y?"
"Hello, I need help on $z!"
Just ask directly! The better you are at explaining the problem, the more likely you are to get help.
Asking smart questions
Jordane9999
hello Django Community please i need the help in django
Jordane9999
i should like create ecormerce web site in django but i began but i have small probleme
Jordane9999
my problemme is : i want to create for admin this functionnality who you permite to create multple product in one clic
Jacob
How to fix strptime() argument 1 must be str,not none....
Viren
Viren
Okk, bro thank you🙏
Mirco
Abdusalimov
Why need learn DRF ?
pls help me
Abdusalimov
Why need DRF ?
Abdusalimov
Abdusalimov
Mirco
Doragonsureiyā
Example do you have
Are you looking for Django REST Framework documentation?
Here you have it: https://www.django-rest-framework.org/
Abdusalimov
Abdusalimov
Sumit
Vɪᴠᴇᴋ
Я R
Hey
Please, can you help me with my Django code?
Doragonsureiyā
Hey
Please, can you help me with my Django code?
Don't ask meta questions like:
"Any user of $x here?"
"Anyone used technology $y?"
"Hello, I need help on $z!"
Just ask directly! The better you are at explaining the problem, the more likely you are to get help.
Asking smart questions
Maxim
Я R
OK, I have a problem with editing my note in the app
This is script from views.py
def edit(request, title, number):
post = get_object_or_404(Task, title=title)
tasks = Task.objects.order_by('-id')
number = int(number)
if request.method == "POST":
form = TaskForm(request.POST, instance=post)
if form.is_valid():
post = form.save(commit=False)
post.task = request.user
post.dt = timezone.now()
post.save()
return redirect('main')
else:
form = TaskForm(instance=post)
return render(request, 'main/edit.html', {'form': form, 'tasks': tasks, 'title': post.title, 'task': post.task, 'number': number})
Я R
I got this
'Tried to update field main.Task.task with a model instance, <SimpleLazyObject: <User: thekarenovich>>. Use a value compatible with TextField.'
Naggafin
Я R
Task field
Naggafin
in your Task model; so, what type of field is Task.task
Naggafin
in order to assign it to a user it needs to be of type ForeignKey with your User model as its base
Naggafin
unless you're wanting to assign to arbitrary models; in which case you would need to use GenericForeignKey
Naggafin
do you understand what I mean? I am asking because you have in your code:
post.task = request.user
Naggafin
OK, I have a problem with editing my note in the app
This is script from views.py
def edit(request, title, number):
post = get_object_or_404(Task, title=title)
tasks = Task.objects.order_by('-id')
number = int(number)
if request.method == "POST":
form = TaskForm(request.POST, instance=post)
if form.is_valid():
post = form.save(commit=False)
post.task = request.user
post.dt = timezone.now()
post.save()
return redirect('main')
else:
form = TaskForm(instance=post)
return render(request, 'main/edit.html', {'form': form, 'tasks': tasks, 'title': post.title, 'task': post.task, 'number': number})
opinionated suggestions I want to give you:
1) I would recommend you use class-based views instead of function-based views https://docs.djangoproject.com/en/4.1/topics/class-based-views/intro/ . when you get used to them, they really are better.
2) it can help with readability if you separate your context variables into their own context dict. i.e.:
context = {
'form': form,
'tasks': tasks,
...
}
return render(request, "main/edit.html", context)
Seyed Alireza
How can I create a login user with jwt ?