Anonymous
Anonymous
In your views.py file
Anonymous
Man search YouTube or Google
0x01
JavaScript
zara
How to build a LMS?
0x01
HR app??
Yeah. Applicants have to fill a form, upload resume and submit
JavaScript
Kirime
Hi guys/girls!
I have a model with field subject = models.CharField(
max_length=128,
blank=True,
)
and ModelForm.
How can I do it CORRECTLY so that when entering more than 128 characters into a field, there is not a server error (500), but a message about exceeding the maximum length?
I tried MaxLengthValidator- doesn't work.
Mohit
How to listen to Postgres sql notify in Django? Having hard time running the listener and Django server
Mohit
Any suggestion is appreciated
Mr
I will appreciate it if you could go through my app and give me some pointers
Mohit
Which app
Mr
I a site using django and built an an apk around it...
Rucha
I am doing one deep learning project for that I have create one model and save the model in .pth format
Rucha
Now i want to deploy the model in django
₩almer
edit the record
₩almer
When you update an error log
when I remove the force_update parameter it works but the data is saved with ' and )
Oloba
I'm trying to get a user created in django by their primary key, but all I get is an error. Unexpected keyword argument 'pk' which I've included in my routing
Oloba
Anybody, somebody
Deleted
Show you code
Prosto
Oloba
Show you code
path('portfolio/<int:pk>', views_register.portfolio, name = 'portfolio'),
Oloba
Show you code
def portfolio(request):
context = {
'users': User.objects.get(user_id = request.user.id)
}
return render(request, 'users/portfolio.html',context)
Oloba
Show you code
{% extends 'base.html' %}
{% block content %}
<div class="content-section">
<div class="media">
<img class="rounded-circle account-img" src="{{ user.profile.image.url }}">
<div class="media-body">
<h2 class="account-heading">{{ request.user.username }}</h2>
<p class="text-secondary">{{ user.email }}</p>
<p class="text-secondary">{{ user.pk }}</p>
</div>
</div>
</div>
{% endblock %}
Oloba
What I'm trying to get is a user by their id
Oloba
Prosto
Oloba
and view.py for that?
def portfolio(request):
context = {
'users': User.objects.get(user_id = request.user.id)
}
return render(request, 'users/portfolio.html',context)
navid
use
user=request.user
navid
the user field is also unique
navid
Oloba
make the above change here
portfolio() got an unexpected keyword argument 'pk'. where I'm not getting it is under routing. I'm getting the above error because I'm trying to access via primary key
Oloba
For posts/articles I'm able to but users is where I'm getting an error
navid
ur sending it through the url but not getting it in the view function change:
portfolio (request) to portfolio (request, pk)
navid
but i don't really see the point in sending the pk what are you using it for?
Aslan
Hello, i created registration form through User model, now i want to style the fields, i styled email, first_name and last_name but i don't know how to style password field
Gee
Hi, how to change redirect_uri?
Shahrukh
Hi Team, I'm facing one error.
Can anyone help in fixing this error "No connection could be made because target machine actively refused it"
Georg
hello. Is there any way to autogenerate spectacular schema for swagger?
Mirco
Ruslan
Georg
drf-spectacluar
Yeah. I mean exactly dfr-spectacular. But the question was about autogeneration of a scheme
Mirco
Georg
well ))) I mean if I can autogenerate something like this
https://ibb.co/16HP01j
Software Engineer
Sphinx
Yes that's great to use
Mirco
Georg
ok. thanks
Abolfazl
Hi everybody, i wanna make countdown timer for my project.which every product in my site has its own timer. but how can the time be saved for each product? for example i have a product that has 2 days left. but user can reload the page and see the current remained time updated compared to last visit. Does everyone know this?
cj
cj
or even better, use an "available until" date —somewhere in your database also— and make calculations (in the backend, of course) using that time and show the result in your frontend
¯\_(ツ)_/¯
cj
don't make those kind of calculations in the frontend side
Dipanshu Vora
Hello everyone
I need to create an API to display some particular field from different models so how can i do it??
cj
Doragonsureiyā
Dipanshu Vora
Charly
Already did
And what you have found in the documentation?
Dipanshu Vora
I have done it but my code is bulky and its not code optimization at all
Charly
Prog Hisham
Hello everyone,
In my model i have an image stored as base64
The question is How can i display it as an image in django admin?
GMA
Hi can we create ang api to run locally our django project?
Neo
Neo
you can create an api and run it locally during development yes
Neo
im assuming that is what your question is
.
what is this error?
django.db.migrations.exceptions.MigrationSchemaMissing: Unable to create the django_migrations table (permission denied for schema public
LINE 1: CREATE TABLE "django_migrations" ("id" bigint NOT NULL PRIMA...
Charly
GMA
Dinesh
Hii
Daniel
Hi
Daniel
I am learning Django and I want to raw sql query to Django ORM functions
Doragonsureiyā
Daniel
select CAST(EXTRACT(EPOCH FROM (stop_time - start_time)) AS integer) payroll_time, user_id, start_time, stop_time from payroll_time_period where workspace_id={} and start_time >= timestamp '{}' and stop_time <= timestamp '{}'".format(workspace_id, start_time, stop_time)
Daniel
Can you guys help me to convert above line to Django ORM ?
Malik
Hi guys, i need to reach the beast level in django,
Any advanced courses on youtube?