Shazeb
how to create a slug automatically?
Shazeb
i dont want a model feild for that
Shazeb
i just want to take the title and convert it into slug
Mahmoud
How to create slug in class based views
Shazeb
i have 15entries in the database and now i want to add unqiue slug to every existing feild.
Shazeb
can someone help me with this? id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
recipe_name = models.CharField(max_length=50)
slug = models.SlugField(unique=True)
Избранное
How to write a Model management command so that if you call it in the templates through the cycle, the request to the database does not go again every time in the cycle, but so that it is only once (even if this manager is called 200 times in the cycle)
Избранное
Tejas
def get_outlines_count(self):
count = self.get_descendants(include_self=True).aggregate(o_count=Count('outlines'))
return count
Д
Избранное
Д
if you can get your thing to work using that?
Д
but if you don't want to cache the WHOLE function but avoid the time-costing parts, then you can do something like pre-selecting or pre-fetching things - I'm not sure how well Django caches those between calls though, so you might have to save state, depending on where the Query\Objects live
Д
Д
Д
not because you don't know how to program
Избранное
Избранное
and now I want to know the finished implementation, rather than how to debug the code
Д
maybe i'm lazy :)
so you don't know how to program and you want me to solve a problem for you that should be already solved?
Д
functools won't solve wrong code. it will make life harder.
Избранное
Д
or that it won't be called more than 1 time or what
Избранное
Д
++
does the function have parameters...?
Избранное
Избранное
OMG)))) you solved this problem)
Д
Fan / Ac
Д
when people ask questions, I often solve them when they interest me, without telling the answer ;) no, but 99% of the time I talk people through, and I ask lots of questions
Д
when you do this for fun, you learn what mistakes happen. then you become a machine at solving problems.
Д
I've been doing this for probably 10 years
Д
I even sometimes do people's homework but don't give them the solutions.
Избранное
Д
Doragonsureiyā
Looks like you need an offtopic group, please continue this conversation at @pythonofftopic as it's not related to Python
Sourav
ModuleNotFoundError: no module named 'home'
Can anyone help?
Doragonsureiyā
Miqo
Hi i want to connect my rect project to rest api but when i send post request to my api, it displays “403 status code”. I tried Cors, but it didn’t help. How to solve this problem.
Cratos Events
How do I check profanity in Django??
Ohunjon
Ohunjon
And build a frontend for your api
Дмитрий Борисов
Khalil
Hi pleas what is the best hebergement web for application django
Fan / Ac
Dostow
A third option could be you are not executing the correct environment
Ankit
Can someone help me to launch a coding tutorials website?
Doragonsureiyā
German
i have problem with assertRaise
In my code i has
except ValueError:
raise ValidationError(
"qwerty"
)
And when i'm writing tests:
self.assertRaises(ValidationError, self.serializer.to_internal_value(self.data3))
where data3 is invalid value
Why do i have
E rest_framework.exceptions.ValidationError: [ErrorDetail(string='qwerty.', code='invalid')]
Д
Д
Saadi
Saadi
Use csrf_exempt in your views.
Saadi
I hope it will solve your issues.
Saadi
Hello every one. I am new to Django. So I have a very basic question that we use on our every project.
What is the best way to user registration with email verification by using django class based views. And Login, reset password.
I have so much confused because the veriety .
Д
Saadi
🙂 For me it's true.
Saadi
What is the good way of doing this job
Д
What is the good way of doing this job
people often use JSON Web Tokens (JWT) for authentication and authorization. that means there's a separate server that gives permissions to access the Django systems, but there are lots of things here that require very careful attention.
Д
I don't have any clean answers for this.
Д
I'm still trying to grasp how to do it properly.
Saadi
Yeah! this is going very complicated. I have searched a lot. But mostly I have got very basic solutions .
Д
German
Saadi
Д
if you can write the frontend for it, I think yes
Д
you'll have to write the AJAX calls and the whole thing will be written from scratch. there are no templates (or well, the idea is to not have)
Saadi
Saadi
Д
Andrej
Thanks brother @Andrej1a
You're welcome.
There are so many good plugins for Django. This is one of the reasons I like it so much.
Charly