R
Sorry i'm a newbie... If you can show me something better i'm glad to learn more 😀
from the view side you should validate that the request being performed is a get and deny it otherways, you could also validate that is an ajax request and regarding the queryset you could just use .first() https://docs.djangoproject.com/en/dev/ref/models/querysets/#first) and I would also validate that the value is not None and return it as json. Additionaly, I may be wrong but I dont see much sense in implementing an ajax view which always gets the same Person proto from db and increments that value (which can just be 0 or 1) by one, but I guess it might have some reason due to your domain logic
Nadir
I will try with .first Thanx. Every Person as a tipologia (0 or 1) but the prot increments by one from the last Person that have the same tipologia, so you can have 2 same prot. I hope i could have explain it
R
R
anyways, if I understand it properly, the user can't change his prot number so you could just don't use that ajax view and assign the prot number automatically on the server side when saving the model
Nadir
Yes you understand it right but i don't know how to, surely for my ignorance, get the value from tipologia without POST the entire form and i need that value to know which type of person i have.
Nadir
Anonymous
Hi, can you help me: I want filter a foreign key list but I don't have idea for make it.
For example:
Post has comments, in comments model have post_id
If posts can choose a status solved and not solved
How I can filter in foreign key list not solved posts for comment on it without see solved posts.
My English is bad, sorry
Luis
Anonymous
blog with django and bootstrap https://github.com/marcoscoder/blog-django-bootstrap
hosted at: http://marcoscoder.pythonanywhere.com/blog/
Luis
Combot
Luis López (1) has increased reputation of Marcos (1)
Anonymous
Luis
Hope it helps :)
Anonymous
Hi friends..I am a beginner in software developing I know the basics of python ... and now I will start to learn django... So how can I start??... Any good tutorials for user registration and login and logout using session... 😊.... Thank u
entropy
Anonymous
Thank u....
Mukhammad Ali
How to order by manytomany relation?
Mirco
Mukhammad Ali
Need to order by manytomany count. e.x.
Mukhammad Ali
class Single(models.Model):
title = models.CharField()
class ToOrder(models.Model):
title = models.ManyToManyField(Single)
Mukhammad Ali
ToOrder.objects.all().order_by(title_count>1)
Mukhammad Ali
something like this
R
Need to order by manytomany count. e.x.
you can define the through model of your m2m relation and set the ordering or use smth like this https://github.com/gregmuellegger/django-sortedm2m (have not used this lib though)
Mukhammad Ali
Found a better option, now checking to None )
Manish
hii
Manish
https://screenshots.firefox.com/TbIS2Q2scvhXw1HB/localhost
Manish
https://screenshots.firefox.com/tA5e78fCWeTdyLHk/localhost
Manish
please someone help me on reset password forms in django2.1
Rajjix
Show views.py and url.py related
Rajjix
class PostListAPIView(ListAPIView):
serializer_class = PostListSerializer
renderer_classes = (JSONRenderer, )
def get_queryset(self):
return Post.objects.all()
Rajjix
when i request the page in my browser it shows verified json formatted data, but when i fetch it with react which is on another server it's not fetching the data
Rajjix
fetch('http://xx.xxx.xxx.xx/posts')it works fine when i fetch json data from other websites
Mirco
Rajjix
Rajjix
how could i forget
Rajjix
i'll check it now
Mirco
Rajjix
It works with postman
Manish
Денис
Hey. Can you tell me whether I can use 2.1.2 with django-cms or not?
Mirco
It works with postman
Good, so your endpoint is not broken 😂
Have you tried to use proxy url inside react settings , so you can use the same address for Django and react ?
Денис
I've just been stuck with Django 1.11 not compatible with python 3.7 but that's what I have out of the box on my system, no wish to install multiple 3.x
Rajjix
Rajjix
Luis
Rajjix
Mirco
Good! Happy 4 ya 😀😀
Manish
Luis
@iFlare3G can you give us a hand here? I can't find the problem
Mirco
What's the main issue ? No reverse match ?
Luis
Yep
Mirco
For password_confirm ?
Luis
For password_reset_complete
Rajjix
url positioning maybe? 🤔
Rajjix
Longest on top shortest on bottom is how i do it to avoid some conflicts just a wild guess tho
Luis
success_url is given to PasswordResetView.as_view , but does it need something like "complete_url"? or something like this ?
Luis
Or PasswordResetDoneView.as_view the success_url poiting to complete view?
Rajjix
I do use complete uri on success_urls
starting with a “/“
Manish
isn't there any other way for authentication form except django.contrib.auth.forms?
Manish
like nodejs have
Mirco
Mmm the main issue is on defining urlpattern
Luis
I think namespace is the problem...
Manish
Mirco
Yup, maybe
Luis
app_name='profiles'
Manish
Mirco
Nope , that is used for namespacing your urls
Mirco
So in your template you can do profiles:url-name
Mirco
What url u pass to button that redirects to password complete ?
Manish