Re: Form errors in ListFormsetView created by adding methods to a ListView.

2021-06-11 Thread Lalit Suthar
>
> possibly you are requesting with the same pan id again
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVEZrLnepGWh77os7Kvx-xZ6X0mHKgE7FoAL%2BmVH7GBxbQ%40mail.gmail.com.


Re: Working with forms

2021-06-15 Thread Lalit Suthar
you can try if it can be done with widgets I am not sure
https://docs.djangoproject.com/en/2.2/ref/forms/widgets/

On Tue, 15 Jun 2021 at 11:24, Williams Andy Inc 
wrote:

> I would like to know is there any easier way rather than overriding super,
> how do i add icons into the html input eg to have a key icon on the
> password field
>
> without installing any third party app also.
>
> is the best solution to render form in html and pass field values to
> django? or is there anyway to manipulate django and insert a text between
> input
>
>
> django has this
> 
>
>
> i want to have this
>  >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/946421cf-4abf-45cd-b40c-f3639203b43bn%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVHRMgxFF9km7%3D5eQP8wDi3ePuOveyN3vkjJj1hRL0BVJA%40mail.gmail.com.


Re: Support for moving a model between two Django apps #24686

2021-06-07 Thread Lalit Suthar
It does look long and weird but we hardly visit /admin since we do most of
the operations from python manage.py shell

On Fri, 4 Jun 2021 at 11:42, Mike Dewhirst  wrote:

> On 4/06/2021 2:28 pm, lalit suthar wrote:
> > We had a similar problem and we resolved it by moving all the models
> > into a separate internal python package.
> > We can have a separate app in our django project also for writing
> > models only and all other apps import models from there.
>
> Interesting.
>
> What does the main menu of the Admin look like?
>
>
> >
> > On Friday, 4 June 2021 at 06:07:53 UTC+5:30 Mike Dewhirst wrote:
> >
> > I can see a ticket https://code.djangoproject.com/ticket/24686
> > <https://code.djangoproject.com/ticket/24686> which
> > would likely solve my current need to merge two apps.
> >
> > Is the code OK to try out?
> >
> > Happy to test it.
> >
> > Cheers
> >
> > Mike
> >
> > --
> > Signed email is an absolute defence against phishing. This email has
> > been signed with my private key. If you import my public key you can
> > automatically decrypt my signature and be sure it came from me. Just
> > ask and I'll send it to you. Your email software can handle signing.
> >
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Django users" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> > an email to django-users+unsubscr...@googlegroups.com
> > <mailto:django-users+unsubscr...@googlegroups.com>.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/django-users/27fb1633-e8be-43e1-b92e-f92409347731n%40googlegroups.com
> > <
> https://groups.google.com/d/msgid/django-users/27fb1633-e8be-43e1-b92e-f92409347731n%40googlegroups.com?utm_medium=email_source=footer
> >.
>
>
> --
> Signed email is an absolute defence against phishing. This email has
> been signed with my private key. If you import my public key you can
> automatically decrypt my signature and be sure it came from me. Just
> ask and I'll send it to you. Your email software can handle signing.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/bf3f0499-21e8-3a05-3c01-6c02d2b7b603%40dewhirst.com.au
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVFCBWcpN3v7E3o07CVdKqnT5zmZ9xLkPYRtn46oZrvz3g%40mail.gmail.com.


Re: ValueError

2021-06-08 Thread Lalit Suthar
https://stackoverflow.com/questions/26829435/collectstatic-command-fails-when-whitenoise-is-enabled

On Wed, 9 Jun 2021 at 01:55, Lloyd Mawira  wrote:

> I am getting this error after running python manage.py collectstatic.
> Someone help please.
>
> ValueError: The file 'css/webfonts/fa-brands-400.eot' could not be found
> with  at 0x020C84CEFF40>.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/b602e13a-4b76-4599-b502-92d47d3573c4n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVFeV3gjLXys-u_%2BTTgFDw6C%2BVbmLd3O0puFjGsvQ2qTLA%40mail.gmail.com.


Re: Is async class-based view available?

2021-06-08 Thread Lalit Suthar
https://docs.djangoproject.com/en/3.2/topics/async/

On Wed, 9 Jun 2021 at 08:11, kazuki  wrote:

> I'm already using a web application that takes advantage of class-based
> views. And I want to take advantage of the async class-based view.
> However, I can't find any information when I look it up. Is there a class
> such as async_view? I want to use TemplateView and ListView asynchronously.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/6c150890-4c8a-46fe-985d-a07ab17bb63en%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVH0vReFKGo6VtsZMkRT%2BbE06UHB8T60wX6XD8nM-GPwQQ%40mail.gmail.com.


Re: RelatedObjectDoesNotExist: User has no vendor

2021-06-09 Thread Lalit Suthar
vendor = Vendor.objects.get(created_by=request.user)
you have to pick vendor like this

On Wed, 9 Jun 2021 at 15:43, GWISU MANYANDA  wrote:

> thank you Lalit for you respond
> I have changed this line
>
>  vendor = request.user.vendor
>
> to
>
> user = vendor.created_by
>
> Now i'm getting this error
>
> NameError at /maduka/vendor_admin/
>
> name 'vendor' is not defined
>
>
> On Wed, Jun 9, 2021 at 11:10 AM Lalit Suthar 
> wrote:
>
>> coming because of `vendor = request.user.vendor`
>> you have attached user to vendor so you can access user from vendor by
>> doing
>> `user = vendor.created_by` but you can not access vendor from user
>>
>> On Wed, 9 Jun 2021 at 12:43, GWISU MANYANDA 
>> wrote:
>>
>>> Hi Every one! I 'm looking for help.
>>>
>>> I'm working with  a multi vendor website using django. But there is an
>>> issue that I have vendor object vendor but it says User has no vendor. Why
>>> is this happening and how may I solve this?
>>>
>>> *MY model*
>>>
>>> from django.contrib.auth.models import Userfrom django.db import 
>>> models*class Vendor*(models.Model):
>>> name = models.CharField(max_length=255)
>>> created_at = models.DateTimeField(auto_now_add=True)
>>> created_by = models.OneToOneField(User, related_name='vendor', 
>>> on_delete=models.CASCADE)
>>> class Meta:
>>> ordering = ['name']
>>>
>>> def __str__(self):
>>> return self.name
>>>
>>> *My View*
>>> *def become_vendor(request)*:
>>> if request.method == 'POST':
>>> form = UserCreationForm(request.POST)
>>> if form.is_valid():
>>> user = form.save()
>>> login(request, user)
>>> vendor = Vendor.objects.create(name=user.username, 
>>> created_by=user)
>>> return redirect('frontpage')
>>>
>>> else:
>>> form = UserCreationForm()
>>> return render(request, 'vendor/become_vendor.html', {'form': form})
>>> @login_requireddef vendor_admin(request):
>>> vendor = request.user.vendor
>>> return render(request, 'vendor/vendor_admin.html', {'vendor': vendor})
>>>
>>> *Error i'm getting*
>>> RelatedObjectDoesNotExist at /maduka/vendor_admin/
>>>
>>> User has no vendor.
>>>
>>> Request Method: GET
>>> Request URL: http://127.0.0.1:8000/maduka/vendor_admin/
>>> Django Version: 3.1.3
>>> Exception Type: RelatedObjectDoesNotExist
>>> Exception Value:
>>>
>>> User has no vendor.
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAKjP07mdfQgHL_hTsXRuUzGTveJJG9VFbTOxQ7ma7DviSCnGaA%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAKjP07mdfQgHL_hTsXRuUzGTveJJG9VFbTOxQ7ma7DviSCnGaA%40mail.gmail.com?utm_medium=email_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAGp2JVEhHbX6PUPLxqV3AJFRAAwkMYvWcOrDb4z%3DdDVmw14mzQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAGp2JVEhHbX6PUPLxqV3AJFRAAwkMYvWcOrDb4z%3DdDVmw14mzQ%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAKjP07ngUQvLJfooY4RDBrZevdvdQ9-ir1sfEkvVcRHTinGyew%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAKjP07ngUQvLJfooY4RDBrZevdvdQ9-ir1sfEkvVcRHTinGyew%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVEdhxdoLyqt%3Ds6U7tBvsng89EXFKBfHbA%3DoAyzQSi%2B8dA%40mail.gmail.com.


Re: RelatedObjectDoesNotExist: User has no vendor

2021-06-09 Thread Lalit Suthar
coming because of `vendor = request.user.vendor`
you have attached user to vendor so you can access user from vendor by doing
`user = vendor.created_by` but you can not access vendor from user

On Wed, 9 Jun 2021 at 12:43, GWISU MANYANDA  wrote:

> Hi Every one! I 'm looking for help.
>
> I'm working with  a multi vendor website using django. But there is an
> issue that I have vendor object vendor but it says User has no vendor. Why
> is this happening and how may I solve this?
>
> *MY model*
>
> from django.contrib.auth.models import Userfrom django.db import models*class 
> Vendor*(models.Model):
> name = models.CharField(max_length=255)
> created_at = models.DateTimeField(auto_now_add=True)
> created_by = models.OneToOneField(User, related_name='vendor', 
> on_delete=models.CASCADE)
> class Meta:
> ordering = ['name']
>
> def __str__(self):
> return self.name
>
> *My View*
> *def become_vendor(request)*:
> if request.method == 'POST':
> form = UserCreationForm(request.POST)
> if form.is_valid():
> user = form.save()
> login(request, user)
> vendor = Vendor.objects.create(name=user.username, 
> created_by=user)
> return redirect('frontpage')
>
> else:
> form = UserCreationForm()
> return render(request, 'vendor/become_vendor.html', {'form': form})
> @login_requireddef vendor_admin(request):
> vendor = request.user.vendor
> return render(request, 'vendor/vendor_admin.html', {'vendor': vendor})
>
> *Error i'm getting*
> RelatedObjectDoesNotExist at /maduka/vendor_admin/
>
> User has no vendor.
>
> Request Method: GET
> Request URL: http://127.0.0.1:8000/maduka/vendor_admin/
> Django Version: 3.1.3
> Exception Type: RelatedObjectDoesNotExist
> Exception Value:
>
> User has no vendor.
>
>
>
>
>
>
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAKjP07mdfQgHL_hTsXRuUzGTveJJG9VFbTOxQ7ma7DviSCnGaA%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVEhHbX6PUPLxqV3AJFRAAwkMYvWcOrDb4z%3DdDVmw14mzQ%40mail.gmail.com.


Re: Newbie question

2021-06-07 Thread Lalit Suthar
try form.save(commit=False)


On Mon, 7 Jun 2021 at 22:10, Moose Smith <47kanga...@gmail.com> wrote:

> I have a table which holds simple data like addresses. Created a form
> which displays the records in the form and allows the user to select a
> record "address" to edit.
>
> I want this edit function to be generic so it will work on any table
> without me having to define fields etc... and using  ModelForm I
> accomplished by goal.
>
> Django creates a form and using instance='myrecord' it even populated the
> fields in the form with the record I want to edit. I can edit my fields
> and now it is time to save the changes back to the database.
>
> I found a .save() method for
> # Create a form to edit an existing Article, but use
> # POST data to populate the form.
> >>> a = Article.objects.get(pk=1)
> >>> f = ArticleForm(request.POST, instance=a) >>> f.save()
>
> My question is this:
> The .save method discuss in the Django Documentation above is a method of
> ModelForm but I have rendered my form and when I hit the SUBMIT button the
> edited fields are returned in a WSGI type object which does not have a save
> method.
>
> I can use the POST data and pass the PK and so on, and update the record
> manually with some code. BUT WHAT is the use of a .SAVE method on a
> ModelForm. In order to edit the form I need to RENDER it right?
>
> Is there a way to return the ModelForm object with the edited fields and
> then save back to the database?
>
> Thanks
>
> Moose
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/6ccb9692-5f95-4f8a-86b1-18259b00c0dan%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVH-Da2AeUFzoXWsdPUQrg5%3Dg2ch8pToeA%2BSsdNNYSC4hQ%40mail.gmail.com.


Re: Drop down dependent of more than 2 drop downs

2021-06-07 Thread Lalit Suthar
Hi how did you implemented the first
couple of drop downs and what problem you are facing in the third one
exactly




On Mon, Jun 7, 2021, 1:02 PM Eugene TUYIZERE 
wrote:

> Hello team,
>
> Am having trouble implementing drop down dependent on more than 2 drop
> downs. I successfully did for two but the 3rd one which should depend on
> the second does not work. Is there someone who has successfully implemented
> this and share with me the way I can do it?
>
> Thank you
>
> --
> *TUYIZERE Eugene*
>
>
>
> *Msc Degree in Mathematical Science*
>
> *African Institute for Mathematical Sciences (AIMS Cameroon)Crystal
> Garden-Lime, Cameroon*
>
> Bsc in Computer Science
>
> *UR-Nyagatare Campus*
>
> Email: eugene.tuyiz...@aims-cameroon.org
>eugenetuyiz...@gmail.com
>
> Tel: (+250) 7 88 26 33 38, (+250) 7 22 26 33 38
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CABxpZHsgG5FmCEbGwKnp7dr_DF_Yip7z-M6kJRgE-yzT21DmaQ%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVEaNFLy%3DH2A3azsiE3Cayz5QaxHJ%3DhWzzGGVQ0B40Rbrg%40mail.gmail.com.


Re: Support for moving a model between two Django apps #24686

2021-06-07 Thread Lalit Suthar
oh great, good luck with that :D

cheers!

On Mon, 7 Jun 2021 at 19:40, Mike Dewhirst  wrote:

> Ok - fair enough. On the other hand we do use the Admin extensively and
> because we made a mistake during design which we would like to fix, we want
> to move a couple of models from one app to another.
>
> Ticket #24686 looks brilliant and might be implemented in the dev version
> of Django.
>
> Maybe I'll give it a try.
>
> Cheers
>
> Mike
>
> --
> (Unsigned mail  from my phone)
>
>  Original message 
> From: Lalit Suthar 
> Date: 7/6/21 22:38 (GMT+10:00)
> To: django-users@googlegroups.com
> Subject: Re: Support for moving a model between two Django apps #24686
>
> It does look long and weird but we hardly visit /admin since we do most of
> the operations from python manage.py shell
>
> On Fri, 4 Jun 2021 at 11:42, Mike Dewhirst  wrote:
>
>> On 4/06/2021 2:28 pm, lalit suthar wrote:
>> > We had a similar problem and we resolved it by moving all the models
>> > into a separate internal python package.
>> > We can have a separate app in our django project also for writing
>> > models only and all other apps import models from there.
>>
>> Interesting.
>>
>> What does the main menu of the Admin look like?
>>
>>
>> >
>> > On Friday, 4 June 2021 at 06:07:53 UTC+5:30 Mike Dewhirst wrote:
>> >
>> > I can see a ticket https://code.djangoproject.com/ticket/24686
>> > <https://code.djangoproject.com/ticket/24686> which
>> > would likely solve my current need to merge two apps.
>> >
>> > Is the code OK to try out?
>> >
>> > Happy to test it.
>> >
>> > Cheers
>> >
>> > Mike
>> >
>> > --
>> > Signed email is an absolute defence against phishing. This email has
>> > been signed with my private key. If you import my public key you can
>> > automatically decrypt my signature and be sure it came from me. Just
>> > ask and I'll send it to you. Your email software can handle signing.
>> >
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups "Django users" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> > an email to django-users+unsubscr...@googlegroups.com
>> > <mailto:django-users+unsubscr...@googlegroups.com>.
>> > To view this discussion on the web visit
>> >
>> https://groups.google.com/d/msgid/django-users/27fb1633-e8be-43e1-b92e-f92409347731n%40googlegroups.com
>> > <
>> https://groups.google.com/d/msgid/django-users/27fb1633-e8be-43e1-b92e-f92409347731n%40googlegroups.com?utm_medium=email_source=footer
>> >.
>>
>>
>> --
>> Signed email is an absolute defence against phishing. This email has
>> been signed with my private key. If you import my public key you can
>> automatically decrypt my signature and be sure it came from me. Just
>> ask and I'll send it to you. Your email software can handle signing.
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/bf3f0499-21e8-3a05-3c01-6c02d2b7b603%40dewhirst.com.au
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAGp2JVFCBWcpN3v7E3o07CVdKqnT5zmZ9xLkPYRtn46oZrvz3g%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAGp2JVFCBWcpN3v7E3o07CVdKqnT5zmZ9xLkPYRtn46oZrvz3g%40mail.gmail.com?utm_medium=email_source=footer>
> .
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/60be28ce.1c69fb81.81ffc.00bfSMTPIN_ADDED_MISSING%40gmr-mx.google.com
> <https://groups.google.com/d/msgid/django-users/60be28ce.1c69fb81.81ffc.00bfSMTPIN_ADDED_MISSING%40gmr-mx.google.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVGA_9okJ55a37gYZNbVz5HrUYmNuv1Ms38z%2B%3DCiVngoow%40mail.gmail.com.


Re: Is async class-based view available?

2021-06-10 Thread Lalit Suthar
these are some resource available which can help you
https://www.youtube.com/watch?v=19Uh_PA_8Rc
https://testdriven.io/blog/django-async-views/

On Thu, 10 Jun 2021 at 10:27, kazuki  wrote:

> I know this However, I don't know how to use it.
> How can I use this to create an asynchronous AsyncListView or
> AsyncTemplateView?
>
> 2021年6月9日水曜日 13:28:16 UTC+9 sutharl...@gmail.com:
>
>> https://docs.djangoproject.com/en/3.2/topics/async/
>>
>> On Wed, 9 Jun 2021 at 08:11, kazuki  wrote:
>>
>>> I'm already using a web application that takes advantage of class-based
>>> views. And I want to take advantage of the async class-based view.
>>> However, I can't find any information when I look it up. Is there a
>>> class such as async_view? I want to use TemplateView and ListView
>>> asynchronously.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/6c150890-4c8a-46fe-985d-a07ab17bb63en%40googlegroups.com
>>> 
>>> .
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/bc2d10c7-ddde-4f3f-bb71-acd2abfacafen%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVGoEhq5piePOqA%2B1g_tShk%2BcBk1EeaFoSEM15O_47GSJg%40mail.gmail.com.


Re: [DRF] Serializing a field of type choice

2021-06-09 Thread Lalit Suthar
can I see that model field, I don't think any extra configuration is
required for it

On Thu, 10 Jun 2021 at 04:44, ezequia...@gmail.com 
wrote:

> Hey guys
>
> Could you help me with a Django Rest Framework question?
>
> I have a field in my model that has possible input values, so I'm using
> the *choices=* attribute in my model.
>
> I'm having difficulty serializing the return of this data in drf.
>
> Could someone give me a hint on how best to implement this, please?
>
> Sincerely
> Hezekiah Rock
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/b6cd89ca-06be-4d5d-bdd0-ba9cbb952e72n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVFT22C-6m4121LLQWpXZuzAy8Vtbqviy2TVVTJu3JJTKA%40mail.gmail.com.


Re: django cron Job Functionality

2021-06-12 Thread Lalit Suthar
https://medium.com/@yedjoe/celery-4-periodic-task-in-django-9f6b5a8c21c7
http://docs.celeryproject.org/en/latest/django/first-steps-with-django.html
http://docs.celeryproject.org/en/latest/userguide/index.html#guide
https://www.agiliq.com/blog/2015/07/getting-started-with-celery-and-redis/

On Sat, 12 Jun 2021 at 12:26, Ayser shuhaib 
wrote:

> Watch this video on how to schedule a task or function in your Django
> project, I’m sure it will have the answer to your question:
>
> https://youtu.be/t0xHlgWQvAk
>
>
> On Sat, 12 Jun 2021 at 08:54, Ayser shuhaib 
> wrote:
>
>> https://youtu.be/t0xHlgWQvAk
>>
>>
>> On Sat, 12 Jun 2021 at 08:53, Ayser shuhaib 
>> wrote:
>>
>>> Watch this video on how to schedule a task or function in your Django
>>> project, I’m sure it will have the answer to your question:
>>>
>>>
>>>
>>>
>>> On Sat, 12 Jun 2021 at 08:41, Eugene TUYIZERE 
>>> wrote:
>>>
 Thank you for recommendations,

 Because I never use this Celery-beat, if possible you can give some
 sample for example for someone who used it before

 thanks

 On Sat, 12 Jun 2021 at 06:36, Nikeet NA 
 wrote:

> You should use celery for running cron jobs.
>
> On Friday, 11 June 2021 at 19:49:41 UTC+5:30 kells...@gmail.com wrote:
>
>>
>> What I would do in such case, is to write a function somewhere that
>> checks if a user applied for a leave, then check if the leave time is
>> within a day, then do whatever you want, like setting is_active to False.
>> Then set the cron job to run this function every day, every hour, or
>> however you'd like.
>> On Fri, Jun 11, 2021 at 15:10 Chetan Ganji 
>> wrote:
>>
>>> This will help you
>>>
>>> https://pypi.org/project/django-celery-beat/
>>>
>>>
>>> On Fri, Jun 11, 2021, 5:34 PM Eugene TUYIZERE 
>>> wrote:
>>>
 Dear Team,

 In my application, I want a user to set for example a leave plan in
 the system and the system notify the user by email for example one day
 before the start leave date. At the same time the system disables the 
 user
 in the system. Here I have a field *is_active *and I want the
 system to set it to False from the leave date to the end date. And 
 also to
 set Ongoing status on the leave plan user list. I heard somewhere that
 Django Cron Job can do this but I never use it and I do not know how 
 to use
 it in the application.
 If someone has used  it for some time please I need help.

 Thank you

 --
 *Eugene*

 --
 You received this message because you are subscribed to the Google
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it,
 send an email to django-users...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CABxpZHt2hqPgNU%2BvyDb8Eua%2B6_OMM8H6xsMzTgJ-73-0erfmKw%40mail.gmail.com
 
 .

>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it,
>>> send an email to django-users...@googlegroups.com.
>>>
>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAMKMUjvErhZDkdA1ZYPOxHq4yuEWk%3DKUsbrgSyX3LOm7FBhFyw%40mail.gmail.com
>>> 
>>> .
>>>
>> --
>> KeLLs
>>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/bf837066-b07b-47fb-a404-098b64516ec0n%40googlegroups.com
> 
> .
>


 --
 *TUYIZERE Eugene*



 *Msc Degree in Mathematical Science*

 *African Institute for Mathematical Sciences (AIMS Cameroon)Crystal
 Garden-Lime, Cameroon*

 Bsc in Computer Science

 *UR-Nyagatare Campus*

 Email: eugene.tuyiz...@aims-cameroon.org
eugenetuyiz...@gmail.com

 Tel: (+250) 7 88 26 33 38, (+250) 7 22 26 33 38

 --
 You received this message because you are 

Re: Using ORM to retrieve values (REAL) from SQLite database to round to 2 decimal places

2021-06-19 Thread Lalit Suthar
this can help
https://docs.djangoproject.com/en/2.2/ref/models/database-functions/#round

On Fri, 18 Jun 2021 at 22:43, Wai Yeung  wrote:

> Hello,
>
> To be able to get a REAL value from a SQLite database rounded to 2 decimal
> places, I had to use the following RAW SQL query:
>
> SELECT
> printf("%.2f", round(orig_total,2)),
> FROM final_billing_tbl
>
> I would like to be able to duplicate the functionality of the in ORM to
> create a queryset.  I need the result in the queryset because later in the
> procedure, I search the queryset as follows:
>
> queryset = queryset.filter( Q( orig_total  __icontains=search_value) )
>
> The search_value would be a value that would rounded to 2 decimal places.
>
> Thanks in Advance,
> Wai
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/b89b27f3-a11c-4b2c-8473-59420c7c3f26n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVHr3hQ03XGnOGO0i13gWhw1%3D%2Bv51BcbHAOfAb0u5V4_tg%40mail.gmail.com.


Re: struck at gettiing each product urls from addidas website

2021-06-21 Thread Lalit Suthar
print(links) outside for loop. Even then if nothing prints means your
`listings` is empty

On Tue, 22 Jun 2021 at 08:51, ram manoj Vuyyuru 
wrote:

> HI
> help me for getting urls for each product
> import pandas as pd
> import requests
> from bs4 import BeautifulSoup as bs
>
>
> url = "https://www.adidas.com.my/en/men-shoes?start=0;
> page = requests.get(url)
> soup = bs(page.text,"html.parser")
>
> links=[]
> listings = soup.find_all('div',{'class':'grid-item___3rAkS'})
> for listing in listings:
> shoes_link= listing.find_all("a").a.get("href")
> base_url="https://www.adidas.com.my/en/men-shoes/;
> cmplt_lnk=base_url+shoes_link
> links.append(cmplt_lnk)
> print(links)
>
>
> my code :
> when i run this i am not getting any result
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CALJzFip9tmQTxygmWpqpc%3DqKHipNNf4HXhofGFXOPy3pp4bMCw%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVH%2BioS8doxM77s8BPjZjkc-hh7YrXecVO4fztwgFSPjWw%40mail.gmail.com.


Re: Using ORM to retrieve values (REAL) from SQLite database to round to 2 decimal places

2021-06-21 Thread Lalit Suthar
That's great the way you found the workaround :D

We can also try writing raw sql queries to use sql functions
https://docs.djangoproject.com/en/2.2/topics/db/sql/#executing-custom-sql-directly
But that has some security issues since we have to pass a search parameter
into it.

On Mon, 21 Jun 2021 at 22:46, Wai Yeung  wrote:

> Thanks for the quick response Lalit,
>
> Django "Round" rounds to the nearest integer whereas SQLite "round" allows
> you to pass in a second parameter to to round "rounded to Y digits to the
> right of the decimal point" (https://sqlite.org/lang_corefunc.html#round).
>
> That said, since Django "Round" doesn't support this second parameter, I
> still used it by multiplying the value by 1000, then rounded the value and
> then divided the value by 1000.  This still didn't result in a value with 2
> decimal places as some values have a '0' in the second decimal place (i.e.
> "2.10" would be "2.1"
>
> To address the search portion, the search values for any search value that
> had trailing zeroes were modified.  So if the search was for "2.10", the
> modified search would be for "2.1".
>
> Cheers,
> Wai
>
> On Sat, Jun 19, 2021 at 5:53 AM Lalit Suthar 
> wrote:
>
>> this can help
>> https://docs.djangoproject.com/en/2.2/ref/models/database-functions/#round
>>
>> On Fri, 18 Jun 2021 at 22:43, Wai Yeung  wrote:
>>
>>> Hello,
>>>
>>> To be able to get a REAL value from a SQLite database rounded to 2
>>> decimal places, I had to use the following RAW SQL query:
>>>
>>> SELECT
>>> printf("%.2f", round(orig_total,2)),
>>> FROM final_billing_tbl
>>>
>>> I would like to be able to duplicate the functionality of the in ORM to
>>> create a queryset.  I need the result in the queryset because later in the
>>> procedure, I search the queryset as follows:
>>>
>>> queryset = queryset.filter( Q( orig_total  __icontains=search_value) )
>>>
>>> The search_value would be a value that would rounded to 2 decimal places.
>>>
>>> Thanks in Advance,
>>> Wai
>>>
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/b89b27f3-a11c-4b2c-8473-59420c7c3f26n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/b89b27f3-a11c-4b2c-8473-59420c7c3f26n%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/django-users/D72IUtA1uqQ/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAGp2JVHr3hQ03XGnOGO0i13gWhw1%3D%2Bv51BcbHAOfAb0u5V4_tg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAGp2JVHr3hQ03XGnOGO0i13gWhw1%3D%2Bv51BcbHAOfAb0u5V4_tg%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAKDLG%3DRq-YhQeGKfFk5vy24Kqdyyk-FG6OzQRnE0DMEwPtzbMg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAKDLG%3DRq-YhQeGKfFk5vy24Kqdyyk-FG6OzQRnE0DMEwPtzbMg%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVG_VRKS8z6Ws%3D93NP-wov01%3DT%2BKqeC_nkyfjOSP7GJ0ag%40mail.gmail.com.


Re: Django chart using chart.js

2021-06-18 Thread Lalit Suthar
this has a good explanation https://www.youtube.com/watch?v=B4Vmm3yZPgc


On Fri, 18 Jun 2021 at 19:57, Eugene TUYIZERE 
wrote:

>
>
> On Thu, 17 Jun 2021 at 11:15, Eugene TUYIZERE 
> wrote:
>
>> Team,
>>
>> I have a table called Indicators. This includes indicator, target and
>> progress. Both target and progress are numbers. What I want is to display a
>> chart target and progress for every indicator. With the code below I only
>> get indicators I failed to display the bars (columns). Please assist
>>
>> [image: image.png]
>>
>> def chart(request):
>> dataset = Indicators.objects.values('indicator','target','progress')
>> indicator = list()
>> target = list()
>> progress = list()
>> for entry in dataset:
>> indicator.append(entry['indicator'])
>> target.append(entry['target'])
>> progress.append(entry['progress'])
>> target_series = {
>> 'name': 'Target',
>> 'data': target,
>> 'color': 'blue',
>> }
>> progress_series = {
>> 'name': 'Progress',
>> 'data': progress,
>> 'color': 'red'
>> }
>> chart = {
>> 'chart': {'type': 'column'},
>> 'title': {'text': 'Indicator Analysis'},
>> 'xAxis': {'categories': indicator},
>> 'series': [target_series,progress_series]
>> }
>> dump = json.dumps(chart)
>> --
>> *Eugene*
>>
>>
>>
> None to help please
>
>
>
> -
> *Eugene*
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CABxpZHva7h-wkjrRud_k-Oqg400k44g2mqqjCowVxYeZa7cd6g%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVG1w_tzQj90xhU%3DwTwmbCrhVM%2BsULcva_037_6u_SbMVw%40mail.gmail.com.


Re: Need guidance

2021-05-20 Thread lalit suthar
postgres ArrayField will be suitable for your requirement. Serialization 
will work the same like it works for other fields.
On Thursday, 20 May 2021 at 21:00:14 UTC+5:30 xaadx...@gmail.com wrote:

> I wanna to store multiple value in django model using DRF e.g. i have to 
> choose three days from a week. I am using django rest framework. I have 
> tried many solution but failed
>
>
>
> 1. Which field i have to implement in django  model? CharField? Postgre 
> ArrayField?
> 2. How to serialize the data to store multiple values
>
>
> Thanks
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/dccb57a6-60c5-46dd-bc07-e80b838b33e3n%40googlegroups.com.


Re: help on autologging users after signup

2021-05-25 Thread lalit suthar
It is not returning the "login success" message because you are using 
`APIView` parent class and that does not have create() method so your code 
inside create() won't get executed. You have to move that code to post() 
method. https://www.cdrf.co/ is a good reference to find out different 
Parent class's and their supported methods.

On Tuesday, 25 May 2021 at 12:15:57 UTC+5:30 tosina...@gmail.com wrote:

> [image: image.png]
> [image: image.png]
>
>
> so this is it, i've tried it, but still returning id of null 
> and it not returning the login success msg 
>
> On Mon, May 24, 2021 at 9:08 PM I,M& M  wrote:
>
>> in drf, the request.POST dictionary does not contain the body of the 
>> request instead use the request.data to access the requests body.
>> ex.
>> email = request.data.get('email')
>> password= request.data.get('password') 
>> new_user = authenticate(request, email, password)
>> request.data contains the username and password
>>
>> On Monday, May 24, 2021 at 9:29:33 AM UTC+3 tosina...@gmail.com wrote:
>>
>>> I've tried that it didn't wrk
>>> On 24 May 2021 05:21, "lalit suthar"  wrote:
>>>
>>>> in authenticate function take values from request.data dictionary
>>>> email = request.data.get('email')
>>>> poassword = request.data.get('password')
>>>> On Sunday, 23 May 2021 at 07:27:51 UTC+5:30 tosina...@gmail.com wrote:
>>>>
>>>>> halo guys, i wan  make it possible for user to auto login user after 
>>>>> signup in my app using drf
>>>>> but still getting null as d user-id & returning anonymous user err
>>>>> can anyone help out
>>>>> [image: image.png]
>>>>> [image: image.png]
>>>>>
>>>>> -- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "Django users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to django-users...@googlegroups.com.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/django-users/a3a45860-b65c-45f0-9c24-cd23165e5048n%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/django-users/a3a45860-b65c-45f0-9c24-cd23165e5048n%40googlegroups.com?utm_medium=email_source=footer>
>>>> .
>>>>
>>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/cfbe09d9-00b9-4993-abc2-a3a87846d8e7n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/cfbe09d9-00b9-4993-abc2-a3a87846d8e7n%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/75b1f89b-8338-46e6-9aab-5d51b8734fbfn%40googlegroups.com.


Re: Announcing DjHTML: A Django template indender

2021-05-24 Thread lalit suthar
This is looking pretty cool! 

On Monday, 24 May 2021 at 18:54:12 UTC+5:30 Jaap Joris Vens wrote:

> Dear all,
>
> I would like to take this opportunity to announce my side project to
> the Django community. It's a Django template indenter called DjHTML.
> It's Black for Django templates!
>
> https://github.com/rtts/djhtml/
>
> Over the past year I have fallen in love with Black and pre-commit to
> automatically format code upon each commit. However, I could not find
> any tool that would do the same for HTML files and so I decided to
> write one myself. Take for instance the following template:
>
> {% block content %}
>  {% if index > 1 %}
> class="extra"
> {% endif %}
> >
> {% localize on %}
> {% if clickable %}
> 
> {% endif %}
> Blog post {{ nr }}
> {% if clickable %}
> 
> {% endif %}
> {% endlocalize %}
> 
> {% endblock %}
>
> This is what it looks like after processing by DjHTML:
>
> {% block content %}
>  {% if index > 1 %}
> class="extra"
> {% endif %}
> >
> {% localize on %}
> {% if clickable %}
> 
> {% endif %}
> Blog post {{ nr }}
> {% if clickable %}
> 
> {% endif %}
> {% endlocalize %}
> 
> {% endblock %}
>
> Currently, DjHTML is able to parse DTL, HTML, CSS, Javascript and any
> combinations of these inside the same template. The indentation rules
> are similar to Emacs' web-mode.el but with better handling of some
> edge cases.
>
> The difference with Black is that DjHTML is an indenter and not a
> formatter: It will only add/remove whitespace and not insert newlines
> or any other characters. The goal is to indent already well-structured
> templates but not to fix broken ones. Also, unlike Black, the tabwidth
> is configurable :-)
>
> I am hoping that some of you will give it a try and hopefully provide
> me with some feedback, test cases, and bug reports that will help me
> improve this tool.
>
> Greetings,
> Jaap Joris Vens
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1c5db289-6978-49bd-a306-271997bd5154n%40googlegroups.com.


Re: I was all new to django.could anyone helpme out with that.

2021-05-26 Thread lalit suthar
In no particular order these 3 resources helped me 

   - 
   
   https://tutorial.djangogirls.org/en/
   - 
   
   https://docs.djangoproject.com/en/2.2/intro/tutorial01/ 
   - 
   
   https://www.youtube.com/playlist?list=PLEsfXFp6DpzTD1BD1aWNxS2Ep06vIkaeW
   

On Wednesday, 26 May 2021 at 21:11:51 UTC+5:30 sushmanthr...@gmail.com 
wrote:

> hi all, I am a student at Amrita Vishwa vidyapetam . I am all new to 
> python, I just knew some basics of python. I was totally confused about how 
> to start? with Django and learn from basics and I was really confused about 
> where to start. I request everyone to give me a suggestion on where to 
> start, it would be great help could provide some roadmap to excel in Django.
> I just wish to learn Django and start contributing to it.
>
> regards,
> sushmanth.
> amfoss 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9bd56f7b-09fa-4f19-844f-beff690d2ccan%40googlegroups.com.


Re: Hi all, i'm using 2 modelforms in one view function one as foreign key but when i submit babyform2 not storing in database. anyone please fix this

2021-06-01 Thread Lalit Suthar
because you're passing commit=False with form2

On Tue, 1 Jun 2021 at 14:10, Hugh Frost  wrote:

> def detail(request):
> if request.method == 'POST':
> baby_form1 = BabyForm1(data=request.POST)
> baby_form2 = BabyForm2(data=request.POST)
>
> if baby_form1.is_valid() and baby_form2.is_valid():
> baby_form1.save()
> print(baby_form1)
> baby_form2.baby_form1 = baby_form1
> baby_form2.save(commit=False)
> print(baby_form2)
> baby_form2.baby_form1
>
> return redirect('userapp:home')
>
>
> else:
> baby_form1 = BabyForm1()
> baby_form2 = BabyForm2()
> return render(request,'userapp_temp/profile.html',
> {'baby_form1':baby_form1, 'baby_form2':baby_form2,})
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/73c21cb8-9127-401c-88b2-fa94446cc37bn%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVEjC4N4p9R-4JsGd%3Dh78bvZUz-XDij6_aA-4fgtmcQEjA%40mail.gmail.com.


Re: help on autologging users after signup

2021-05-23 Thread lalit suthar
in authenticate function take values from request.data dictionary
email = request.data.get('email')
poassword = request.data.get('password')
On Sunday, 23 May 2021 at 07:27:51 UTC+5:30 tosina...@gmail.com wrote:

> halo guys, i wan  make it possible for user to auto login user after 
> signup in my app using drf
> but still getting null as d user-id & returning anonymous user err
> can anyone help out
> [image: image.png]
> [image: image.png]
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a3a45860-b65c-45f0-9c24-cd23165e5048n%40googlegroups.com.


Re: CSS not linking with HTML

2021-05-29 Thread lalit suthar
read this https://docs.djangoproject.com/en/2.2/intro/tutorial06/ and check 
how you are giving paths. Also after loading the page on your browser go to 
"View Page Source" and click on the CSS file link and check if the file is 
opening or not.

On Saturday, 29 May 2021 at 17:57:21 UTC+5:30 sukhy.g...@gmail.com wrote:

> Yes Sir,There was no mistake in code. Code problem was only in mail 
> content actually code was correct as instruction given by Aniket Sir
>
> Regards
>
>
> On Sat, May 29, 2021, 13:14 lalit suthar 
>> have you checked Aniket's answer?
>>
>> On Saturday, 29 May 2021 at 11:09:07 UTC+5:30 sukhy.g...@gmail.com wrote:
>>
>>> Done Sir, but not working
>>>
>>> On Sat, May 29, 2021, 10:50 Venu Gopal >>
>>>> In Firefox  Goto Preferences ---> Choose Privacy and Security ---> 
>>>> scroll down until you get cookies and site data --> clear data
>>>> Chrome  Goto Settings ---> Choose Privacy and Security ---> select 
>>>> cookies and other site data --> select see all cookies and site data --> 
>>>> Remove all
>>>>
>>>> On Sat, May 29, 2021 at 9:50 AM sukhy gill  
>>>> wrote:
>>>>
>>>>> @Venu Gopal
>>>>>
>>>>> No Sir, I don't know, how to do this.
>>>>>
>>>>> May I know Sir, how to do the same?
>>>>>
>>>>> Regards
>>>>>
>>>>> On Sat, May 29, 2021, 09:41 Venu Gopal >>>>
>>>>>> Hi, Have you tried deleting existing cache and cookies in the 
>>>>>> browser? 
>>>>>>
>>>>>> On Sat, May 29, 2021 at 12:08 AM sukhy gill  
>>>>>> wrote:
>>>>>>
>>>>>>> Dear Frnds
>>>>>>> I am unable to  link CSS with HTML
>>>>>>> HTML working but CSS not working inside the .html file with the help 
>>>>>>> of LINK in  tag 
>>>>>>>
>>>>>>> I am using thefollowings:-
>>>>>>> Setting.py -  STATICFILES_DIRS=[os.path.join(BASE_DIR, 'static'),]
>>>>>>> HTML- {% load static %}
>>>>>>> >>>>>> To unsubscribe from this group and stop receiving emails from it, 
>>>>>>> send an email to django-users...@googlegroups.com.
>>>>>>> To view this discussion on the web visit 
>>>>>>> https://groups.google.com/d/msgid/django-users/3ca2aba0-a58f-4298-b248-16c51bdf90a6n%40googlegroups.com
>>>>>>>  
>>>>>>> <https://groups.google.com/d/msgid/django-users/3ca2aba0-a58f-4298-b248-16c51bdf90a6n%40googlegroups.com?utm_medium=email_source=footer>
>>>>>>> .
>>>>>>>
>>>>>> -- 
>>>>>> You received this message because you are subscribed to a topic in 
>>>>>> the Google Groups "Django users" group.
>>>>>> To unsubscribe from this topic, visit 
>>>>>> https://groups.google.com/d/topic/django-users/qGMoFXNAgww/unsubscribe
>>>>>> .
>>>>>> To unsubscribe from this group and all its topics, send an email to 
>>>>>> django-users...@googlegroups.com.
>>>>>> To view this discussion on the web visit 
>>>>>> https://groups.google.com/d/msgid/django-users/CAOhYkiyqw8k5zCL1XZo9U%2BY9_JR57p55xf-%3DtFf6Fa4HVskPSw%40mail.gmail.com
>>>>>>  
>>>>>> <https://groups.google.com/d/msgid/django-users/CAOhYkiyqw8k5zCL1XZo9U%2BY9_JR57p55xf-%3DtFf6Fa4HVskPSw%40mail.gmail.com?utm_medium=email_source=footer>
>>>>>> .
>>>>>>
>>>>> -- 
>>>>> You received this message because you are subscribed to the Google 
>>>>> Groups "Django users" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>>> an email to django-users...@googlegroups.com.
>>>>> To view this discussion on the web visit 
>>>>> https://groups.google.com/d/msgid/django-users/CAJ8btZave0utnYTAcrxafKes6sUZ3%2BX%2B0v1EGs-pJSF1%2BT4qxw%40mail.gmail.com
>>>>>  
>>>>> <https://groups.google.com/d/msgid/django-users/CAJ8btZave0utnYTAcrxafKes6sUZ3%2BX%2B0v1EGs-pJSF1%2BT4qxw%40mail.gmail.com?utm_medium=email_source=footer>
>>>>> .
>>>>>
>>>> -- 
>>>> You received this message because you are su

Re: CSS not linking with HTML

2021-05-29 Thread lalit suthar
have you checked Aniket's answer?

On Saturday, 29 May 2021 at 11:09:07 UTC+5:30 sukhy.g...@gmail.com wrote:

> Done Sir, but not working
>
> On Sat, May 29, 2021, 10:50 Venu Gopal 
>> In Firefox  Goto Preferences ---> Choose Privacy and Security ---> 
>> scroll down until you get cookies and site data --> clear data
>> Chrome  Goto Settings ---> Choose Privacy and Security ---> select 
>> cookies and other site data --> select see all cookies and site data --> 
>> Remove all
>>
>> On Sat, May 29, 2021 at 9:50 AM sukhy gill  wrote:
>>
>>> @Venu Gopal
>>>
>>> No Sir, I don't know, how to do this.
>>>
>>> May I know Sir, how to do the same?
>>>
>>> Regards
>>>
>>> On Sat, May 29, 2021, 09:41 Venu Gopal >>
 Hi, Have you tried deleting existing cache and cookies in the browser? 

 On Sat, May 29, 2021 at 12:08 AM sukhy gill  
 wrote:

> Dear Frnds
> I am unable to  link CSS with HTML
> HTML working but CSS not working inside the .html file with the help 
> of LINK in  tag 
>
> I am using thefollowings:-
> Setting.py -  STATICFILES_DIRS=[os.path.join(BASE_DIR, 'static'),]
> HTML- {% load static %}
>  To unsubscribe from this group and stop receiving emails from it, send 
> an email to django-users...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/3ca2aba0-a58f-4298-b248-16c51bdf90a6n%40googlegroups.com
>  
> 
> .
>
 -- 
 You received this message because you are subscribed to a topic in the 
 Google Groups "Django users" group.
 To unsubscribe from this topic, visit 
 https://groups.google.com/d/topic/django-users/qGMoFXNAgww/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to 
 django-users...@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/django-users/CAOhYkiyqw8k5zCL1XZo9U%2BY9_JR57p55xf-%3DtFf6Fa4HVskPSw%40mail.gmail.com
  
 
 .

>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to django-users...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/CAJ8btZave0utnYTAcrxafKes6sUZ3%2BX%2B0v1EGs-pJSF1%2BT4qxw%40mail.gmail.com
>>>  
>>> 
>>> .
>>>
>> -- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/django-users/qGMoFXNAgww/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> django-users...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CAOhYkiy80sPnGJ2uJPuJODECKv3UfQxATOit%2BwNZnr%3D%2BgiuojQ%40mail.gmail.com
>>  
>> 
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d9863d84-b712-4edd-bcd3-cb56e56d93e2n%40googlegroups.com.


Re: use of annotate in django query

2021-06-02 Thread Lalit Suthar
> in brief, I want to transform this query in django query
this will be equivalent to this query in django
Customer_Requests.objects.values("arrival_date").annotate(num_req=Count("request_name"))


On Thu, 3 Jun 2021 at 02:02, Eugene TUYIZERE 
wrote:

> in brief, I want to transform this query in django query
>
> [image: image.png]
>
> On Wed, 2 Jun 2021 at 21:56, Eugene TUYIZERE 
> wrote:
>
>> Dear Sebatian,
>>
>> This is what I get:
>>
>> SELECT `crms_customer_requests`.`arrival_date`,
>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>> 2021-05-03 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>> SELECT `crms_customer_requests`.`arrival_date`,
>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>> 2021-05-04 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>> SELECT `crms_customer_requests`.`arrival_date`,
>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>> 2021-05-05 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>> SELECT `crms_customer_requests`.`arrival_date`,
>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>> 2021-05-06 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>> SELECT `crms_customer_requests`.`arrival_date`,
>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>> 2021-05-07 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>> SELECT `crms_customer_requests`.`arrival_date`,
>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>> 2021-05-08 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>> SELECT `crms_customer_requests`.`arrival_date`,
>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>> 2021-05-09 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>> SELECT `crms_customer_requests`.`arrival_date`,
>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>> 2021-05-10 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>> SELECT `crms_customer_requests`.`arrival_date`,
>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>> 2021-05-11 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>> SELECT `crms_customer_requests`.`arrival_date`,
>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>> 2021-05-12 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>> SELECT `crms_customer_requests`.`arrival_date`,
>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>> 2021-05-13 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>> SELECT `crms_customer_requests`.`arrival_date`,
>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>> 2021-05-14 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>> SELECT `crms_customer_requests`.`arrival_date`,
>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>> 2021-05-15 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>> SELECT `crms_customer_requests`.`arrival_date`,
>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>> 2021-05-16 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>> SELECT `crms_customer_requests`.`arrival_date`,
>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>> 2021-05-17 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>> SELECT `crms_customer_requests`.`arrival_date`,
>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>> 2021-05-18 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>> SELECT `crms_customer_requests`.`arrival_date`,
>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM
>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >=
>> 2021-05-19 GROUP BY 

Re: use of annotate in django query

2021-06-05 Thread Lalit Suthar
just replied to your mail

On Sat, 5 Jun 2021 at 11:48, Eugene TUYIZERE 
wrote:

> Dear Suthar,
>
> Can I have your private contact?
>
> regards,
>
> On Fri, 4 Jun 2021 at 06:25, Lalit Suthar 
> wrote:
>
>> my pleasure :)
>>
>> On Thu, 3 Jun 2021 at 20:28, Eugene TUYIZERE 
>> wrote:
>>
>>> Dear Suthar,
>>>
>>> Thank you very much. It works well.
>>>
>>>
>>> On Thu, 3 Jun 2021 at 16:48, Lalit Suthar 
>>> wrote:
>>>
>>>> not sure but maybe this can work inside views replace
>>>> chart = {
>>>>   'chart': {'type': 'column'},
>>>>   'title': {'text': 'Previous statistics'},
>>>>   'xAxis': {'replist': replist},
>>>>   'series': [arriva_days]
>>>> }
>>>> with
>>>> chart = {
>>>>   'chart': {'type': 'column'},
>>>>   'title': {'text': 'Previous statistics'},
>>>>   'xAxis': {'categories': replist},
>>>>   'series': [arriva_days]
>>>> }
>>>>
>>>> On Thu, 3 Jun 2021 at 18:00, Eugene TUYIZERE 
>>>> wrote:
>>>>
>>>>> This what I have in summarizedchart.html:
>>>>>
>>>>> {% extends "layouts/base.html" %}
>>>>> {% load static %}
>>>>> {% block title %} Repport {% endblock %}
>>>>>
>>>>> 
>>>>> {% block stylesheets %}{% endblock stylesheets %}
>>>>>
>>>>> {% block content %}
>>>>>
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> Report
>>>>>
>>>>> 
>>>>>
>>>>> 
>>>>>
>>>>> 
>>>>> 
>>>>> Highcharts.chart('container', {{ chart|safe }});
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> {% endblock content %}
>>>>> {% block custom_js %}
>>>>>
>>>>> {% endblock custom_js %}
>>>>>
>>>>> On Thu, 3 Jun 2021 at 14:22, Lalit Suthar 
>>>>> wrote:
>>>>>
>>>>>> so the view is not giving error right now but maybe we are passing
>>>>>> the data in different format then the chart is expecting.
>>>>>> What are you using for drawing the chart? can I see the code inside
>>>>>> "summarizedchart.html"
>>>>>>
>>>>>> On Thu, 3 Jun 2021 at 17:43, Eugene TUYIZERE <
>>>>>> eugenetuyiz...@gmail.com> wrote:
>>>>>>
>>>>>>> Dear Suthar,
>>>>>>>
>>>>>>> You saved my day. Once more, the chart is displayed but the date is
>>>>>>> not displayed on Xaxis. This how it is:
>>>>>>>
>>>>>>> [image: image.png]
>>>>>>>
>>>>>>> Th codes are:
>>>>>>> def reqChart(request):
>>>>>>> current_date = date.today()
>>>>>>> days_before = date.today()-timedelta(days=30)
>>>>>>> datelist = Customer_Requests.objects.values("arrival_date").annotate
>>>>>>> (num_req=Count("request_name")).order_by('-arrival_date')[:20:-1]
>>>>>>> replist = list()
>>>>>>> sumdata = list()
>>>>>>> for listd in datelist:
>>>>>>> replist.append(listd['arrival_date'])
>>>>>>> sumdata.append(listd['num_req'])
>>>>>>> arriva_days = {
>>>>>>> 'name': 'Datess',
>>>>>>> 'data': sumdata,
>>>>>>> 'color': 'green'
>>>>>>> }
>>>>>>> chart = {
>>>>>>> 'chart': {'type': 'column'},
>>>>>>> 'title': {'text': 'Previous statistics'},
>>>>>>> 'xAxis': {'replist': replist},
>>>>>>> 'series': [arriva_days]
>>>>>>> }
>>>>>>> dump = json.dumps(chart,cls=DjangoJSONEncoder)
>>>>>>> return render(request,'summarizedchart.html',{'chart': dump})
>>>>>>>
>>>>>>>
>>>>>>> On Thu, 3 Jun 2021 at 13:27, lalit suthar 
>>>>>>> wrote:
>>>>>>>
>>>>>&g

Re: use of annotate in django query

2021-06-03 Thread lalit suthar
this will do 
Customer_Requests.objects.values("arrival_date").annotate(num_req=Count("request_name")).order_by("-id")[:30:-1]

On Thursday, 3 June 2021 at 11:37:26 UTC+5:30 abubak...@gmail.com wrote:

> to display last 30 records you can write your code like this: 
> Customer_Requests.objects.all()[-30]
>
> On Thu, Jun 3, 2021 at 10:51 AM Eugene TUYIZERE  
> wrote:
>
>> Dear Latit,
>>
>> Thank you very much. Now how can I display 30 last records? Regardless of 
>> how many records I may have ! Just the last 30 records!
>>
>> Thank you
>>
>> On Thu, 3 Jun 2021 at 06:51, Lalit Suthar  wrote:
>>
>>> > in brief, I want to transform this query in django query
>>> this will be equivalent to this query in django 
>>>
>>> Customer_Requests.objects.values("arrival_date").annotate(num_req=Count("request_name"))
>>>
>>>
>>> On Thu, 3 Jun 2021 at 02:02, Eugene TUYIZERE  
>>> wrote:
>>>
>>>> in brief, I want to transform this query in django query
>>>>
>>>> [image: image.png]
>>>>
>>>> On Wed, 2 Jun 2021 at 21:56, Eugene TUYIZERE  
>>>> wrote:
>>>>
>>>>> Dear Sebatian,
>>>>>
>>>>> This is what I get:
>>>>>
>>>>> SELECT `crms_customer_requests`.`arrival_date`, 
>>>>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM 
>>>>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 
>>>>> 2021-05-03 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>>>>> SELECT `crms_customer_requests`.`arrival_date`, 
>>>>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM 
>>>>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 
>>>>> 2021-05-04 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>>>>> SELECT `crms_customer_requests`.`arrival_date`, 
>>>>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM 
>>>>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 
>>>>> 2021-05-05 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>>>>> SELECT `crms_customer_requests`.`arrival_date`, 
>>>>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM 
>>>>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 
>>>>> 2021-05-06 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>>>>> SELECT `crms_customer_requests`.`arrival_date`, 
>>>>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM 
>>>>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 
>>>>> 2021-05-07 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>>>>> SELECT `crms_customer_requests`.`arrival_date`, 
>>>>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM 
>>>>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 
>>>>> 2021-05-08 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>>>>> SELECT `crms_customer_requests`.`arrival_date`, 
>>>>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM 
>>>>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 
>>>>> 2021-05-09 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>>>>> SELECT `crms_customer_requests`.`arrival_date`, 
>>>>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM 
>>>>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 
>>>>> 2021-05-10 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>>>>> SELECT `crms_customer_requests`.`arrival_date`, 
>>>>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM 
>>>>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 
>>>>> 2021-05-11 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>>>>> SELECT `crms_customer_requests`.`arrival_date`, 
>>>>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM 
>>>>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 
>>>>> 2021-05-12 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL
>>>>> SELECT `crms_custo

Re: use of annotate in django query

2021-06-03 Thread lalit suthar
Hi there! 
make these couple of changes 

1) from django.core.serializers.json import DjangoJSONEncoder 
2) dump3 = json.dumps(chart3, cls=DjangoJSONEncoder)
On Thursday, 3 June 2021 at 16:18:15 UTC+5:30 eugenet...@gmail.com wrote:

> Dear Suthar,
>
> Your idea works well , but I want now to display the result on chart. 
> Below is the code I am trying to use:
> but Am getting the error message:
>
> Exception Value: 
>
> Object of type date is not JSON serializable
>
>
> def reqChart(request): 
> aa = Customer_Requests.objects.values("arrival_date").annotate(num_req=
> Count("request_name")).order_by('-arrival_date')[:20:-1]
> print(aa)
> datesb = list()
> sumdata = list()
> for dd in aa:
> datesb.append(dd['arrival_date'])
> sumdata.append(dd['num_req'])
> arriva_days = {
> 'name': 'Datess',
> 'data': sumdata,
> 'color': 'green'
> }
> chart3 = {
> 'chart': {'type': 'column'},
> 'title': {'text': 'Previous statistics'},
> 'xAxis': {'datesb': datesb},
> 'series': [arriva_days]
> }
> dump3 = json.dumps(chart3)
> return render(request,'summarizedchart.html',{'chart3': dump3})
>
> Please once again
>
> regards, 
>
>
>
> On Thu, 3 Jun 2021 at 09:00, lalit suthar  wrote:
>
>> this will do 
>>
>> Customer_Requests.objects.values("arrival_date").annotate(num_req=Count("request_name")).order_by("-id")[:30:-1]
>>
>> On Thursday, 3 June 2021 at 11:37:26 UTC+5:30 abubak...@gmail.com wrote:
>>
>>> to display last 30 records you can write your code like this: 
>>> Customer_Requests.objects.all()[-30]
>>>
>>> On Thu, Jun 3, 2021 at 10:51 AM Eugene TUYIZERE  
>>> wrote:
>>>
>>>> Dear Latit,
>>>>
>>>> Thank you very much. Now how can I display 30 last records? Regardless 
>>>> of how many records I may have ! Just the last 30 records!
>>>>
>>>> Thank you
>>>>
>>>> On Thu, 3 Jun 2021 at 06:51, Lalit Suthar  wrote:
>>>>
>>>>> > in brief, I want to transform this query in django query
>>>>> this will be equivalent to this query in django 
>>>>>
>>>>> Customer_Requests.objects.values("arrival_date").annotate(num_req=Count("request_name"))
>>>>>
>>>>>
>>>>> On Thu, 3 Jun 2021 at 02:02, Eugene TUYIZERE  
>>>>> wrote:
>>>>>
>>>>>> in brief, I want to transform this query in django query
>>>>>>
>>>>>> [image: image.png]
>>>>>>
>>>>>> On Wed, 2 Jun 2021 at 21:56, Eugene TUYIZERE  
>>>>>> wrote:
>>>>>>
>>>>>>> Dear Sebatian,
>>>>>>>
>>>>>>> This is what I get:
>>>>>>>
>>>>>>> SELECT `crms_customer_requests`.`arrival_date`, 
>>>>>>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM 
>>>>>>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` 
>>>>>>> >= 
>>>>>>> 2021-05-03 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY 
>>>>>>> NULL
>>>>>>> SELECT `crms_customer_requests`.`arrival_date`, 
>>>>>>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM 
>>>>>>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` 
>>>>>>> >= 
>>>>>>> 2021-05-04 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY 
>>>>>>> NULL
>>>>>>> SELECT `crms_customer_requests`.`arrival_date`, 
>>>>>>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM 
>>>>>>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` 
>>>>>>> >= 
>>>>>>> 2021-05-05 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY 
>>>>>>> NULL
>>>>>>> SELECT `crms_customer_requests`.`arrival_date`, 
>>>>>>> COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM 
>>>>>>> `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` 
>>>>>>> >= 
>>>>>>> 2021-05-06 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY 
>>>>>>> NULL
>>>>>>> SELECT `crms_customer_requests`.`arrival_date`, 
>>>>>&

Re: use of annotate in django query

2021-06-03 Thread Lalit Suthar
so the view is not giving error right now but maybe we are passing the data
in different format then the chart is expecting.
What are you using for drawing the chart? can I see the code inside
"summarizedchart.html"

On Thu, 3 Jun 2021 at 17:43, Eugene TUYIZERE 
wrote:

> Dear Suthar,
>
> You saved my day. Once more, the chart is displayed but the date is not
> displayed on Xaxis. This how it is:
>
> [image: image.png]
>
> Th codes are:
> def reqChart(request):
> current_date = date.today()
> days_before = date.today()-timedelta(days=30)
> datelist = Customer_Requests.objects.values("arrival_date").annotate(
> num_req=Count("request_name")).order_by('-arrival_date')[:20:-1]
> replist = list()
> sumdata = list()
> for listd in datelist:
> replist.append(listd['arrival_date'])
> sumdata.append(listd['num_req'])
> arriva_days = {
> 'name': 'Datess',
> 'data': sumdata,
> 'color': 'green'
> }
> chart = {
> 'chart': {'type': 'column'},
> 'title': {'text': 'Previous statistics'},
> 'xAxis': {'replist': replist},
> 'series': [arriva_days]
> }
> dump = json.dumps(chart,cls=DjangoJSONEncoder)
> return render(request,'summarizedchart.html',{'chart': dump})
>
>
> On Thu, 3 Jun 2021 at 13:27, lalit suthar 
> wrote:
>
>> Hi there!
>> make these couple of changes
>>
>> 1) from django.core.serializers.json import DjangoJSONEncoder
>> 2) dump3 = json.dumps(chart3, cls=DjangoJSONEncoder)
>> On Thursday, 3 June 2021 at 16:18:15 UTC+5:30 eugenet...@gmail.com wrote:
>>
>>> Dear Suthar,
>>>
>>> Your idea works well , but I want now to display the result on chart.
>>> Below is the code I am trying to use:
>>> but Am getting the error message:
>>>
>>> Exception Value:
>>>
>>> Object of type date is not JSON serializable
>>>
>>>
>>> def reqChart(request):
>>> aa = Customer_Requests.objects.values("arrival_date").annotate(num_req=
>>> Count("request_name")).order_by('-arrival_date')[:20:-1]
>>> print(aa)
>>> datesb = list()
>>> sumdata = list()
>>> for dd in aa:
>>> datesb.append(dd['arrival_date'])
>>> sumdata.append(dd['num_req'])
>>> arriva_days = {
>>> 'name': 'Datess',
>>> 'data': sumdata,
>>> 'color': 'green'
>>> }
>>> chart3 = {
>>> 'chart': {'type': 'column'},
>>> 'title': {'text': 'Previous statistics'},
>>> 'xAxis': {'datesb': datesb},
>>> 'series': [arriva_days]
>>> }
>>> dump3 = json.dumps(chart3)
>>> return render(request,'summarizedchart.html',{'chart3': dump3})
>>>
>>> Please once again
>>>
>>> regards,
>>>
>>>
>>>
>>> On Thu, 3 Jun 2021 at 09:00, lalit suthar  wrote:
>>>
>>>> this will do
>>>>
>>>> Customer_Requests.objects.values("arrival_date").annotate(num_req=Count("request_name")).order_by("-id")[:30:-1]
>>>>
>>>> On Thursday, 3 June 2021 at 11:37:26 UTC+5:30 abubak...@gmail.com
>>>> wrote:
>>>>
>>>>> to display last 30 records you can write your code like this:
>>>>> Customer_Requests.objects.all()[-30]
>>>>>
>>>>> On Thu, Jun 3, 2021 at 10:51 AM Eugene TUYIZERE 
>>>>> wrote:
>>>>>
>>>>>> Dear Latit,
>>>>>>
>>>>>> Thank you very much. Now how can I display 30 last records?
>>>>>> Regardless of how many records I may have ! Just the last 30 records!
>>>>>>
>>>>>> Thank you
>>>>>>
>>>>>> On Thu, 3 Jun 2021 at 06:51, Lalit Suthar 
>>>>>> wrote:
>>>>>>
>>>>>>> > in brief, I want to transform this query in django query
>>>>>>> this will be equivalent to this query in django
>>>>>>>
>>>>>>> Customer_Requests.objects.values("arrival_date").annotate(num_req=Count("request_name"))
>>>>>>>
>>>>>>>
>>>>>>> On Thu, 3 Jun 2021 at 02:02, Eugene TUYIZERE 
>>>>>>> wrote:
>>>>>>>
>>>>>>>> in brief, I want to transform this query in django query
>>>>>>>>
>>>>>>>> [image: image.png]
>>>>>>>>
>>>>>>>> On Wed, 2 Jun 2021 at 21:56, Eugene TUYIZERE 
>>>

Re: use of annotate in django query

2021-06-03 Thread Lalit Suthar
not sure but maybe this can work inside views replace
chart = {
  'chart': {'type': 'column'},
  'title': {'text': 'Previous statistics'},
  'xAxis': {'replist': replist},
  'series': [arriva_days]
}
with
chart = {
  'chart': {'type': 'column'},
  'title': {'text': 'Previous statistics'},
  'xAxis': {'categories': replist},
  'series': [arriva_days]
}

On Thu, 3 Jun 2021 at 18:00, Eugene TUYIZERE 
wrote:

> This what I have in summarizedchart.html:
>
> {% extends "layouts/base.html" %}
> {% load static %}
> {% block title %} Repport {% endblock %}
>
> 
> {% block stylesheets %}{% endblock stylesheets %}
>
> {% block content %}
>
> 
> 
> 
> 
> 
> Report
>
> 
>
> 
>
> 
> 
> Highcharts.chart('container', {{ chart|safe }});
> 
> 
> 
> 
> 
> 
> {% endblock content %}
> {% block custom_js %}
>
> {% endblock custom_js %}
>
> On Thu, 3 Jun 2021 at 14:22, Lalit Suthar 
> wrote:
>
>> so the view is not giving error right now but maybe we are passing the
>> data in different format then the chart is expecting.
>> What are you using for drawing the chart? can I see the code inside
>> "summarizedchart.html"
>>
>> On Thu, 3 Jun 2021 at 17:43, Eugene TUYIZERE 
>> wrote:
>>
>>> Dear Suthar,
>>>
>>> You saved my day. Once more, the chart is displayed but the date is not
>>> displayed on Xaxis. This how it is:
>>>
>>> [image: image.png]
>>>
>>> Th codes are:
>>> def reqChart(request):
>>> current_date = date.today()
>>> days_before = date.today()-timedelta(days=30)
>>> datelist = Customer_Requests.objects.values("arrival_date").annotate(
>>> num_req=Count("request_name")).order_by('-arrival_date')[:20:-1]
>>> replist = list()
>>> sumdata = list()
>>> for listd in datelist:
>>> replist.append(listd['arrival_date'])
>>> sumdata.append(listd['num_req'])
>>> arriva_days = {
>>> 'name': 'Datess',
>>> 'data': sumdata,
>>> 'color': 'green'
>>> }
>>> chart = {
>>> 'chart': {'type': 'column'},
>>> 'title': {'text': 'Previous statistics'},
>>> 'xAxis': {'replist': replist},
>>> 'series': [arriva_days]
>>> }
>>> dump = json.dumps(chart,cls=DjangoJSONEncoder)
>>> return render(request,'summarizedchart.html',{'chart': dump})
>>>
>>>
>>> On Thu, 3 Jun 2021 at 13:27, lalit suthar 
>>> wrote:
>>>
>>>> Hi there!
>>>> make these couple of changes
>>>>
>>>> 1) from django.core.serializers.json import DjangoJSONEncoder
>>>> 2) dump3 = json.dumps(chart3, cls=DjangoJSONEncoder)
>>>> On Thursday, 3 June 2021 at 16:18:15 UTC+5:30 eugenet...@gmail.com
>>>> wrote:
>>>>
>>>>> Dear Suthar,
>>>>>
>>>>> Your idea works well , but I want now to display the result on chart.
>>>>> Below is the code I am trying to use:
>>>>> but Am getting the error message:
>>>>>
>>>>> Exception Value:
>>>>>
>>>>> Object of type date is not JSON serializable
>>>>>
>>>>>
>>>>> def reqChart(request):
>>>>> aa = Customer_Requests.objects.values("arrival_date").annotate(num_req
>>>>> =Count("request_name")).order_by('-arrival_date')[:20:-1]
>>>>> print(aa)
>>>>> datesb = list()
>>>>> sumdata = list()
>>>>> for dd in aa:
>>>>> datesb.append(dd['arrival_date'])
>>>>> sumdata.append(dd['num_req'])
>>>>> arriva_days = {
>>>>> 'name': 'Datess',
>>>>> 'data': sumdata,
>>>>> 'color': 'green'
>>>>> }
>>>>> chart3 = {
>>>>> 'chart': {'type': 'column'},
>>>>> 'title': {'text': 'Previous statistics'},
>>>>> 'xAxis': {'datesb': datesb},
>>>>> 'series': [arriva_days]
>>>>> }
>>>>> dump3 = json.dumps(chart3)
>>>>> return render(request,'summarizedchart.html',{'chart3': dump3})
>>>>>
>>>>> Please once again
>>>>>
>>>>> regards,
>>>>>
>>>>>
>>>>>
>>>>> On Thu, 3 Jun 2021 at 09:00, lalit suthar 
>>>>> wrote:
>>>>>
>>>>>> this will do
>>>>>>
>&g

Re: use of annotate in django query

2021-06-03 Thread Lalit Suthar
my pleasure :)

On Thu, 3 Jun 2021 at 20:28, Eugene TUYIZERE 
wrote:

> Dear Suthar,
>
> Thank you very much. It works well.
>
>
> On Thu, 3 Jun 2021 at 16:48, Lalit Suthar 
> wrote:
>
>> not sure but maybe this can work inside views replace
>> chart = {
>>   'chart': {'type': 'column'},
>>   'title': {'text': 'Previous statistics'},
>>   'xAxis': {'replist': replist},
>>   'series': [arriva_days]
>> }
>> with
>> chart = {
>>   'chart': {'type': 'column'},
>>   'title': {'text': 'Previous statistics'},
>>   'xAxis': {'categories': replist},
>>   'series': [arriva_days]
>> }
>>
>> On Thu, 3 Jun 2021 at 18:00, Eugene TUYIZERE 
>> wrote:
>>
>>> This what I have in summarizedchart.html:
>>>
>>> {% extends "layouts/base.html" %}
>>> {% load static %}
>>> {% block title %} Repport {% endblock %}
>>>
>>> 
>>> {% block stylesheets %}{% endblock stylesheets %}
>>>
>>> {% block content %}
>>>
>>> 
>>> 
>>> 
>>> 
>>> 
>>> Report
>>>
>>> 
>>>
>>> 
>>>
>>> 
>>> 
>>> Highcharts.chart('container', {{ chart|safe }});
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> {% endblock content %}
>>> {% block custom_js %}
>>>
>>> {% endblock custom_js %}
>>>
>>> On Thu, 3 Jun 2021 at 14:22, Lalit Suthar 
>>> wrote:
>>>
>>>> so the view is not giving error right now but maybe we are passing the
>>>> data in different format then the chart is expecting.
>>>> What are you using for drawing the chart? can I see the code inside
>>>> "summarizedchart.html"
>>>>
>>>> On Thu, 3 Jun 2021 at 17:43, Eugene TUYIZERE 
>>>> wrote:
>>>>
>>>>> Dear Suthar,
>>>>>
>>>>> You saved my day. Once more, the chart is displayed but the date is
>>>>> not displayed on Xaxis. This how it is:
>>>>>
>>>>> [image: image.png]
>>>>>
>>>>> Th codes are:
>>>>> def reqChart(request):
>>>>> current_date = date.today()
>>>>> days_before = date.today()-timedelta(days=30)
>>>>> datelist = Customer_Requests.objects.values("arrival_date").annotate(
>>>>> num_req=Count("request_name")).order_by('-arrival_date')[:20:-1]
>>>>> replist = list()
>>>>> sumdata = list()
>>>>> for listd in datelist:
>>>>> replist.append(listd['arrival_date'])
>>>>> sumdata.append(listd['num_req'])
>>>>> arriva_days = {
>>>>> 'name': 'Datess',
>>>>> 'data': sumdata,
>>>>> 'color': 'green'
>>>>> }
>>>>> chart = {
>>>>> 'chart': {'type': 'column'},
>>>>> 'title': {'text': 'Previous statistics'},
>>>>> 'xAxis': {'replist': replist},
>>>>> 'series': [arriva_days]
>>>>> }
>>>>> dump = json.dumps(chart,cls=DjangoJSONEncoder)
>>>>> return render(request,'summarizedchart.html',{'chart': dump})
>>>>>
>>>>>
>>>>> On Thu, 3 Jun 2021 at 13:27, lalit suthar 
>>>>> wrote:
>>>>>
>>>>>> Hi there!
>>>>>> make these couple of changes
>>>>>>
>>>>>> 1) from django.core.serializers.json import DjangoJSONEncoder
>>>>>> 2) dump3 = json.dumps(chart3, cls=DjangoJSONEncoder)
>>>>>> On Thursday, 3 June 2021 at 16:18:15 UTC+5:30 eugenet...@gmail.com
>>>>>> wrote:
>>>>>>
>>>>>>> Dear Suthar,
>>>>>>>
>>>>>>> Your idea works well , but I want now to display the result on
>>>>>>> chart. Below is the code I am trying to use:
>>>>>>> but Am getting the error message:
>>>>>>>
>>>>>>> Exception Value:
>>>>>>>
>>>>>>> Object of type date is not JSON serializable
>>>>>>>
>>>>>>>
>>>>>>> def reqChart(request):
>>>>>>> aa = Customer_Requests.objects.values("arrival_date").annotate(
>>>>>>> num_req=Count("request_name")).order_by('-

Re: Support for moving a model between two Django apps #24686

2021-06-03 Thread lalit suthar
We had a similar problem and we resolved it by moving all the models into a 
separate internal python package. 
We can have a separate app in our django project also for writing models 
only and all other apps import models from there.

On Friday, 4 June 2021 at 06:07:53 UTC+5:30 Mike Dewhirst wrote:

> I can see a ticket https://code.djangoproject.com/ticket/24686 which 
> would likely solve my current need to merge two apps.
>
> Is the code OK to try out?
>
> Happy to test it.
>
> Cheers
>
> Mike
>
> -- 
> Signed email is an absolute defence against phishing. This email has
> been signed with my private key. If you import my public key you can
> automatically decrypt my signature and be sure it came from me. Just
> ask and I'll send it to you. Your email software can handle signing.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/27fb1633-e8be-43e1-b92e-f92409347731n%40googlegroups.com.


Re: Django Help | Counting word frequency in Django using dictionary.

2021-07-07 Thread Lalit Suthar
you can try moving to postgres if possible

On Wed, 7 Jul 2021 at 10:28, DJANGO DEVELOPER 
wrote:

> I am using sqlite3. so only needs to store the data in django
> admin/database but in the form of dictionary or in the form of counted
> words.
>
> On Wed, Jul 7, 2021 at 9:09 AM Lalit Suthar 
> wrote:
>
>> you can use postgres JsonField
>> https://docs.djangoproject.com/en/3.2/ref/contrib/postgres/fields/#jsonfield
>>
>> On Wed, 7 Jul 2021 at 06:05, DJANGO DEVELOPER 
>> wrote:
>>
>>> Hi
>>>  I am developing a django project and I want to count word frequency at
>>> the django admin side.
>>> Means a word is repeating in a string should be counted and be saved in
>>> the database only.
>>> I have managed to do it on front-end side but now I also want to do it
>>> on django admin side.
>>> example: any_string = {'word1': 12,'word2': 29}
>>> this the example because I want to get the data this way. word1 is there
>>> for 12 times in a string and same is the case for word2.
>>> so I need help and your help would be appreciated.
>>> thanks.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/672d9b02-382e-4b79-bcaf-6b618b514c28n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/672d9b02-382e-4b79-bcaf-6b618b514c28n%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAGp2JVEM2mq8EPokL9KwU3OGz%2BgaJf%3DgMALZbVa%3DdsEeW1WGiw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAGp2JVEM2mq8EPokL9KwU3OGz%2BgaJf%3DgMALZbVa%3DdsEeW1WGiw%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAKPY9pmAPnbeEvgL1%3DHdid7yZ_BgF-b34AVKr-n3-bDvcTmgjw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAKPY9pmAPnbeEvgL1%3DHdid7yZ_BgF-b34AVKr-n3-bDvcTmgjw%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVG%3Dus9DPyGgUnA5eEe1JVotrOGHHje0h-oXfE8k%2B0L9SQ%40mail.gmail.com.


Re: ProgrammingError - relationship does not exist

2021-07-07 Thread Lalit Suthar
If this is your personal project delete all migrations inside shops app and
run makemigrations, migrate again
Not sure but this may work I had similar error some time ago

On Wed, 7 Jul 2021 at 14:19, Stathis Angelou  wrote:

> Good morning Jacob and thank you for your reply, i really do appreciate
> your time in looking into this, I am attaching my
>
> models.py:
> # Create your models here.
> from django.contrib.gis.db import models
>
> class Shop(models.Model):
> name = models.CharField(max_length=100)
> location = models.PointField()
> address = models.CharField(max_length=100)
> city = models.CharField(max_length=50)
>
> and showmigrations
> admin
>  [X] 0001_initial
>  [X] 0002_logentry_remove_auto_add
>  [X] 0003_logentry_add_action_flag_choices
> auth
>  [X] 0001_initial
>  [X] 0002_alter_permission_name_max_length
>  [X] 0003_alter_user_email_max_length
>  [X] 0004_alter_user_username_opts
>  [X] 0005_alter_user_last_login_null
>  [X] 0006_require_contenttypes_0002
>  [X] 0007_alter_validators_add_error_messages
>  [X] 0008_alter_user_username_max_length
>  [X] 0009_alter_user_last_name_max_length
>  [X] 0010_alter_group_name_max_length
>  [X] 0011_update_proxy_permissions
>  [X] 0012_alter_user_first_name_max_length
> contenttypes
>  [X] 0001_initial
>  [X] 0002_remove_content_type_name
> sessions
>  [X] 0001_initial
> shops
>  [X] 0001_initial
>  [X] 0002_auto_20210630_1341
>
> does this give you a better idea?
> Thank you very much again
> Stathis
> On Wednesday, July 7, 2021 at 1:52:35 AM UTC+1 jacobgr...@gmail.com wrote:
>
>> The issue is with the model not the admin page. I suspect you haven't ran
>> migrations for the "Shop" model. You defined a "shop" field in the model,
>> but the database doesn't know anything about it.
>>
>>
>>
>> On Tue, Jul 6, 2021, 7:16 PM Stathis Angelou  wrote:
>>
>>> Good evening all, i have created a new app and added a model. Added the
>>> app under installed apps, and run python manage.py makemigrations and
>>> migrate and everything worked as expected.
>>>
>>> But i believe there is an issue with the admin.py file
>>>
>>> from django.contrib import admin
>>>
>>> # Register your models here.
>>> from django.contrib.gis.admin import OSMGeoAdmin
>>> from .models import Shop
>>>
>>> @admin.register(Shop)
>>> class ShopAdmin(OSMGeoAdmin):
>>> list_display = ('name', 'location')
>>>
>>> Error message:
>>> "ProgrammingError at /admin/shops/shop/relation "shops_shop" does not
>>> exist LINE 1: SELECT COUNT(*) AS "__count" FROM "shops_shop" "
>>>
>>> Any advice or hint would be really appreciated
>>> Kind Regards
>>>
>>> Stathis
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/60ca7670-d423-49e1-9d4a-ea978e193dd4n%40googlegroups.com
>>> 
>>> .
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/fee676a6-fc92-47ab-a3cc-b35e7f907a57n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVH-wLBVtRO9hE%2BpNKTt0CbuLENEV%3DKfNPJFu%2BY8bdmi7Q%40mail.gmail.com.


Re: Django beginner

2021-07-04 Thread Lalit Suthar
I followed these 2

https://www.youtube.com/playlist?list=PLEsfXFp6DpzTD1BD1aWNxS2Ep06vIkaeW
https://docs.djangoproject.com/en/2.2/intro/tutorial01/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVGPg%3D4a3JWbRY6sbz5EjLyEmYTKv620xRxBWvpSHc9G%3DQ%40mail.gmail.com.


Re: i am trying to learn django from django documentation but i am getting an error message in the first part of the documentation

2021-07-04 Thread Lalit Suthar
rewrite polls/urls.py like below
path(''", views.index, name='index'),

On Fri, 25 Jun 2021 at 18:59, Symaxx  wrote:

> I started learning Django from the documentation but it was very hard for
> me and it took me a very long time to grasp the concept
>
> I suggest you try using books by w.s vincent http://wsvincent.com/books/ these
> are the best for me and them help you stay engaged
>
> On Wed, Jun 23, 2021 at 5:19 PM vatsal narula 
> wrote:
>
>> Using the URLconf defined in blogs.urls, Django tried these URL patterns,
>> in this order:
>>
>> admin/ The current path, polls/, didn’t match any of these. this is the
>> error i am getting after i wrote the following code:
>>
>>1.
>>
>>for urls.py
>>from django.contrib import admin from django.urls import include,
>>path urlpatterns = [ path('polls/', include('polls.urls')), path('admin/',
>>admin.site.urls), ]
>>2.
>>
>>for polls/urls.py
>>from django.urls import path from . import views urlpatterns = [
>>path('', views.index, name='index'), ]
>>
>> 3.for polls/views.py
>>
>>  """ from django.http import HttpResponse
>> def index(request): return HttpResponse("Hello, world. You're at the
>> polls index.") """
>>
>> *how i can i remove this error in vs code*
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/5750b076-eddf-400d-b180-4ec7d46aa0e3n%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CANPYDAttdvo3pLcQQ_j5uS3T0%2BNvYB_eSXn%2BMmS%2BO9s9n0i4OQ%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVEmazmCMq-01YuibMWmT7ecR2kYY%2BhezB2em%3DGcbst88Q%40mail.gmail.com.


Re: Role based Authentication

2021-07-07 Thread Lalit Suthar
you can extend User model and have a role field in default User model
https://simpleisbetterthancomplex.com/tutorial/2016/07/22/how-to-extend-django-user-model.html

On Wed, 7 Jul 2021 at 20:47, Avi shah  wrote:

> https://github.com/Avishah123/Multi-user-auth1
>
> On Wed, Jul 7, 2021 at 8:16 PM DJANGO DEVELOPER 
> wrote:
>
>> f
>>
>> On Wed, Jul 7, 2021 at 7:07 PM LokRaj Kumar Vuppu <
>> lokrajkumarvu...@gmail.com> wrote:
>>
>>> How to assign a role to user when registered into our application.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/21f87894-278b-4705-83cb-9a426ea85ee7n%40googlegroups.com
>>> 
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAKPY9pn6SGzjAsfTpoMJPeXBn0XSyNcW-ko8rJ%2BUH-WksRr-oA%40mail.gmail.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CALa7AFOCSQ-cr1pkBTVzDmZvH7b2%3DEb7TPcjHK%2BkhaonuwL%2BRQ%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVEvTHTGsdFbrk5w_b%2B_h9T4u0rnL4R-Zr2TWBt12PyhYA%40mail.gmail.com.


Re: i have a picture field in my model that was not stored properly in django database and i can't retrive that picture

2021-07-07 Thread Lalit Suthar
this can help
https://simpleisbetterthancomplex.com/tutorial/2016/08/01/how-to-upload-files-with-django.html

On Wed, 7 Jul 2021 at 20:25, DJANGO DEVELOPER 
wrote:

> you're doing well but it is not the right way o ask the question. you need
> to describe all of your problem and what you have done to resolve it, then
> may be someone will be able to help you.
>
> On Wed, Jul 7, 2021 at 7:07 PM Hugh Frost 
> wrote:
>
>> please check below view Function
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/8d5c1a31-8781-4eec-8840-bc6b58969c97n%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAKPY9pmak_2wn_d5wwM8MBb0WROq%2BaZ6XjzMHNHZPJKZyEgahw%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVGx76anr9gfsAdsfbzBhPzsxK-371LpKYTNX8Sxrfs0ug%40mail.gmail.com.


Re: ProgrammingError - relationship does not exist

2021-07-08 Thread Lalit Suthar
you can try this
https://stackoverflow.com/questions/26283159/django-1-7-migrations-how-do-i-clear-all-migrations-and-start-over-from-scrat#comment41239691_26283159
if that also doesn't work and you are working on a personal project then
you can try deleting your db, migration files and re running migrations

On Thu, 8 Jul 2021 at 04:48, Stathis Angelou  wrote:

> Good evening all and thank you for your messages,
>
>  as suggested i did delete all migrations in my shops project and did do
> them again,
> but i'm getting the same error message, i did use again makemigrations and
> migrate.
> show migrations show everything applied ok. if it makes it easier for you
> i can share my github repository:
> https://github.com/sangel667/Nearby_Shops_Project
>
> Once again thank oyu very much for your time
>
> Stathis
> On Wednesday, July 7, 2021 at 5:07:50 PM UTC+1 jacobgr...@gmail.com wrote:
>
>> Oh actually, it looks like the table doesn't exist. I misread the SQL.
>> Something is wrong with your migrations. Are you sure you ran
>> "makemigrations" after creating the shop model?
>>
>> On Wed, Jul 7, 2021, 11:03 AM Jacob Greene  wrote:
>>
>>> Do you have any other attributes set in the modeladmin? Something is
>>> telling the ORM to do a query on the "shop" field, and that field doesn't
>>> exist in the DB and it's not defined in the model. Possibly a filter field
>>> in the ModelAdmin class? A full back trace might help illuminate where you
>>> have this set.
>>>
>>> On Wed, Jul 7, 2021, 8:13 AM Samin Serge  wrote:
>>>
 in admin.py put this code to see.
 @admin.site.register (shop)


 Le mer. 7 juil. 2021 à 00:16, Stathis Angelou  a
 écrit :

> Good evening all, i have created a new app and added a model. Added
> the app under installed apps, and run python manage.py makemigrations and
> migrate and everything worked as expected.
>
> But i believe there is an issue with the admin.py file
>
> from django.contrib import admin
>
> # Register your models here.
> from django.contrib.gis.admin import OSMGeoAdmin
> from .models import Shop
>
> @admin.register(Shop)
> class ShopAdmin(OSMGeoAdmin):
> list_display = ('name', 'location')
>
> Error message:
> "ProgrammingError at /admin/shops/shop/relation "shops_shop" does not
> exist LINE 1: SELECT COUNT(*) AS "__count" FROM "shops_shop" "
>
> Any advice or hint would be really appreciated
> Kind Regards
>
> Stathis
>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/60ca7670-d423-49e1-9d4a-ea978e193dd4n%40googlegroups.com
> 
> .
>
 --
 You received this message because you are subscribed to the Google
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to django-users...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CAKRM%3DdFUzUj37o%3DxgqfQZU-Dj9FeH7CTZCUbCpRdkZ-nHAM-oQ%40mail.gmail.com
 
 .

>>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/46a597f2-bfe1-4049-9c15-4d03ed4ac4b7n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVGJVUSdLcQ2xofrO88gqM0eGLOk5d1wyHkRUh_HhqjpVg%40mail.gmail.com.


Re: paginate_by attribute not giving error.

2021-07-02 Thread Lalit Suthar
override `get_context_data` instead of `get_queryset` for this task
refer: https://ccbv.co.uk/

On Thu, 1 Jul 2021 at 14:41, sunday honesty  wrote:

> Hello guys, it's been a while here.
>
> Need some help pls.
>
> I had to override my ListView get_querryset() method to query my posts
> according to a given category. But it seem my context is not a list of
> objects again as I get this error message: "TypeError: unhashable type:
> 'slice' " when I try to add a paginate_by attribute to the view. Pls see my
> view below:
>
>
>
> class CategoryListView(ListView):
> template_name = 'blog/category.html'
> context_object_name = 'cat_list'
> paginate_by = 4
>
> def get_queryset(self):
> context = {
> 'cat': self.kwargs['category'],
> 'posts':
> Post.objects.filter(category__name=self.kwargs['category'],
> status='published')
> }
> return context
>
> Any help will be appreciated as I don't seem to be strong with Django.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CALcuGNsa7gbpS7%3D_8tUNpXUVduR8tshygU7ZZNco1gjUz%3DeJTg%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVF%3D8VO1vzEAPWVHRRf4z4G4ue1SQqVsfyYTU3p189TjRA%40mail.gmail.com.


Re: code question

2021-06-29 Thread Lalit Suthar
https://youtu.be/SNXn76SI1Ks
try this

On Wed, Jun 30, 2021, 1:27 AM frank dilorenzo  wrote:

> Here is a function view:
>
> def base(request):
>
> shipments = Shipment.objects.all().order_by("-slabel")[:5]
>
> suppliers = Supplier.objects.all()
>
>
> context = {
>
> "shipments": shipments,
>
> "suppliers": suppliers,
>
> }
>
> return render(request, "base/dashboard.html", context)
>
>
> I tried to figure this out myself but apparently I can't.  I want to
> convert this to a class based view if possible but I couldn't figure out
> how to send the context data to the .html file.  Not sure it that is even
> possible.  I am new to django for sure.
>
>
> Frank
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/95d0558e-5f34-4e81-b20c-c95aee4af739n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVFDGwDMMb%2BKJ-SCamJToR2N94B4ENBhL2f5MQyQRhO-iw%40mail.gmail.com.


Re: counting the same words within a song added by a user using Django

2021-07-05 Thread Lalit Suthar
https://www.guru99.com/python-counter-collections-example.html
Counter can be helpful for this situation

On Mon, 5 Jul 2021 at 17:07, DJANGO DEVELOPER 
wrote:

> Hi there.
> I am developing a project based on adding songs to the user's library and
> to the home page.
> other users can also purchase the songs like wise people do shopping on
> eCommerce stores.
> *Problem:(Question)*
> The problem that I want to discuss here is that when a user adds a sing
> through django forms, and now that song is added to the user's personal
> library.
> now what I want to do is :
>
>
> *When the lyrics of a song are added as a record to the "Song" table, the
> individual words in that song should be added to a 2nd table with their
> frequency of usage within that song (so the words need to be counted and a
> signal needs to be created).Also, when a user adds the song to his/her
> personal library, all of the words from the song and their frequencies
> within that song should be added to another table and associated with that
> user.*
>
> how to count same word within a song?
>
> can anyone help me here?
> your help would be appreciated.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/bc7bc37b-6f26-465c-b330-d275ab86b76an%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVHuos6d4%3D-_S%3DR-q8hq48Yzf%3D-xgmPziKEA2a3DYXAzbg%40mail.gmail.com.


Re: counting the same words within a song added by a user using Django

2021-07-06 Thread lalit suthar
cool :D 

On Tuesday, 6 July 2021 at 10:25:06 UTC+5:30 abubak...@gmail.com wrote:

> I found this as well. and I think  I want the result this way.
>
> On Tue, Jul 6, 2021 at 9:21 AM Lalit Suthar  wrote:
>
>> [image: Screen Shot 2021-07-06 at 9.50.12 AM.png]
>> Counter works with words also
>>
>> nice one Simon Charette learned something new :) 
>>
>> On Tue, 6 Jul 2021 at 07:56, DJANGO DEVELOPER  
>> wrote:
>>
>>> thanks Simon but I am not using postgresql. I am using sqlite3 database. 
>>> so I want a global solution, that work in all the databases.
>>>
>>> On Tue, Jul 6, 2021 at 1:54 AM Simon Charette  
>>> wrote:
>>>
>>>> If you're using a PostgreSQL you might want to look at using a tsvector 
>>>> column instead which will ignore stop words (the, or, of, ...) and map 
>>>> lexemes to their number of occurrence and position in the lyrics[0]. 
>>>> Assuming you were to index this column you'd be able to efficiently query 
>>>> it for existence of a particular lexeme or multiple of them.
>>>>
>>>> You could then a union of all a user's song lyrics tsvector and even 
>>>> apply weights based on their listening frequency or their favorite songs.
>>>>
>>>> Cheers,
>>>> Simon
>>>>
>>>> [0] 
>>>> https://stackoverflow.com/questions/25445670/retrieving-position-and-number-of-lexem-occurrences-from-tsvector
>>>> Le lundi 5 juillet 2021 à 13:51:48 UTC-4, abubak...@gmail.com a écrit :
>>>>
>>>>> Thank you Lalit bhai.
>>>>> it seems to be a solution.
>>>>> but what if I want to get the result for each single word rather than 
>>>>> single letter?
>>>>>
>>>>>
>>>>> On Mon, Jul 5, 2021 at 5:43 PM Lalit Suthar  
>>>>> wrote:
>>>>>
>>>>>> https://www.guru99.com/python-counter-collections-example.html
>>>>>> Counter can be helpful for this situation
>>>>>>
>>>>>> On Mon, 5 Jul 2021 at 17:07, DJANGO DEVELOPER  
>>>>>> wrote:
>>>>>>
>>>>>>> Hi there.
>>>>>>> I am developing a project based on adding songs to the user's 
>>>>>>> library and to the home page.
>>>>>>> other users can also purchase the songs like wise people do shopping 
>>>>>>> on eCommerce stores.
>>>>>>> *Problem:(Question)*
>>>>>>> The problem that I want to discuss here is that when a user adds a 
>>>>>>> sing through django forms, and now that song is added to the user's 
>>>>>>> personal library.
>>>>>>> now what I want to do is :
>>>>>>>
>>>>>>>
>>>>>>> *When the lyrics of a song are added as a record to the "Song" 
>>>>>>> table, the individual words in that song should be added to a 2nd table 
>>>>>>> with their frequency of usage within that song (so the words need to be 
>>>>>>> counted and a signal needs to be created).Also, when a user adds the 
>>>>>>> song 
>>>>>>> to his/her personal library, all of the words from the song and their 
>>>>>>> frequencies within that song should be added to another table and 
>>>>>>> associated with that user.*
>>>>>>>
>>>>>>> how to count same word within a song? 
>>>>>>>
>>>>>>> can anyone help me here?
>>>>>>> your help would be appreciated.
>>>>>>>
>>>>>>> -- 
>>>>>>> You received this message because you are subscribed to the Google 
>>>>>>> Groups "Django users" group.
>>>>>>> To unsubscribe from this group and stop receiving emails from it, 
>>>>>>> send an email to django-users...@googlegroups.com.
>>>>>>> To view this discussion on the web visit 
>>>>>>> https://groups.google.com/d/msgid/django-users/bc7bc37b-6f26-465c-b330-d275ab86b76an%40googlegroups.com
>>>>>>>  
>>>>>>> <https://groups.google.com/d/msgid/django-users/bc7bc37b-6f26-465c-b330-d275ab86b76an%40googlegroups.com?utm_medium=email_source=footer>
>>>>>>> .
>>>>>>>
>>>>>> -- 
>>>>&

Re: counting the same words within a song added by a user using Django

2021-07-05 Thread Lalit Suthar
[image: Screen Shot 2021-07-06 at 9.50.12 AM.png]
Counter works with words also

nice one Simon Charette learned something new :)

On Tue, 6 Jul 2021 at 07:56, DJANGO DEVELOPER 
wrote:

> thanks Simon but I am not using postgresql. I am using sqlite3 database.
> so I want a global solution, that work in all the databases.
>
> On Tue, Jul 6, 2021 at 1:54 AM Simon Charette 
> wrote:
>
>> If you're using a PostgreSQL you might want to look at using a tsvector
>> column instead which will ignore stop words (the, or, of, ...) and map
>> lexemes to their number of occurrence and position in the lyrics[0].
>> Assuming you were to index this column you'd be able to efficiently query
>> it for existence of a particular lexeme or multiple of them.
>>
>> You could then a union of all a user's song lyrics tsvector and even
>> apply weights based on their listening frequency or their favorite songs.
>>
>> Cheers,
>> Simon
>>
>> [0]
>> https://stackoverflow.com/questions/25445670/retrieving-position-and-number-of-lexem-occurrences-from-tsvector
>> Le lundi 5 juillet 2021 à 13:51:48 UTC-4, abubak...@gmail.com a écrit :
>>
>>> Thank you Lalit bhai.
>>> it seems to be a solution.
>>> but what if I want to get the result for each single word rather than
>>> single letter?
>>>
>>>
>>> On Mon, Jul 5, 2021 at 5:43 PM Lalit Suthar 
>>> wrote:
>>>
>>>> https://www.guru99.com/python-counter-collections-example.html
>>>> Counter can be helpful for this situation
>>>>
>>>> On Mon, 5 Jul 2021 at 17:07, DJANGO DEVELOPER 
>>>> wrote:
>>>>
>>>>> Hi there.
>>>>> I am developing a project based on adding songs to the user's library
>>>>> and to the home page.
>>>>> other users can also purchase the songs like wise people do shopping
>>>>> on eCommerce stores.
>>>>> *Problem:(Question)*
>>>>> The problem that I want to discuss here is that when a user adds a
>>>>> sing through django forms, and now that song is added to the user's
>>>>> personal library.
>>>>> now what I want to do is :
>>>>>
>>>>>
>>>>> *When the lyrics of a song are added as a record to the "Song" table,
>>>>> the individual words in that song should be added to a 2nd table with 
>>>>> their
>>>>> frequency of usage within that song (so the words need to be counted and a
>>>>> signal needs to be created).Also, when a user adds the song to his/her
>>>>> personal library, all of the words from the song and their frequencies
>>>>> within that song should be added to another table and associated with that
>>>>> user.*
>>>>>
>>>>> how to count same word within a song?
>>>>>
>>>>> can anyone help me here?
>>>>> your help would be appreciated.
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Django users" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to django-users...@googlegroups.com.
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/django-users/bc7bc37b-6f26-465c-b330-d275ab86b76an%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/django-users/bc7bc37b-6f26-465c-b330-d275ab86b76an%40googlegroups.com?utm_medium=email_source=footer>
>>>>> .
>>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Django users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to django-users...@googlegroups.com.
>>>>
>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/django-users/CAGp2JVHuos6d4%3D-_S%3DR-q8hq48Yzf%3D-xgmPziKEA2a3DYXAzbg%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/django-users/CAGp2JVHuos6d4%3D-_S%3DR-q8hq48Yzf%3D-xgmPziKEA2a3DYXAzbg%40mail.gmail.com?utm_medium=email_source=footer>
>>>> .
>>>>
>>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to dja

Re: Django Help | Counting word frequency in Django using dictionary.

2021-07-06 Thread Lalit Suthar
you can use postgres JsonField
https://docs.djangoproject.com/en/3.2/ref/contrib/postgres/fields/#jsonfield

On Wed, 7 Jul 2021 at 06:05, DJANGO DEVELOPER 
wrote:

> Hi
>  I am developing a django project and I want to count word frequency at
> the django admin side.
> Means a word is repeating in a string should be counted and be saved in
> the database only.
> I have managed to do it on front-end side but now I also want to do it on
> django admin side.
> example: any_string = {'word1': 12,'word2': 29}
> this the example because I want to get the data this way. word1 is there
> for 12 times in a string and same is the case for word2.
> so I need help and your help would be appreciated.
> thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/672d9b02-382e-4b79-bcaf-6b618b514c28n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVEM2mq8EPokL9KwU3OGz%2BgaJf%3DgMALZbVa%3DdsEeW1WGiw%40mail.gmail.com.


Re: Role And Permission

2021-08-23 Thread Lalit Suthar
https://medium.com/djangotube/django-roles-groups-and-permissions-introduction-a54d1070544

On Wed, 18 Aug 2021 at 18:32, Premkumar Chalmeti <
premkumarchalm...@gmail.com> wrote:

> I was working on a similar requirement.
>
> Checkout this https://github.com/premchalmeti/company_uam
>
> Inside `Docs/` I've attached a class diagram check if its useful. Lets
> collaborate together.
>
> On Tuesday, August 17, 2021 at 12:00:42 PM UTC+5:30 amit.m...@gmail.com
> wrote:
>
>> Handling Role From Frontend side
>> like:-
>> add role
>> delete role
>> update role
>> then Handling Permissions
>> Assign permission
>> remove permissions from frontend side
>>
>> So finally I want to Customise role and permission
>> any one guide me for this?
>>
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/7aa1aafd-697d-4938-ac3e-082bc8a69403n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVH7MpZDgr317YbZYLQBRTKyt%3D%3DGSmsGiT-HYvKBY2a3QQ%40mail.gmail.com.


Re: Run Any Python Project

2021-08-23 Thread Lalit Suthar
install requirements, possibly there'll be a file named requirements.txt
run the command after going inside the directory `pip install -r
requirements.txt` and it will do

On Mon, 23 Aug 2021 at 11:32, MUGOYA DIHFAHSIH  wrote:

> but i think the error is so clear, there is no module named gettext_noop
> so you need to first install it
>
> On Sun, 22 Aug 2021 at 00:25, Kasper Laudrup 
> wrote:
>
>> On 20/08/2021 15.08, Rana Zain wrote:
>> > Hi,
>> > Can anybody help me to know how we can run any python project from Git
>> > and any other sources.
>> >
>>
>> https://wiki.python.org/moin/BeginnersGuide
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/a55ddcee-0da8-c193-0d0b-8b187585cbec%40stacktrace.dk
>> .
>>
>
>
> --
> Mugoya Dihfahsih
> Software Engineer
> Kampala, Uganda
> Whatsapp: +256 751612792
> Profile: *dihfahsih1.github.io/
> profile*
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAP%3DJD9y%3DcYs2Yx9LC5chBZ%3DTwZO%2Bf-quTRk-T5OX0TDug3%3DhoQ%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVFgVGkq6VRAPAvAoZt7G0dL%3DcQr0MoEgovUMG_TPDhX4A%40mail.gmail.com.


Re: TypeError: 'str' object is not callable

2021-08-30 Thread Lalit Suthar
go like this

messages.add_message(request, messages.WARNING, "failure message")
return HttpResponse / render

On Tue, 31 Aug 2021 at 10:32, Salima Begum 
wrote:

> Hi, Thank you for your response.
>  I have defined as below  I have mentioned snippet in all functionalities
> i am getting error in every functionality  " 'str' object is not callable
> ".Please help me to fix this issue.
>
> ```
> messages.success(request, """Your Ad is successfully posted.""")
> ```
> Thank you
> ~Salima
>
> On Tue, Aug 31, 2021 at 10:19 AM Salima Begum <
> salim...@rohteksolutions.com> wrote:
>
>> Hi Thomas,
>>
>> The way I defined how i have written code for confirmation message
>> ```
>> messages.success(request, """Your Ad is successfully posted.""")
>> ```
>> Thank you
>> ~Salima
>>
>> On Tue, Aug 31, 2021 at 9:31 AM Thomas Lockhart 
>> wrote:
>>
>>> Just guessing that you need to write
>>>
>>> messages.success = “Your ad is successfully posted”
>>>
>>> But without more information from you that is only a guess.
>>>
>>> How is messages.success defined?
>>>
>>> - Tom
>>>
>>> On Aug 30, 2021, at 8:57 PM, Salima Begum 
>>> wrote:
>>>
>>> Hi all,
>>> In my project for each functionality I have written code for
>>> confirmation messages. For example
>>> ```
>>> messages.success("Your ad is successfully posted")
>>> ```
>>> Every functionality is breaking because of confirmation messages after
>>> deployment. How to fix it? Can anyone help me?
>>>
>>> Thank you
>>> ~Salima
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAMSz6bkOz8AXa7d%2BRFFjm0m8xmCLYOyLQNx6syy7tf-NsPTRhA%40mail.gmail.com
>>> 
>>> .
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/3831F4E1-0003-4F5A-922D-F6E1534E1B87%40gmail.com
>>> 
>>> .
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMSz6b%3Dgrd5PeypVZJQ9L9uA90_xxijiq6eQSaqH6bdqhgNukg%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVE6P_5qUAC2Ec%3D8Tzn6mUPTdvXhWJ4dO5XUUC2D-7vYVQ%40mail.gmail.com.


Re: roles and permissions

2021-08-14 Thread Lalit Suthar
https://www.django-rest-framework.org/api-guide/permissions/

On Sat, 14 Aug 2021 at 04:35, Mike Dewhirst  wrote:

> Have you looked at ...
>
> https://simpleisbetterthancomplex.com/tutorial/2018/01/18/how-to-implement-multiple-user-types-with-django.html
>
>
>
>
> --
> (Unsigned mail from my phone)
>
>
>
>  Original message 
> From: Amit Vaghani 
> Date: 13/8/21 23:28 (GMT+10:00)
> To: Django users 
> Subject: roles and permissions
>
> I want develop Custom Roles And Permission
> Any one guide me
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/8a8babc1-445c-416a-9abd-de75bec61a38n%40googlegroups.com
> 
> .
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/6116fa87.1c69fb81.1604d.c2a5SMTPIN_ADDED_MISSING%40gmr-mx.google.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVGTet_Gic0OthOhPPoOw8%3D%3DsQ2eN49pNC_xVRm5s9MYZQ%40mail.gmail.com.


Re: Help

2021-08-14 Thread Lalit Suthar
You should send a custom frontend url to the users, appending the
parameters required.
Now your frontend will received that and send a POST request with the
params received to your DRF backend
There you can verify the parameters and change the password

On Fri, 13 Aug 2021 at 11:56, ola neat  wrote:

> Ohk
> So this is it I'm working on a project using drf & angular & I want to add
> forgot password functionality to the project,  which i have  successfully
> achieved now my issue is this after they link for changing password has
> been successfully sent to the user's email address( IMG above) how do i
> ensure that when the user clicks on that link instead of been redirected to
> a django view he/she is redirected to an angular form where they can change
> their password
>
>
>
> On Thu, Aug 12, 2021, 21:30 Kasper Laudrup  wrote:
>
>> On 12/08/2021 15.05, ola neat wrote:
>> > This is d link I've generate 4 reset pswd sent 2 d user email, but I'm
>> > using angular 4 my front end,  now my iss is how do i pass angular url
>> > so that when d user clicks on diz link, he/she will b redirected to d
>> > angular change pswd form
>> >
>>
>> It is pretty hard to understand what you're writing. Not sure if it some
>> kind of Pigeon English or similar, but from what I can gather you're
>> trying to send an email with a link and the email doesn't contain the
>> link you expect?
>>
>> I don't know why Angular should be related to that, but I don't have any
>> experience with that. Maybe you're writing a single page application and
>> want to create a link to a specific page there?
>>
>> Try to rewrite your question in plain English if possible, show the code
>> that generates the incorrect link and which link (or specific page in
>> you Angular code) you'd actually want it to generate instead.
>>
>> Kind regards,
>>
>> Kasper Laudrup
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/882ba90f-fdfa-55ca-d154-510f64b5dbd6%40stacktrace.dk
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHLKn70nv8_8mJcL%3Dx4oGkMB0Xit-_9Y06t0SDjQp6fPZqwLiQ%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVG-yjXc-NWZ2shjmppRx5HkqUk2HHw8HXb0RTpR8mAEMA%40mail.gmail.com.


Re: TypeError: 'str' object is not callable

2021-09-01 Thread Lalit Suthar
cool :)


On Tue, 31 Aug 2021 at 11:27, Salima Begum 
wrote:

> Hi all,
> Actually this error is prompting because in my deployment site I am using
> django version 3.2. In this version they have some issue with messages so,
> I referred to this document and I fixed it by adding one line in the
> settings.py file.
> https://docs.djangoproject.com/en/3.2/ref/contrib/messages/
>
> On Tue, Aug 31, 2021 at 11:22 AM Lalit Suthar 
> wrote:
>
>> go like this
>>
>> messages.add_message(request, messages.WARNING, "failure message")
>> return HttpResponse / render
>>
>> On Tue, 31 Aug 2021 at 10:32, Salima Begum 
>> wrote:
>>
>>> Hi, Thank you for your response.
>>>  I have defined as below  I have mentioned snippet in all
>>> functionalities i am getting error in every functionality  " 'str' object
>>> is not callable ".Please help me to fix this issue.
>>>
>>> ```
>>> messages.success(request, """Your Ad is successfully posted.""")
>>> ```
>>> Thank you
>>> ~Salima
>>>
>>> On Tue, Aug 31, 2021 at 10:19 AM Salima Begum <
>>> salim...@rohteksolutions.com> wrote:
>>>
>>>> Hi Thomas,
>>>>
>>>> The way I defined how i have written code for confirmation message
>>>> ```
>>>> messages.success(request, """Your Ad is successfully posted.""")
>>>> ```
>>>> Thank you
>>>> ~Salima
>>>>
>>>> On Tue, Aug 31, 2021 at 9:31 AM Thomas Lockhart <
>>>> tlockhart1...@gmail.com> wrote:
>>>>
>>>>> Just guessing that you need to write
>>>>>
>>>>> messages.success = “Your ad is successfully posted”
>>>>>
>>>>> But without more information from you that is only a guess.
>>>>>
>>>>> How is messages.success defined?
>>>>>
>>>>> - Tom
>>>>>
>>>>> On Aug 30, 2021, at 8:57 PM, Salima Begum <
>>>>> salim...@rohteksolutions.com> wrote:
>>>>>
>>>>> Hi all,
>>>>> In my project for each functionality I have written code for
>>>>> confirmation messages. For example
>>>>> ```
>>>>> messages.success("Your ad is successfully posted")
>>>>> ```
>>>>> Every functionality is breaking because of confirmation messages after
>>>>> deployment. How to fix it? Can anyone help me?
>>>>>
>>>>> Thank you
>>>>> ~Salima
>>>>>
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Django users" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to django-users+unsubscr...@googlegroups.com.
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/django-users/CAMSz6bkOz8AXa7d%2BRFFjm0m8xmCLYOyLQNx6syy7tf-NsPTRhA%40mail.gmail.com
>>>>> <https://groups.google.com/d/msgid/django-users/CAMSz6bkOz8AXa7d%2BRFFjm0m8xmCLYOyLQNx6syy7tf-NsPTRhA%40mail.gmail.com?utm_medium=email_source=footer>
>>>>> .
>>>>>
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Django users" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to django-users+unsubscr...@googlegroups.com.
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/django-users/3831F4E1-0003-4F5A-922D-F6E1534E1B87%40gmail.com
>>>>> <https://groups.google.com/d/msgid/django-users/3831F4E1-0003-4F5A-922D-F6E1534E1B87%40gmail.com?utm_medium=email_source=footer>
>>>>> .
>>>>>
>>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAMSz6b%3Dgrd5PeypVZJQ9L9uA90_xxijiq6eQSaqH6bdqhgNukg%40mail.gmail.com
>>> <https://gro

Re: permissions mapping

2021-09-07 Thread Lalit Suthar
https://docs.djangoproject.com/en/3.2/topics/auth/default/#permissions-and-authorization

On Tue, 7 Sept 2021 at 18:42, Ssentumbwe Enoch 
wrote:

> I want to design a factory management application but I need some guidance
> roles permissions.
> I want to divide the floor into sections whereby a supervisor in section A
> can review and edit section A's functions without having rights to edit
> section B's functions. He or she can view section B but not edit or delete
> anything there.
>
> In a section A, the operators will add but not delete or edit the reports
> in section A.
>
> It is like a tree of functions.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/8a2e2746-5945-42e9-99a0-3da7c6a0e323n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVExiK0LRQLKHN-azb085-XkwbnOkXQm_v8crLJB%2BYX%3DmQ%40mail.gmail.com.


Re: Auto populating business organization logos

2021-09-19 Thread Lalit Suthar
good point @Shishir

Ram you can try getting favicon from the organization url they enter. I
found a package for that also
https://pypi.org/project/favicon/

On Mon, Sep 20, 2021, 6:49 AM Shishir Jha  wrote:

> I believe linkedin is not using any api. Why would they need that? All the
> companies have their own accounts in the linkedin itself right? Thats how
> you apply to them. So linkedin muat be using images from its own database
> and not from some third party api.
>
> On Mon, 20 Sep 2021, 6:19 am Ram,  wrote:
>
>> Hi,
>>
>> As most of you know LinkedIn automatically adds a logo of a company when
>> you update your profile with work experience from that company. Similar to
>> that functionality, is there a  way to auto  populate any business
>> organizaiton logo in Django?  I guess this can be done using an API but not
>> sure who provides such API?
>>
>> Any pointers will be appreciated.
>>
>> Best regards,
>> ~Ram
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CA%2BOi5F1Jy%3DF7eEpqYuf8ET3vHxe6d%2BKijiA02VNqs4WtkZTvLw%40mail.gmail.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CA%2BC7wFTD5SK_kSpsBbWrL%3DCR7QqyqqRZMPWRoR9bdnw%3D2BcAQw%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVFJARP-BejWNOnjHD307deJFzYv%3DABmAB8RxYtrcxwKUA%40mail.gmail.com.


Re: cannot get value(foreign key) after using distinct()

2021-10-18 Thread Lalit Suthar
since you are using .first() in the query, it will return only 1 object so
I don't think using a for loop our 'category' in template will work

On Mon, 18 Oct 2021 at 18:04, Katharine Wong 
wrote:

> Hi all,
>
> There is a question when I use distinct().
> When I try to use the ORM(distinct & value), I cannot get the value of the
> attribute(foreign key).
>
> models.py
>
>  class Category(models.Model):
>  category = models.CharField(max_length=20)
>
> class Article(models.Model):
>  category = models.ForeignKey(Category, on_delete=models.CASCADE)
>
>
> views.py
>   category =
> Article.objects.filter(visible=True).values('category').distinct().first()
>   return_result.update({'category': category})
>
> template/xxx.html
>
>  {% if category %}
>  {% for name in category %}
> {{ name.category }}
> ...
>
> the result is 4. (int) and there is no result if I type {{
> name.category.category }}
>
> I hope the result is Work which is the 4(category_id) refs.
>
> Thanks,
> Kath
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CALUcQhHOQ7rcg_xLgJocyubWCN8pFOLmvrsnDqbkSWAWF-_Y2A%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVEG%2Bk8fnseW4Tr_iME-dN_%3DTbojM%2BnL5kcwzFgyUdbjtQ%40mail.gmail.com.


Re: TypeError __init__() takes 1 positional argument but 2 were given

2021-10-19 Thread Lalit Suthar
try changing this

def get_context_data(self, *args, **kwargs):
context = super(registro, self).get_context_data(*args, **kwargs)

to this

def get_context_data(self, **kwargs):
context = super(registro, self).get_context_data(**kwargs)

refer:
https://ccbv.co.uk/projects/Django/3.2/django.views.generic.edit/CreateView/

On Tue, 19 Oct 2021 at 02:27, Jose Cabrera  wrote:

> hello everyone, please help me with this error that is generated in the
> views.py, in class registro(CreateView):
> Thank you
> form.py
> class RegistrationForm(forms.ModelForm):
> password = forms.CharField(label='Password',
> widget=forms.PasswordInput)
> class Meta:
> model = UserProfile
> fields = ('email','password')
>
> def save(self, commit=True):
> # Save the provided password in hashed format
> user = super().save(commit=False)
> user.set_password(self.cleaned_data["password"])
> if commit:
> user.save()
> return user
>
> views.py
> from .models import UserProfile
> from .forms import RegistrationForm
> from django.views.generic.edit import CreateView, UpdateView
> from django.urls import reverse
>
> class registro(CreateView):
> template_name = 'registration/registro.html'
> form_class = RegistrationForm
>
> def get_context_data(self, *args, **kwargs):
> context = super(registro, self).get_context_data(*args, **kwargs)
> context['next'] = self.request.GET.get('next')
> return context
>
> def get_success_url(self):
> next_url = self.request.POST.get('next')
> success_url = reverse('home')
> if next_url:
> success_url += '?next={}'.format(next_url)
>
> return success_url
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/070868ce-cd4a-4231-9685-38144e2cd417n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVFpOiQ04VLBwtFOhXh6SM4h4J6jL03EnikwowBmGux4Xw%40mail.gmail.com.


Re: django datatable

2021-10-20 Thread Lalit Suthar
you can try bootstrap also

On Wed, 20 Oct 2021 at 12:46, Abhishek Choudhury <
choudhuryabhishe...@gmail.com> wrote:

> Hi,
>
> You can use Tailwind CSS and it will significantly improve the UI.
>
>
> Thanks and regards,
> Abhishek Choudhury
>
>
> On Wed, 20 Oct 2021 at 11:26 AM, Eugene TUYIZERE 
> wrote:
>
>> Please suggest a good CSS  for the datatable below
>> [image: image.png]
>> Regards,
>>
>>
>> --
>> *Eugene*
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CABxpZHvN2XvzwQ0V4swjK1JD8MwY6Rq9tN8uUuqOpZFaqdjHdQ%40mail.gmail.com
>> 
>> .
>>
> --
> Thanks and regards,
> Abhishek Choudhury
> Mobile: +91 7903717967
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CA%2B3kJUbpfhoMvbQvO51NtUEKszJCzkfV%3DKSUQ2LhejLA0w6Zqw%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVHBzAyabU5pH7yvPfyrk9WpM5%2BT7NtJkdWubjn6WyUR%2Bw%40mail.gmail.com.


Re: Modeform Foreign key column not working

2021-10-20 Thread lalit suthar
is `ConnectionTypes` a foreign key to `ConnectionDetails`?
in that case you don't need to put it as a field in form, it will be added 
automatically in the form. 
On Wednesday, 20 October 2021 at 18:47:44 UTC+5:30 Aruna Priya wrote:

> Hi,
>
> I am trying to create a form from model and the model has a foreign key 
> and am not able to populate the values from the column it refers to.
>
> My form,
>
> class ConnectionForm(forms.ModelForm):
>
>  connection_type = 
> forms.ModelChoiceField(queryset=ConnectionTypes.objects.all(), 
> to_field_name='connection_type_id')
>
> class Meta:
> model = ConnectionDetails
> exclude = ['connection_id','last_update_date']
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e4b14379-40de-4ea2-8e2c-960448bb8cdfn%40googlegroups.com.


Re: What it takes to bring web application to a mobile app

2021-10-20 Thread Lalit Suthar
you can create apis with django-rest-framework and then can use them at all
the backends for web and mobile.

On Wed, 20 Oct 2021 at 12:58, Stijn Verholen  wrote:

> :D
> On 19/10/2021 17:28, Planet X wrote:
>
> Hey there all all you Mind-blowing people
> i am new in django i am trying to set my view and urls of app and project
> i tried lots of time it showing errors please help me out to do i want to
> learn with the help of your
>
> On Tuesday, October 19, 2021 at 2:31:53 PM UTC+5:30 ram.mu...@gmail.com
> wrote:
>
>> Hi,
>>
>> We are planning to create a mobile app for our e-commerce web application
>> that is being developed on DJango, Python, VUE Js and we need to keep both
>> mobile and web interfaces but data should be synced seamlessly. Also we
>> don’t want responsive design web app in mobile view.
>>
>> Best regards,
>> ~ Ram
>> ~ Ram
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/53d6d752-020f-4df6-a250-44e80f19af58n%40googlegroups.com
> 
> .
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/07d765fc-310c-f575-0fb2-07552edae59e%40gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVHYFkjHZS2%3DO2LpkTYEpnChh43Pad-9G%2BA_UM1GRO46ww%40mail.gmail.com.


Re: [DJANGO-TUTORIAL]

2021-10-16 Thread Lalit Suthar
   -

   https://tutorial.djangogirls.org/en/
   -

   https://docs.djangoproject.com/en/3.0/intro/tutorial01/
   -

   https://www.youtube.com/playlist?list=PLEsfXFp6DpzTD1BD1aWNxS2Ep06vIkaeW


On Sat, 9 Oct 2021 at 04:05, David Nugent  wrote:

> For interactive web pages, you are (almost) necessarily talking about
> javascript.
>
> Given your background and what you're most likely to be doing next, I
> would suggest looking at D3.js - Data-Driven Documents (d3js.org)
> . It is a somewhat large but very mature library for
> visual representation and has a strong following in scientific applications
> and is a good investment of your time to learn.
>
> Regards, David
>
> On Sat, Oct 9, 2021 at 1:17 AM Chakresh Singh <
> chakresh.si...@alumni.iitgn.ac.in> wrote:
>
>> Dear All,
>> I am beginning my first task on Django. I come from a physics background
>> and am a novice in web development.
>> My aim is to develop an interactive web-page where users see some
>> keywords and can choose a pair, which then connects them with a line.
>> I should be able to record these pairs and make a graph out of it. This
>> is basically to teach freshers about network growth mechanisms.
>>
>> Any suggestions and help on this would be highly appreciated.
>>
>> Regards
>> Chakresh
>> post-doc CRI-Paris
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/204caf87-5bd9-416f-a0ac-95d30a3e10ban%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAE5VhgVSBU_PxJQ7HjMDx%2BnRUJE8tvj5u2quUGNay-UG-wz%2B_w%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVGOvVv64LkGYJnRx4pukBwW%2BvBXawdigb-LWg%2BrEPUnhA%40mail.gmail.com.


Re: OnlineBook - High Performance Django

2021-10-16 Thread Lalit Suthar
thanks for sharing Brent :)

On Wed, 13 Oct 2021 at 17:44, Brent Clark  wrote:

> Good day Guys
>
> I got this off news.python.sc, and thought I would share in case anyone
> misses it.
>
> https://lincolnloop.com/high-performance-django/index.html
>
> Definitely some tidbits of information, esp to areas of securing and
> performance improving.
>
> HTH
> Regards
> Brent
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/351773ca-3b6a-bc04-00e4-76092eb2e841%40gmail.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVHSsEeXM5Ye%3DeGoaXMsvXzXzAAfRKUH1NpoZNcVDtaWDQ%40mail.gmail.com.


Re: New to Django

2021-10-16 Thread Lalit Suthar
I recommand
https://www.youtube.com/playlist?list=PLEsfXFp6DpzRMby_cSoWTFw8zaMdTEXgL

On Sun, 3 Oct 2021 at 17:32, bnmng  wrote:

> I think you'll get a few opinions on this.  My opinion is no.  I feel the
> docs are very good but difficult to understand as a beginner.  I like
> Mozilla's into with the Local Library tutorial to get started
> https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django
>
> On Friday, October 1, 2021 at 11:09:04 PM UTC-4 richluet...@gmail.com
> wrote:
>
>> Hi, I want to learn django very well but tutorials like youtube videos,
>> books and pay for online courses are not really satisfying me that much .
>> So if I decide to learn django directly from the documentation will I learn
>> good enough to Intermediate and Advance level ?  if yes please help me with
>> an order path to follow. Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/a928d80a-eaf4-495e-8e0f-abc46ba3c9a0n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVHuh_m__mZ1UDr4chw7fctJbf3offf4o9%2BLRcCPg9j8Uw%40mail.gmail.com.


Re: Query help

2021-09-20 Thread Lalit Suthar
Sum, Count works when we try to get sum/count for a column,
for this case you can try something like this

def get_yes_count_by(id):
user = User.objects.get(id=id)
count = 0
for val in user.__dict__.values():
if val == "YES":
count += 1
return count

On Tue, 21 Sept 2021 at 04:11, J.T.  wrote:

> I have a model called member that has 6  columns: ID, Value1, Value2,
> Value3, Value4, Value5
>
> The values in columns Value1, Value2, Value3, Value4, Value5 are either Y
> or N.
>
> I'm trying to query by ID to count the number of Y values for each member.
>
> For example one row would be: 5, Y, N, Y, N, N
>
> I would like to return: 2 (since that is the number of Y in that member's
> row)
>
> I've tried using Aggregate, Annotate, F, Q, Sum, Count in different ways
> and I'm missing the mark. I've been through the docs and SO for about 2
> hours.
> I would post my errors but it's on my work computer and I have to post
> here from my personal laptop.
>
> I feel like I may be over-thinking it but I can't quite figure it out. Any
> help would be greatly appreciated.
>
> Jason
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/597a0acf-65a0-4e9a-8a9f-b61892860789n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVG_Cwyp7bSPfNGDcOg_VKSRtke-dHwtz5A5kRohERV4oQ%40mail.gmail.com.


Re: List Index out of Range

2021-10-03 Thread Lalit Suthar
Adding to above 2 answers index error may also occur when your
time_frame_list or responsible_list does not have the same number of items
as your input_list. You should try bnmng' s answer also
> Which line in your code is triggering the error?

you check it with simple print statements or using a debugger in vscode, or
with ipdb.set_trace()


On Sun, 3 Oct 2021 at 05:50, Hedrick Godson's 
wrote:

> Make sure you fill all the inputs with list and also make sure that you
> provide the correct input name to request.POST.getlist() method otherwise
> it will returns empty list which will raise IndexError
>
> On Sun, 3 Oct 2021, 03:13 bnmng,  wrote:
>
>> Which line in your code is triggering the error?
>>
>> On Saturday, October 2, 2021 at 11:07:13 AM UTC-4 eugenet...@gmail.com
>> wrote:
>>
>>> Good day all,
>>>
>>> I need assistance. Am trying to save data from the below form but I am
>>> getting *list out of range* error
>>>  can someone help me to write a successful save function?
>>>
>>> here is the code I am using:
>>>
>>>
>>> def submit_work(request):
>>> if request.method != "POST":
>>> return HttpResponse("Method Not Allowed")
>>> else:
>>> pillar_id=request.POST.get("pillar")
>>> object_id=request.POST.get("objects")
>>> output_id=request.POST.get("output")
>>> activity_id=request.POST.get("activity")
>>> input_list=request.POST.getlist("input[]")
>>> time_frame_list=request.POST.getlist("timeframe[]")
>>> responsible_list=request.POST.getlist("responsible[]")
>>> j=0
>>> for inp in input_list:
>>> wf=WORKFRAMS(pillar_id=pillar_id,object_id=object_id,output_id=output_id
>>> ,activity_id=activity_id,
>>> input=inp,time_frame=time_frame_list[j],responsible=responsible_list[j])
>>> wf.save()
>>> j=j+1
>>> return HttpResponse("OK")
>>>
>>>
>>>
>>> [image: image.png]
>>>
>>> Regards,
>>>
>>> *TUYIZERE Eugene*
>>>
>>>
>>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/8d69a634-0a2d-42e3-994c-5e19f88a799en%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJAxQD%3Dw6GmZkS%2BPJs%2BJp21Z4Mn3pDS7XbxXp%2BBhLB1Rf3k7wg%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVEecPWditPgWcGWKpx%2BqPz9owKtGfU%2BOUpWbGvTgUtuAw%40mail.gmail.com.


Re: Use previously requested data in another request

2021-12-04 Thread Lalit Suthar
tried to look into the docs but couldn't find a reason.
you can go through this page to find out any possible reason
https://docs.djangoproject.com/en/dev/topics/http/sessions/

On Fri, 3 Dec 2021 at 23:19, kayhan  wrote:

> Thanks but I did not change the settings.
> And to test, SESSION_COOKIE_AGE = 5 * 60,
>   I added to the settings but there is still the same problem.
>
> On Fri, Dec 3, 2021 at 8:55 PM Lalit Suthar 
> wrote:
>
>> We can save that in any django model in ajax() request if possible.
>>
>> You can check if you have modified `SESSION_COOKIE_AGE` (
>> https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-SESSION_COOKIE_AGE
>> )
>> if it is too less that might be the reason.
>>
>> On Fri, 3 Dec 2021 at 16:15, kayhan  wrote:
>>
>>> Hi
>>> I first send a request to Django and save its data with a session.
>>> I will send another request to Django later. Here I want to use the data
>>> of the previous request.
>>> But my code does not work properly. And the value "None" appears in the
>>> output.
>>> Does anyone know what I should do?
>>> Thankful
>>>
>>> def planing(request): if request.is_ajax(): # Get user location from
>>> user location.js file: latitude = request.POST.get('latitude', None)
>>> longitude = request.POST.get('longitude', None) print("latitude,
>>> longitude = ", latitude,longitude) # To save data request.session[
>>> 'latitude'] = latitude request.session['longitude'] = longitude # To
>>> retrive data: latitude = request.session.get('latitude') longitude =
>>> request.session.get('longitude') print("latitude, longitude = ",
>>> latitude,longitude) elif request.method == "GET": return
>>> render(request, "tourist/planing.html") elif request.method == "POST": #
>>> To retrive data: latitude = request.session.get('latitude') longitude =
>>> request.session.get('longitude') print("latitude, longitude = ",
>>> latitude,longitude) Output: latitude, longitude = 34.801595 48.499574
>>> latitude, longitude = 34.801595 48.499574 latitude, longitude = None
>>> None
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/4bef9d07-cd92-440a-8ec0-dd4c206e6ae7n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/4bef9d07-cd92-440a-8ec0-dd4c206e6ae7n%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAGp2JVEkLiwVEAF3uV%3DBBOQJuUwVBaQGhD7RA7t0aDirh%2BD-ZQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAGp2JVEkLiwVEAF3uV%3DBBOQJuUwVBaQGhD7RA7t0aDirh%2BD-ZQ%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAO-vjETOG1Nq%3D_Evk7ryvr27eBxtDSQfiygKV%3Djq9TTzkiuPTw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAO-vjETOG1Nq%3D_Evk7ryvr27eBxtDSQfiygKV%3Djq9TTzkiuPTw%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVE1byyT%2BO8Rxx%2BuGh49ouxvMs8MLmHHWzL-1c_WR8ssnw%40mail.gmail.com.


Re: Use previously requested data in another request

2021-12-03 Thread Lalit Suthar
We can save that in any django model in ajax() request if possible.

You can check if you have modified `SESSION_COOKIE_AGE` (
https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-SESSION_COOKIE_AGE
)
if it is too less that might be the reason.

On Fri, 3 Dec 2021 at 16:15, kayhan  wrote:

> Hi
> I first send a request to Django and save its data with a session.
> I will send another request to Django later. Here I want to use the data
> of the previous request.
> But my code does not work properly. And the value "None" appears in the
> output.
> Does anyone know what I should do?
> Thankful
>
> def planing(request): if request.is_ajax(): # Get user location from user
> location.js file: latitude = request.POST.get('latitude', None) longitude
> = request.POST.get('longitude', None) print("latitude, longitude = ",
> latitude,longitude) # To save data request.session['latitude'] = latitude
> request.session['longitude'] = longitude # To retrive data: latitude =
> request.session.get('latitude') longitude = request.session.get(
> 'longitude') print("latitude, longitude = ", latitude,longitude) elif
> request.method == "GET": return render(request, "tourist/planing.html")
> elif request.method == "POST": # To retrive data: latitude =
> request.session.get('latitude') longitude = request.session.get(
> 'longitude') print("latitude, longitude = ", latitude,longitude) Output:
> latitude, longitude = 34.801595 48.499574 latitude, longitude = 34.801595
> 48.499574 latitude, longitude = None None
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/4bef9d07-cd92-440a-8ec0-dd4c206e6ae7n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVEkLiwVEAF3uV%3DBBOQJuUwVBaQGhD7RA7t0aDirh%2BD-ZQ%40mail.gmail.com.


Re: Exported filtered by date data in django

2021-11-20 Thread Lalit Suthar
`filter_val1` and `filter_val2` are coming from POST request so they are in
`string` format.
But the `created_at` field of the `EXPENSES` table is in `datetime` format.
This is why the result of the filter() is coming as empty.

The query will run fine when the 2 values compared are in the same format
of data.
Same like we can not add 3 apples and 2 bananas.

Convert the `filter_val1` and `filter_val2` in datetime before passing them
in the query.
Refer:
https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior

On Sat, 20 Nov 2021 at 13:19, Eugene TUYIZERE 
wrote:

> Dear Ramadhan,
>
> Still it does not work
>
> On Sat, 20 Nov 2021 at 09:18, ramadhan ngallen  wrote:
>
>> Depends on your query filter_val2 should lower than filter_val1 as the
>> range start from val2 to val1.
>> Otherwise change your parameter from val1 to val2
>> EXPENSES.objects.filter(Q(created_at__range=[filter_val2,filter_val1]))
>>
>> On 20 Nov 2021, 10:04 +0300, Eugene TUYIZERE ,
>> wrote:
>>
>> Dear Team,
>>
>> I am trying to export filtered data from a django model, but I get an
>> empty file. But when I remove the filter and add all, it works.
>>
>> Kindly assist to know how to export filtered data. Below is my code
>>
>> def exportexpenes(request):filter_val1=request.POST.get("filter1")
>> filter_val2=request.POST.get("filter2")response=HttpResponse(content_type
>> ='text/csv')response['Content-Disposition'] = 'attachment;
>> filename=expenses' + str(datetime.datetime.now())+'.csv'writer = csv.
>> writer(response)writer.writerow(['Category','Beneficiary','Description','Operation
>> Date','Amount','Account Number','Paymrnt Date','Status'])expes = EXPENSES
>> .objects.filter(Q(created_at__range=[filter_val2,filter_val1]))# expes =
>> EXPENSES.objects.all()for exp in expes:writer.writerow([exp.category,exp
>> .beneficiary,exp.description,exp.date_of_operation,exp.amount,exp
>> .account_number,exp.payment_date,exp.status])return response
>> regards,
>> --
>> *Eugene*
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com
>> .
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CABxpZHuqV0Py%3D05eyu%3Dv%3DDFBm%2B1y9v-e2AbmVn2Bvj66jG8MZA%40mail.gmail.com
>> 
>> .
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/93a559c8-bc77-44b7-8499-469db0f224e5%40Spark
>> 
>> .
>>
>
>
> --
> *TUYIZERE Eugene*
>
>
>
> *Msc Degree in Mathematical Science*
>
> *African Institute for Mathematical Sciences (AIMS Cameroon)Crystal
> Garden-Lime, Cameroon*
>
> Bsc in Computer Science
>
> *UR-Nyagatare Campus*
>
> Email: eugene.tuyiz...@aims-cameroon.org
>eugenetuyiz...@gmail.com
>
> Tel: (+250) 7 88 26 33 38, (+250) 7 22 26 33 38
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CABxpZHvFzd3N1ur5%3DbzmDtJUUAF3BfjamMg7pra-RCL5ffjZCw%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVEzF_pNQEEt6f1XYsUZ07SqxdfHHSiYa_7rtHbt%2B1ny3g%40mail.gmail.com.


Re: How to retrive data from more than two tables with many to many relationships?

2021-11-20 Thread Lalit Suthar
refer:
https://docs.djangoproject.com/en/2.2/topics/db/examples/many_to_many/

On Sat, 13 Nov 2021 at 00:08, Madhav Dhungana 
wrote:

> *What I want?*
>
> 1 ) I want to add pages and pull the page meta data from pagemeta table.
> One page will have more than on pagemeta.
>
>1.
>
>PageMeta Table , will have section(many to many relationship) and key
>and value like: Keyname: _contact_collapse Value: People usually ask these
>2.
>
>Section Table name: _contact_us_fax
>3.
>
>ModelsMeta Table This table will have: sectionname( foreign key)
>model_key : choices , for example: _heading_title, _heading_paragraph
>meta_vale ( this is for charfield) meta_content: HTML Field
>
> What I want to achieve from this? I want to make my own kind of simple CMS
> where I can create dynamic pages and assign fields to pages by establishing
> relationship with other tables via many to many or foreign key relationship
> when required.
>
> Whats the problem?
>
> To publish the specific page content, I need to know the pagemeta id's of
> that page from that pagemeta table id's, I need to find section table
> related to each and from the section id I will need to find information
> from ModelsMeta table. From this I hope I will be able to create a cms
> system where I can call the other tables data from keyvalue pair.
>
> My table structure code:
>
>
> class SectionKey(models.Model):
>
> model_name =models.CharField(max_length=200)
>
>
>
> class Meta:
>
>
>
> verbose_name = "Section"
>
> verbose_name_plural = "Section"
>
>
>
> def __str__(self):
>
> return self.model_name
>
>
>
>
>
>
>
> class Models(models.Model):
>
> model_name =models.CharField(max_length=200)
>
>
>
>
>
> class Meta:
>
>
>
> verbose_name = "Models"
>
> verbose_name_plural = "Models"
>
>
>
> def __str__(self):
>
> return self.model_name
>
>
>
> class ModelsMeta(models.Model):
>
> model_meta_name =models.ForeignKey(SectionKey, on_delete=
> models.CASCADE,related_name='sectionKey')
>
> modelkey = models.ForeignKey(Models, on_delete=
> models.CASCADE,related_name='Models', default=0)
>
> meta_value = models.CharField(max_length=200)
>
> meta_content = HTMLField()
>
> class Meta:
>
>
>
> verbose_name = "Models Meta"
>
> verbose_name_plural = "Models Meta"
>
>
>
> def __str__(self):
>
> return self.meta_value
>
>
>
> class PageMeta(models.Model):
>
> section = models.ManyToManyField(SectionKey)
>
> name = models.CharField(max_length=500, blank=True)
>
> title = models.CharField(max_length=500, blank=True)
>
> """key=models.CharField(max_length=500)
>
> value=models.CharField(max_length=500)"""
>
>
>
> class Meta:
>
>
>
> verbose_name = "Page Meta"
>
> verbose_name_plural = "Page Meta"
>
>
>
> def __str__(self):
>
> return self.name
>
>
>
> class Page(models.Model):
>
> name=models.CharField(max_length=500)
>
> title = models.CharField(max_length=500)
>
> content = models.CharField(max_length=500)
>
> author = models.ForeignKey(User, on_delete=
> models.CASCADE,related_name='page')
>
> updated_on = models.DateTimeField(auto_now= True)
>
> content = HTMLField()
>
> page_meta = models.ManyToManyField(PageMeta)
>
> created_on = models.DateTimeField(auto_now_add=True)
>
> slug = models.SlugField(max_length=200, unique=True, default=0)
>
> status = models.IntegerField(choices=STATUS, default=0)
>
>
>
> class Meta:
>
>
>
> verbose_name = "Page"
>
> verbose_name_plural = "Pages"
>
>
>
> def __str__(self):
>
> return self.title
>
>
>
> What I have done:
>
>
> def contact(request, slug):
>
> page = get_object_or_404(Page, slug=slug)
>
> meta = page.page_meta.values_list('id', flat=True)
>
> page_meta = Page.objects.filter(id__in=meta)
>
> section = PageMeta.objects.prefetch_related('section', id__in=meta)
>
> models = ModelsMeta.objects.prefetch_related('section', id__in=section)
>
>
> I tried to achieve the goal with this way but I am unable to move ahead
> and get required information on managed way. I can get the page meta id of
> each page but now, how can I get the *section* of each (desired)
> *pagemeta*, and how can I get the *modelsmeta id* of each section
> obtained from *pagemeta*?
>
> *Long story short, I want to retrieve Page model related data from all the
> tables and print on template for each page.*
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/4a6e48cf-d1d5-4441-9753-f60da383c430n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 

Re: Handling url in class based views.

2021-11-20 Thread Lalit Suthar
you can get that slug value from kwargs

def get(self, request, *args, **kwargs):
slug = self.kwargs.get("slug")

also if you like to pass it in the context you can override get_context_data

refer: https://ccbv.co.uk/
to know more about class based views you can refer to this playlist from
video number 36
https://www.youtube.com/playlist?list=PLEsfXFp6DpzTD1BD1aWNxS2Ep06vIkaeW

On Fri, 19 Nov 2021 at 20:41, Perry Bates  wrote:

> You can use the DetailListView from generic views.
> Pass in the template name, form class, and query(which in this case takes
> in the slug to query the db)
>
>
> On Mon, Nov 15, 2021, 21:27 Aadil Rashid  wrote:
>
>> Hello my dear Friends, I have a question regarding Class Based Views.
>>
>> If we have a url e.g,
>> path('item//',  views.funView)
>>
>> We can handle it in  Function Based Views,
>> By simply
>> def funView(request, slug) :
>>#logic
>>return render(request, "tempName")
>>
>>
>> We can even pass this slug as a context in this template,
>>
>>
>> My question is how can we achieve this by using class Based Views.
>>
>>
>> Thanks in advance.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAAYXZx_Sn2BBhPWZXi_zEECN-x7wu9sDQJfYeVH31oHhemptpQ%40mail.gmail.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CANMtYSTrHPFaGsmPqp8w6PhPUbxTiU_u8qxvqLQj%2BoJ3O_eZdA%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVHoOSiEYnr3-7_rrfdo%3DGymGBRVwuc54fd_a6Y%3DC_C%3DBw%40mail.gmail.com.


Re: def post in ListView

2021-11-24 Thread Lalit Suthar
you can use `query_params`

On Wed, 24 Nov 2021 at 19:04, bnmng  wrote:

> Hi everyone,
>
> Is there anything dangerous about this?
> class ItemList(ListView):
> model = Item
> def post(self, request, *args, **kwargs):
> self.request.GET = self.request.POST
> return super().get(request, *args, **kwargs)
>
> I want to use this to accept filtering parameters from a form in a list
> view template. This ListView also has a get_queryset which returns a
> filtered query based on the parameters
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/aa7a1392-e388-4727-b412-bd1329daa6c4n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVF2S-b-Kst%3DRYM9Sg5G%2B2URa1J9FPyQNqd0yHPdHPHfUQ%40mail.gmail.com.


Re: def post in ListView

2021-11-24 Thread Lalit Suthar
oh my bad that is available in django rest framework only


On Wed, 24 Nov 2021 at 22:41, Lalit Suthar  wrote:

> you can use `query_params`
>
> On Wed, 24 Nov 2021 at 19:04, bnmng  wrote:
>
>> Hi everyone,
>>
>> Is there anything dangerous about this?
>> class ItemList(ListView):
>> model = Item
>> def post(self, request, *args, **kwargs):
>> self.request.GET = self.request.POST
>> return super().get(request, *args, **kwargs)
>>
>> I want to use this to accept filtering parameters from a form in a list
>> view template. This ListView also has a get_queryset which returns a
>> filtered query based on the parameters
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/aa7a1392-e388-4727-b412-bd1329daa6c4n%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/aa7a1392-e388-4727-b412-bd1329daa6c4n%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVGyGTwnd8CMqtbuF%3Da%2B43S9ar_f8%2BAQL6AC%3D%3DftaTZo8A%40mail.gmail.com.


Re: Multiple Templates in single list view

2021-11-24 Thread Lalit Suthar
I have gone through your views and template. They are looking fine to me.
Are you getting any error?

On Wed, 24 Nov 2021 at 23:02, Lalit Suthar  wrote:

> > Anyone plz review my code i am struggling to figure out what the issue
> here is
>
> What is the issue you are trying to resolve right now?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVHOnmK%3DvUZjWrT0vjYZi-sfpUWdAxkVDCp6A8uG_foAZg%40mail.gmail.com.


Re: Multiple Templates in single list view

2021-11-24 Thread Lalit Suthar
> Anyone plz review my code i am struggling to figure out what the issue
here is

What is the issue you are trying to resolve right now?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVGfs5rLeSZb_OUfaeByYH7xV77PBzNFmC805m_xuqyT%2BA%40mail.gmail.com.


Re: def post in ListView

2021-11-24 Thread Lalit Suthar
oh cool :D this is looking more pretty

On Thu, 25 Nov 2021 at 02:49, bnmng  wrote:

> Thanks, though, Lalit.
>
> I realized I don't event have to do what I was originally doing.  I can
> just do this:
>
> def post(self, request, *args, **kwargs):
> return super().get(request, *args, **kwargs)
> Then the post params are still available to the queryset method
> def get_queryset(self):
> if self.request.POST.get('query_submitted'):
> ... do stuff ...
>
>
>
> On Wednesday, November 24, 2021 at 12:14:21 PM UTC-5 sutharl...@gmail.com
> wrote:
>
>> oh my bad that is available in django rest framework only
>>
>>
>> On Wed, 24 Nov 2021 at 22:41, Lalit Suthar  wrote:
>>
>>> you can use `query_params`
>>>
>>> On Wed, 24 Nov 2021 at 19:04, bnmng  wrote:
>>>
>>>> Hi everyone,
>>>>
>>>> Is there anything dangerous about this?
>>>> class ItemList(ListView):
>>>> model = Item
>>>> def post(self, request, *args, **kwargs):
>>>> self.request.GET = self.request.POST
>>>> return super().get(request, *args, **kwargs)
>>>>
>>>> I want to use this to accept filtering parameters from a form in a list
>>>> view template. This ListView also has a get_queryset which returns a
>>>> filtered query based on the parameters
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Django users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to django-users...@googlegroups.com.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/django-users/aa7a1392-e388-4727-b412-bd1329daa6c4n%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/django-users/aa7a1392-e388-4727-b412-bd1329daa6c4n%40googlegroups.com?utm_medium=email_source=footer>
>>>> .
>>>>
>>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/9e6d1ed0-0061-4e88-a715-c677d300461dn%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/9e6d1ed0-0061-4e88-a715-c677d300461dn%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVF4%3D-MsR_eVDk1JEU%3DmP34eFGRmukCkv_T0cgTaafE1-w%40mail.gmail.com.


Re: Multiple Templates in single list view

2021-11-21 Thread Lalit Suthar
we can go like

```

class Manager(...):
def get_context_data(self, **kwargs):
context = super() 
context["open_tickets"] = Ticket.objects.filter(status="OPEN")
context["accepted_tickets"] = Ticket.objects.filter(status="ACCEPTED")
context["completed_tickets"] = Ticket.objects.filter(status="COMPLETED")
return context
```

On Mon, 22 Nov 2021 at 12:19, Trippy Samurai 
wrote:

> Hi Elena Thanks for the reply i have three different html pages to display
> open tickets closed tickets accepted tickets etc each of them have
> different ticket statuses i have them written in different views as above
> to display each type of ticket at different pages how can i combine all
> three in  a single view so that i dont repeat my logic in views.Is there a
> way to acheive all the three views writing in a single view?
>
> On Monday, 22 November 2021 at 10:04:14 UTC+5:30 elena wrote:
>
>> Hi,
>>
>> The problem is it's unclear what your question is. Can you be clearer
>> about what outcome you're trying to achieve?
>>
>>
>> ---
>> Elena Williams
>> Github: elena 
>>
>>
>> On Mon, 22 Nov 2021 at 15:20, Trippy Samurai 
>> wrote:
>>
>>> Any one plz
>>>
>>>
>>> On Sunday, 21 November 2021 at 15:09:39 UTC+5:30 Trippy Samurai wrote:
>>>
 Hello,
 I have different views for displaying different templates how do i
 write them into one single Listview so that i can take care of DRY


 [image: Screenshot 2021-11-21 at 3.08.58 PM.png]

>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/d86e1449-a17e-4e93-9dd2-1fae9a7e91d7n%40googlegroups.com
>>> 
>>> .
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/c5eeae75-7c09-4f7e-928c-d03d5f10165an%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVHGLavBh8sZLqepP5QMcQYVdv1m0_AO_rKK0PAHun1NGA%40mail.gmail.com.


Re: Re-write an application from Turbogear to Django.

2021-11-25 Thread Lalit Suthar
I would have chosen the first option, since we can have some relationships
in the database and once all the apis are ready. We can easily pick React
part.

On Thu, 25 Nov 2021 at 23:03, Stamatia  wrote:

> Hi,
>
> I have a question that might need discussion.
> I have a legacy application on Turbogears(1.5) and an old version of
> Dojo.js on front end and I want to re-write it on Django and Reactjs.
>
> What is the best approach to do it?
> Is it better:
> 1. to start with backend and re-write everything on Django and then to
> change the front end
> 2. to change frontend and backend at the same time (step by step - page by
> page)
> 3. or to start with front end, apply the changes to current application
> and then to change backend?
>
> Thanks,
> Stam
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/84a7c2ee-5352-4231-8595-169b780cf3c9n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVF5uMWy3x9fjupaaqEaHLK5u6V%3DdByB%3Dzkd3BPN%2BBqj%2BA%40mail.gmail.com.


Re: CRUD OPERATION CLASS BASED API

2021-10-23 Thread Lalit Suthar
this series of blogs really helped me

   1.

   https://www.agiliq.com/blog/2019/04/drf-polls/
   2.

   https://www.agiliq.com/blog/2019/04/drf-polls-related-objects/
   3.

   https://www.agiliq.com/blog/2019/05/drf-polls-model-serializers/
   4.


   https://www.agiliq.com/blog/2019/05/django-rest-framework-listcreateapiview/
   5.


   
https://www.agiliq.com/blog/2019/05/django-rest-framework-retrieveupdatedestroyapiview/


On Sat, 23 Oct 2021 at 19:53, Lahu Chavan  wrote:

> Hey DjangoUsersConnection,
>  How to use common(single) url for combining ADD, UPDATE, GET,
> DELETE class based api. please give me an example with brief information.
> thank you so much
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CANQ9JRFa3ckWaF1BixmXnsgn1bGwhnJVYCWmtcPnsSP-wvJeeQ%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVG3JabkWiUDBwqOo7_Sy4wZJC1-djcRRErVz9Rp76LkkA%40mail.gmail.com.


Re: Modeform Foreign key column not working

2021-10-23 Thread Lalit Suthar
cool! mention not :)

On Thu, 21 Oct 2021 at 19:57, Aruna Priya Nagarajan <
arunapriya.nagara...@gmail.com> wrote:

>
> yeah, it is a foreign key and I have put integer field instead of foreign
> key in the model. I changed it now and its working by itself without
> specifying ModelChoiceField.
>
> Thanks for your help!!
>
>
> On Wednesday, 20 October 2021 at 16:07:04 UTC+1 sutharl...@gmail.com
> wrote:
>
>> is `ConnectionTypes` a foreign key to `ConnectionDetails`?
>> in that case you don't need to put it as a field in form, it will be
>> added automatically in the form.
>> On Wednesday, 20 October 2021 at 18:47:44 UTC+5:30 Aruna Priya wrote:
>>
>>> Hi,
>>>
>>> I am trying to create a form from model and the model has a foreign key
>>> and am not able to populate the values from the column it refers to.
>>>
>>> My form,
>>>
>>> class ConnectionForm(forms.ModelForm):
>>>
>>>  connection_type = 
>>> forms.ModelChoiceField(queryset=ConnectionTypes.objects.all(), 
>>> to_field_name='connection_type_id')
>>>
>>> class Meta:
>>> model = ConnectionDetails
>>> exclude = ['connection_id','last_update_date']
>>>
>>>
>>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/ddb8c862-57fc-4bb0-97a0-f5c235b00a1fn%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVFY3%2BjW1CPPMbsoGwbeVOb8kjUy8rRjTpapCQWoe3N4Gw%40mail.gmail.com.


Re: New user

2021-11-07 Thread Lalit Suthar
good one
https://www.youtube.com/playlist?list=PLEsfXFp6DpzTD1BD1aWNxS2Ep06vIkaeW

On Tue, 2 Nov 2021 at 15:40, Indrajeet Singh Yadav 
wrote:

> Hi,
> Like you I also started django a while back. And i feel like djangogirls
> is a good place to start.
> Its a tutorial site. Search google.
> They will help you get started with the basics of django.
> They have quite a well explained tutorial.
> Also if you find some other way which is good for learning django please
> do share.
> Good Luck.
> On Tuesday, November 2, 2021 at 2:55:18 AM UTC+5:30 lanza...@gmail.com
> wrote:
>
>> Hi, I want to learn Django, so if someone now the best way I appreciate.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/422a5f9f-70e4-43df-968b-f8b3514f5ba4n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVE4c-k4-H-t3Dj5gOJ01d0BR3aPx3yWS-83VA4%3Dng7vWQ%40mail.gmail.com.


Re: converting audio file in Django

2021-11-07 Thread Lalit Suthar
https://stackoverflow.com/questions/3049572/how-to-convert-mp3-to-wav-in-python

On Wed, 3 Nov 2021 at 18:52, Shada Bahassan  wrote:

> Is there any platform command line utility that can convert audio file
> from ul formats to wav format?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/c3a6f882-81fe-4128-b712-2ab1a36914d2n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVFmERfKHtCAUKQ-E116nxq4yHOUR1aW7umf3AS4K7JSBQ%40mail.gmail.com.


Re: Use previous requested data in the new request

2021-12-01 Thread Lalit Suthar
why can't we make a post request directly

On Wed, 1 Dec 2021 at 00:24, kayhan  wrote:

> Hi
> How to first send some data with an Ajax request to Django view and then
> with a post request, send the form information to the same view and use the
> data sent in the previous request (Ajax request) in the second request ?
>
> def planing(request):
>
> if request.is_ajax():
> # Get user location from user location.js file:
> latitude = request.POST.get('latitude', None)
> longitude = request.POST.get('longitude', None)
>
>
> elif request.method == "GET":
> return render(request, "tourist/planing.html")
>
>
> elif request.method == "POST":
> # Here I want to take the form data and have
> #the previous request data (latitude, longitude) here and do a series of
> processing
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/317b8fc4-d607-49fc-888b-8030baf0f142n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVFjNMyr%3DMNgohabEw3J6YVn50GX0pfXCcurTv6HiMWoGA%40mail.gmail.com.


Re: Developing django apps in jupyter

2021-11-29 Thread Lalit Suthar
I use vscode

On Mon, 29 Nov 2021 at 21:40, Vikas Sri  wrote:

> I recommend Pycharm, it makes development fast, helps in debugging and
> what not.
>
> On Mon, Nov 29, 2021 at 8:34 PM Md Rana Sarkar 
> wrote:
>
>> You can create virtualenv and use VS code . That's the free and better
>> IDE for Django or any other web development.
>>
>> On Mon, Nov 29, 2021 at 7:23 PM 'MH' via Django users <
>> django-users@googlegroups.com> wrote:
>>
>>> Hi everyone
>>>
>>> I have built a few django apps, but on a very basic level and only for
>>> my own usage. Little helpers for self management. So far I just used vi(m).
>>>
>>> Now I tried out jupyter for the first time. Looks great and thanks to a
>>> few links from Google I could also load the django kernel in jupyter. Still
>>> I am not sure how to use juypter in order to develop django apps. Is this
>>> making sense to you? I either have one of those
>>> demonstration-/documentation-oriented notebooks *or* I have a plain py
>>> file as usual in django apps.
>>>
>>> My two questions are:
>>> 1. Do you use juypter for django development?
>>> 2. If not, which editor or free IDE do you use?
>>>
>>> Best regards
>>> M
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/32085ce1-4bdc-4dfe-a031-9e4d6b15c9abn%40googlegroups.com
>>> 
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CANRb_txomeeAsb16t%3DpSZfoWbbF1Avb1ZGz%2B_7bvESi8Rp%3DKJg%40mail.gmail.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CANOk8kLMrJoNRikR55L-s83_FCLUeDd8pKirO6ojDu_kpznLOA%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVEh4Fpu6rygJ%3DvMWYwtOF9uo%3Dr1F3WoaWSB0H2LcQtNjA%40mail.gmail.com.


Re: runserver not working

2022-03-22 Thread lalit suthar
haha indeed 

On Wednesday, 23 March 2022 at 09:08:54 UTC+5:30 Delvin Alexander wrote:

> it was python manage.py runserver. it was an easy fix that i wish i found. 
> hahah 
>
> On Tuesday, March 22, 2022 at 8:32:46 PM UTC-7 Delvin Alexander wrote:
>
>> i did that but the problem still remains :(
>>
>> On Tuesday, March 22, 2022 at 2:09:33 AM UTC-7 sebasti...@gmail.com 
>> wrote:
>>
>>> Hey,
>>>
>>> I think yoz don't have installed django package. Please install it over 
>>> pip install django
>>>
>>> Regards
>>>
>>> 'Delvin Alexander' via Django users  
>>> schrieb am Di., 22. März 2022, 06:07:
>>>
 would anyone know why my "manage.py runserver" is not working?

 Every time i try running it on the command prompt, i get relocated to 
 my visual studio of manage.py file that states this:

 #*!/usr/bin/env python*
 *"""Django's command-line utility for administrative tasks."""*
 *import os*
 *import sys*


 *def main():*
 *"""Run administrative tasks."""*
 *os.environ.setdefault('DJANGO_SETTINGS_MODULE', 
 'django_project.settings')*
 *try:*
 *from django.core.management import execute_from_command_line*
 *except ImportError as exc:*
 *raise ImportError(*
 *"Couldn't import Django. Are you sure it's installed and "*
 *"available on your PYTHONPATH environment variable? Did 
 you "*
 *"forget to activate a virtual environment?"*
 *) from exc*
 *execute_from_command_line(sys.argv)*


 *if __name__ == '__main__':*
 *main()*


 A step in the right direction will be super helpful for me.

 -- 
 You received this message because you are subscribed to the Google 
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to django-users...@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/django-users/69291c68-61e7-4557-8175-7b705bcfcbb0n%40googlegroups.com
  
 
 .

>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/576c304c-d664-45bb-8799-36dec9d8f30bn%40googlegroups.com.


Re: django queryset - Get the data particular to current year only

2022-04-03 Thread Lalit Suthar
I think this is related to your query
https://stackoverflow.com/a/28101722/8882295

On Thu, 31 Mar 2022 at 11:22, Trippy Samurai 
wrote:

>
> 
>
> I have my query written to get some thing from database and display on my
> website that query is getting all the data from db but what if i want to
> get the data particular to current year only
>
>
> def get(self, request, *args, **kwargs):
> filters = self.get_filters()
>
> result = Model.objects.all().filter(*filters).distinct().aggregate(
> t=Sum('t'),
> b=Sum('b'),
> )
>
> result2 = Model.objects.all().filter(*filters).distinct().aggregate(
> past_due=Sum('balance', filter=Q(due_date__lt=timezone.now()))
> )
>
> zero = Decimal('0.00')
>
> total = result['t'] or zero
> balance = result['b'] or zero
> past_due = result2['past_due'] or zero
> amount_received = t - b
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f0959467-786f-4701-9d68-abd2e54c3aaan%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVGoatg_BEPt-jYQVD7_%3DURdhraY%3D8KWvrL40yBJ0vYSSg%40mail.gmail.com.


Re: order_by on the basis of time difference (updated_at - created_at)

2022-01-21 Thread Lalit Suthar
won't be possible like this, It will be easy if you have another entry in
models which stores the difference between updated and created.
You can update that field whenever an object is updated. And then can run
order_by on that field directly


On Fri, 21 Jan 2022 at 10:24, Aadil Rashid  wrote:

> class ExampleModel(models.Model):
> is_active = models.BooleanField(default=True)
> created_at = models.DateTimeField(auto_now_add=True)
> updated_at = models.DateTimeField(auto_now=True)
>
>
>
> I want to query on UserModel such that the Query set which I get should be
> orderable in terms of time difference of updated_at - created_at,
> I tried
> ExampleModel.objects.all().order_by('updated_at' - 'created_at')
> but this is not working
> it throws, *TypeError*: unsupported operand type(s) for -: 'str' and 'str'
>
>
> Django Family Please Help...
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAAYXZx8sABKuJn5Q1ATeHnYsrixfU9wTH_TtPYoR5%3DeAd8DOzA%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVGL_PbFQZTwCQ_uCLakdwY-54rEz8NpEmrjvGbGjdkM5w%40mail.gmail.com.


Re: order_by on the basis of time difference (updated_at - created_at)

2022-01-21 Thread Lalit Suthar
Fabio C. Barrionuevo da Luz's answer will work like a charm!



On Fri, 21 Jan 2022 at 21:04, Fabio C. Barrionuevo da Luz 
wrote:

> this can be easily solved by using an annotation to calculate the
> difference and store it in a new temporary column, and then sort by it
>
>
> from django.db.models import F
> from myapp.models import ExampleModel
>
> queryset = ExampleModel.objects.annotate(
> dt_difference=F('updated_at') - F('created_at')
> ).order_by('dt_difference')
>
> for example in queryset[:10]:
> print(f'created_at={example.created_at} -
> updated_at={example.updated_at} - dt_difference={example.dt_difference}')
>
>
>
> Em sex., 21 de jan. de 2022 às 10:54, Gabriel Araya Garcia <
> gabrielaraya2...@gmail.com> escreveu:
>
>> Try this:
>> ExampleModel.objects.all().order_by('updated_at' , '-created_at')
>> Gabriel Araya Garcia
>> GMI - Desarrollo de Sistemas Informáticos
>>
>>
>>
>>
>> El vie, 21 ene 2022 a las 1:54, Aadil Rashid ()
>> escribió:
>>
>>> class ExampleModel(models.Model):
>>> is_active = models.BooleanField(default=True)
>>> created_at = models.DateTimeField(auto_now_add=True)
>>> updated_at = models.DateTimeField(auto_now=True)
>>>
>>>
>>>
>>> I want to query on UserModel such that the Query set which I get
>>> should be orderable in terms of time difference of updated_at - created_at,
>>> I tried
>>> ExampleModel.objects.all().order_by('updated_at' - 'created_at')
>>> but this is not working
>>> it throws, *TypeError*: unsupported operand type(s) for -: 'str' and
>>> 'str'
>>>
>>>
>>> Django Family Please Help...
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAAYXZx8sABKuJn5Q1ATeHnYsrixfU9wTH_TtPYoR5%3DeAd8DOzA%40mail.gmail.com
>>> 
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAKVvSDDy%2BnJNcFE-xpz38zfDVYgw6P3zDZ9BJ_5-EsoAtDDLTw%40mail.gmail.com
>> 
>> .
>>
>
>
> --
> Fábio C. Barrionuevo da Luz
> Palmas - Tocantins - Brasil - América do Sul
>
> http://pythonclub.com.br/
>
> Blog colaborativo sobre Python e tecnologias Relacionadas, mantido
> totalmente no https://github.com/pythonclub/pythonclub.github.io .
>
> Todos são livres para publicar. É só fazer fork, escrever sua postagem e
> mandar o pull-request. Leia mais sobre como publicar em README.md e
> contributing.md.
> Regra básica de postagem:
> "Você" acha interessante? É útil para "você"? Pode ser utilizado com
> Python ou é útil para quem usa Python? Está esperando o que? Publica logo,
> que estou louco para ler...
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAPVjvMYVR1yqZjLuEh5u6DaR5DZfeYqvFy-MaNkt7MiWO7O%2Bxw%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVEnnVbHDXN2tkQjKK1R3JYF19GY94Ax%3D91OYrKykL39_w%40mail.gmail.com.


Re: Negated filtering by lookup expression sent via url query

2022-05-31 Thread Lalit Suthar
you can write custom filtering classes and methods using Django filters.
There you can define fields and methods according to your use case
example:
https://stackoverflow.com/questions/43009538/use-custom-filter-with-django-modelchoice-filter

On Tue, 31 May 2022 at 19:16, Sencer Hamarat 
wrote:

>
> Hi,
>
> Is there any way to negate filtering with the django-filter package which
> lookup expression sent via url query, such as:
>
> http://example.com/?name__not_contains=john
>
>
> The request above has to be passed through the django filterset class and
> the class has to be returned with the queryset exclude query with name
> argument and "john" value.
>
> Something like:
>
> self.queryset.exclude(name="john")
>
> Kind regards,
> Sencer HAMARAT
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACp8TZg0QFj2kST7m%3DoM4AoS3%3D3DOBhTm0MzDpJvLup_woYEYQ%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVHoA9dHLDdmrwDJ4X65NTEq30dvfBn5ia3FTUkbijmPoQ%40mail.gmail.com.


Re: Need help

2022-06-01 Thread Lalit Suthar
thanks for sharing @Antonis Christofides I was looking for a resource like
this for some time :D

On Thu, 2 Jun 2022 at 10:57, Antonis Christofides <
anto...@antonischristofides.com> wrote:

> Hello,
>
> If, as I understand, you don't know anything about deployment, a possible
> starting point is the book at https://djangodeployment.com (disclaimer: I
> am the author). It doesn't cover docker, and it also doesn't cover
> continuous development with gitlab. But you can start with the basics and
> then move forward.
>
> Regards,
>
> Antonis
>
>
> On 01/06/2022 19.16, Théodore KOSSI wrote:
>
> Hello everyone,
> I want your help to deploy my django app.
> I have a ubuntu server.
> My django project is pushing to gitlab.
> So I want to deploy my app django to my ubuntu server using Gitlab and
> docker
> Any help enjoy me
> Thanks.
>
> --
> theodoros17@python-developer
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAKiMjQEYVje02k1dSeYACdocH%2B2vD5BgCQZ%2BEAYhF28%3DSy0%2BjA%40mail.gmail.com
> 
> .
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/164d1c9b-4483-34cb-9cb5-0fb822694d9a%40antonischristofides.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVF-nG%3D0Z6Qz4pEMKZE8sVY8W-89O_0TCLcwQ%2BZ%2BjmvGmQ%40mail.gmail.com.


Re: LogIn Class Based View

2022-05-27 Thread Lalit Suthar
refer:
https://docs.djangoproject.com/en/4.0/topics/class-based-views/
https://www.youtube.com/watch?v=Xeh9r0CXBmU=PLEsfXFp6DpzTD1BD1aWNxS2Ep06vIkaeW=36=1s

On Fri, 27 May 2022 at 01:07, 'dtdave' via Django users <
django-users@googlegroups.com> wrote:

> I have this function based view which works perfectly but I would like to
> convert to a class based view but am stuck on how to do this:
> This is my fbv:
>
> def loginView(request):
> if request.method == 'POST':
> form = LoginForm(request.POST)
> if form.is_valid():
> cd = form.cleaned_data
> user = authenticate(request,
>email=cd['email'],
>password=cd['password'])
>
> if user is not None:
> login(request, user)
> if user.is_authenticated and user.is_client:
> return redirect('clients:detail') # Go to client
> dashboard
> elif user.is_authenticated and user.is_account_manager:
> return redirect('accountmanagers:detail') #Go to
> account manager dashboard
> else:
>return HttpResponse('Invalid login')
> else:
> # Invalid email or password. Handle as you wish
> form = LoginForm()
>
> return render(request, 'registration/login.html', {'form': form})
>
> I would appreciate any help.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/ea6c54f2-ecc0-407d-a296-e168d509a299n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVG6zwbf3i4wfT_BgvTQ07i9ZJwrDiyE%2B%3D3q4y24q4SYFg%40mail.gmail.com.


Re: Need best tutorial

2022-06-21 Thread Lalit Suthar
https://github.com/lalit97/django-developer-resources

On Tue, 14 Jun 2022 at 06:49, Abdul Qoyyuum 
wrote:

> Don't go straight to web development until you understand how Python
> works, especially when dealing with imports and managing variables in
> different scopes.
>
> I recommend learning from https://automatetheboringstuff.com as well as
> the Dive Into Python3. Both have some decent level of practice projects
> enough for you to get into it.
>
> I would rather you try out Flask instead of Django because Django is very
> bloated with lots of packages and dependencies to be familiar with. Flask
> is very basic and simple enough for Web Development. But once you
> understand and have built a Flask Web App or Flask REST API, then you can
> try out Django.
>
> Good luck!
>
> On Monday, June 13, 2022 at 2:59:39 AM UTC+8 ghalib...@gmail.com wrote:
>
>> hi there, i am beginner in python. can anyone share python best tutorial
>> for web development please
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/36e59af6-ab8a-4fdf-a036-362e21f2482an%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVGJSyW%2BmBLFKoPV4bdkeuuXLO_CEFbEnagk3fsQFXt-WA%40mail.gmail.com.


Re: Best approach for audit logging in Django.

2022-06-03 Thread Lalit Suthar
Hi Sencer, signals will be helpful only if you are auditing on certain
models
but if you are trying to audit a set of views then middleware will be a
better choice since that will be more manageable

On Fri, 3 Jun 2022 at 18:29, Jason  wrote:

> one good source when you have a question "is there anything in django that
> does X?" is to go to djangopackages.org.
>
> https://djangopackages.org/grids/g/model-audit/, for example, is a list
> of packages for model auditing and history
>
> On Friday, June 3, 2022 at 6:33:37 AM UTC-4 sencer...@gmail.com wrote:
>
>> Hi,
>>
>> I've been planning to add audit logging to the project.
>>
>> But, I can not decide which approach is the best;
>> Using signals or creating middleware?
>>
>> Project needs to being log events on change of model object with these
>> informations below:
>>
>> - If a record is inserted, updated and deleted:
>>- who is taking this action (ForeignKey)
>>- what is the action (Choice)
>>- which applications model object affected (ContentType)
>>- affected object (Generic relation)
>>- current data in json format
>>- previous data in json format
>>
>>
>> Kind regards,
>> Sencer HAMARAT
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f5586723-4e6a-4ce6-93d9-b74cd277dc91n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVGgoO0jdVSbWHtwPtdeXuD6PuUMxVd3p2EY_QZz6CedCA%40mail.gmail.com.


Re: Looking Best Learning Resources Python / Django

2022-07-19 Thread Lalit Suthar
https://github.com/lalit97/django-developer-resources

On Tue, 19 Jul 2022 at 21:02, Muneeb Mughal 
wrote:

> I am looking for best learning sources for web and more in django or any
> related framework with complete practice and also lead to job ,
> experience people recommend only .thanks .
>
> --
>
>
>
> *RegardsMuneeb Afzal*
>
> *Cell: +92 333 5646624*
>
> Email: muneeb.afzal...@gmail.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAApwjV1z3Ck6Gpk-xCqcW5Gh2sgXYxHzvRVNUx0uhBJxjT61EA%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVF4Rv%3D%3DA%3DTBmxoq8PfLpgpKJUf9005OPtWTuRhpa7Hd1w%40mail.gmail.com.


Re: DRF question

2022-07-19 Thread Lalit Suthar
I would also suggest keeping Django views as it is and writing new views
for your APIs
maybe you can create another file named apiviews.py and then write new APIs
with help of your present views
refer: https://www.django-rest-framework.org/api-guide/views/

On Tue, 19 Jul 2022 at 06:38, Nikhil Chawla 
wrote:

> Don't clutter the django views with DRF requests. Keep them separate,
> available at, say `api` endpoints.
>
> On Tue, 19 Jul 2022, 06:17 Michael Thomas, 
> wrote:
>
>> Hey Ram,
>>
>> I'm afraid no one can answer your questions without knowing your code,
>> how it works, or anything else...
>>
>> Broadly speaking, here's how we approached a similar scenario:
>>
>> 1) Created one or more Serializer for each model that required
>> interaction via API. Some models required more than one, as they were
>> either too large for list() operations, or required a simpler
>> representation when nested into another Serializer, etc..
>> 2) Created custom permissions to check if users were allowed to perform
>> the action(s) they were trying to make
>> 3) Created ViewSets using the permissions and serializers mentioned
>> above, as well as any additional actions that didn't fit within the normal
>> REST verbs
>> 4) Created a router and registered the viewsets with it
>> 5) Added the router's urls into the projects url configuration
>>
>> I hope that's useful :)
>>
>> Kind Regards,
>> Michael Thomas
>>
>> On Tue, Jul 19, 2022 at 7:21 AM Ram  wrote:
>>
>>> Hi,
>>>
>>> We completed coding all the features without DRF for our web site and
>>> now we are planning to develop a mobile app for the same website by keeping
>>> the web site as it is and develop a mobile app using Flutter.
>>>
>>> Based on our understanding, we have do the following in the current code
>>> for adding REST APIs
>>>
>>>
>>>1. We have to create serializers.py for each model in each App that
>>>we have
>>>2. We need to add a few lines of code in views.py
>>>3. We think we don't have to modify the UI template by using json
>>>response from DRF ( Is this really necessary because we are not changing
>>>anything in the website UI)
>>>
>>> Please correct me if I'm wrong about the above 3 points or do we need to
>>> do any additional things?
>>>
>>> Best regards,
>>> ~Ram
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CA%2BOi5F2wgTLXQFreQp9cXNGBOnTqoAQ6vA5CqZuBNeya%2BWKLXg%40mail.gmail.com
>>> 
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAEdx1fo_Zk7H7nFMgUSYkfTC_p_cV8Qa8W17C_GHnDDwdk2eBw%40mail.gmail.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAEO4UakHjqtO3S-DZ-9A_-C7ZMoEBiNxtGm1eGL-R1cp9Ofutw%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVHC8SFuiJ7g7pnb4xEZz70O1-auE%3DUr0NGGG4AamJNUzw%40mail.gmail.com.


Re: Starting Django

2022-07-15 Thread Lalit Suthar
https://github.com/lalit97/django-developer-resources

On Fri, 15 Jul 2022 at 12:00, Lalit Suthar  wrote:

> https://www.youtube.com/playlist?list=PLEsfXFp6DpzTD1BD1aWNxS2Ep06vIkaeW
>
> On Fri, 15 Jul 2022 at 03:55, fawemimo olawale 
> wrote:
>
>>
>> Dear All,
>> You get a video a from brad Traversy from Udemy or Mosh from
>> codewithmosh.com
>>  Regards
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CALJWbzr3ft1Ve112%3DWKejNQFcz-m-2_BEu1m1Ecoo5DvjOjucQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CALJWbzr3ft1Ve112%3DWKejNQFcz-m-2_BEu1m1Ecoo5DvjOjucQ%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVFmQB%2B8jtBNV999y058U4y7pyRF84LNR-kveQPzif1-BQ%40mail.gmail.com.


Re: Starting Django

2022-07-15 Thread Lalit Suthar
https://www.youtube.com/playlist?list=PLEsfXFp6DpzTD1BD1aWNxS2Ep06vIkaeW

On Fri, 15 Jul 2022 at 03:55, fawemimo olawale 
wrote:

>
> Dear All,
> You get a video a from brad Traversy from Udemy or Mosh from
> codewithmosh.com
>  Regards
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CALJWbzr3ft1Ve112%3DWKejNQFcz-m-2_BEu1m1Ecoo5DvjOjucQ%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVEPZ6a7B-Ha3vYv80RFp5KXFkaB5s9nsYJvo29MnbYdRw%40mail.gmail.com.


Re: Hi to all how to implement Search option in website?

2022-07-23 Thread Lalit Suthar
you can try django-filters also for more complex use cases
https://django-filter.readthedocs.io/en/stable/

On Sat, 23 Jul 2022 at 22:09, Lakshyaraj Dash 
wrote:

> You can do something like shown in the screenshot below
>
> Thanks and Regards
> Lakshyaraj Dash
>
> On Sat, Jul 23, 2022, 21:59 Mahendra  wrote:
>
>>
>>
>> On Fri, 22 Jul 2022, 23:37 Prashanth Patelc, 
>> wrote:
>>
>>> how to use time in pandas  (convert 24 hours time to 12 hours)
>>>
>>> Login time  table
>>> ==
>>> userid logindate  logintime
>>> 22022-13-07  18:30:00.490337
>>>
>>> Logout time table
>>> ==
>>>
>>> userid logindate  logintime
>>> 22022-14-07  02:36:03.450327
>>>
>>>
>>> output:
>>>login_date  user__username   user  diiffrences
>>> 0  2022-07-14  neilneil   -1
>>> days +07:26:47.027887
>>>
>>> How to convert above atbles time:  ?
>>>
>>> nee output like this type
>>> ==
>>>  login_date  user__username   user
>>>  diiffrences
>>> 0  2022-07-14  neilneil
>>> 08:03:47.027887
>>>
>>>
>>>
>>> df['logout_time'] = pd.to_timedelta(df['logout_time'].astype(str))
>>>
>>> df['login_time'] = pd.to_timedelta(df['login_time'].astype(str))
>>>
>>>
>>> df['diiffrences'] = df['logout_time'] - df['login_time']
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAMCU6CpwW9q9z_pBdgf%3Do5dEzvET5qqvddopjNQtGwuxm5RUjA%40mail.gmail.com
>>> 
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAN-6G3xoKQ4g5a8LtTGGwPJw1LSVXK2aGNwKcDKAHqsV0mb%3DKA%40mail.gmail.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAF7qQgCYQ%2Bcj6X__4f5%2BPVNjmix_xszhc2b%2B%2BCa9EiK2NWR60Q%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVGg63dp%2Bt8fMgF9SJ7Z%2BUDygzCiJ2dQtY6bh94Jeu1gAA%40mail.gmail.com.


Re: Help to implement join query in django orm

2022-07-23 Thread Lalit Suthar
this can be helpful
https://betterprogramming.pub/django-select-related-and-prefetch-related-f23043fd635d

On Sun, 24 Jul 2022 at 00:30, Ryan Nowakowski  wrote:

> On Fri, Jul 22, 2022 at 12:16:14PM +0530, Avi shah wrote:
> > I have two tables
> > Tbl 1
> > &
> > Tbl 2
> >
> > I need to connect the two tables using a join
>
> If these tables were created outside of Django, in other words, not
> using manage.py migrate, you can use Django's legacy database support to
> auto generate the models[1].  After that, each table will have a model
> associated with it.  You can then use Django's ForeignKey support to query
> the tables.
>
>
> [1] https://docs.djangoproject.com/en/4.0/howto/legacy-databases/
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/20220723185935.GB15838%40fattuba.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVHauj%2BS47HfmcYOrNQHJk3bTQbtdBm%3DdLRNx_8woM6XwQ%40mail.gmail.com.


Re: hello users

2022-07-27 Thread Lalit Suthar
https://github.com/lalit97/django-developer-resources

On Mon, 25 Jul 2022 at 19:04, Aliyu Muazu  wrote:

> i'm currently new here, any guide up on where to start.
> thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/522cf16d-148c-4291-baa8-c99577f103fcn%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVGbEHoFjUqf9jO0JtBad-BeCppN1TTo361qSDNypg640w%40mail.gmail.com.


Re: Django tutor.

2022-07-27 Thread Lalit Suthar
https://github.com/lalit97/django-developer-resources

On Wed, 27 Jul 2022 at 22:22, nick washington  wrote:

> Cool
>
> On Wed, Jul 27, 2022, 18:19 Md Aminul Haque 
> wrote:
>
>> Show Django Official website
>>
>> Sent from my Huawei phone
>>
>>
>>  Original message 
>> From: pediah wanmi 
>> Date: Wed, Jul 27, 2022, 5:22 PM
>> To: django-users@googlegroups.com
>> Subject: Django tutor.
>>
>> I am a djongk intermediary, please can I
>>  get a tutor?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CABd3QauHU4wdePFvGsY3V-GSO8Ly37zMqgmcV2tyDV56Sw81Tw%40mail.gmail.com
>> 
>> .
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/dun4asa4bdzxtzjwj4-3qjf8j-urdlt42i1gaiz8sfaua9chke-albmexg650pjd8w9no-mjoqq4cguikj-bk51if-em08lf-jw7g21idl3xdyre5d8-v97n9i-lanxvz6om99w-w4oi0-dog49dbovagl.1658932720646%40email.android.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAETXisem7FDUpRd1VZt7kFu2VhdNp7XTUU0eLSAMJrhnFOv-Wg%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVFe%2BfKcgdOnkOYzao%2BBhiAKCoyQ1ihN4UEthCoqQwfwbQ%40mail.gmail.com.


Re: 'str' object is not callable

2022-05-06 Thread Lalit Suthar
this part of the code looks fine from a first look. Can you share the
complete view code for this

On Fri, 6 May 2022 at 12:11, Salima Begum 
wrote:

> Hi all,
> In my project I am Django messages Framework. I am always facing 'str'
> object error I dont understand how to solve this problem. Previously also I
> face same issue. Now it is reproduced.
> I am using django 4.0.4 version.
>  Python 3.9.6
> ```
>messages.success(request, "Welcome back")
> ```
> ```
> {% if messages %}
> {% for message in messages %}
> 
> 
>  style="">×
> {% if message.tags == 'error' %}
> aria-hidden="true">
> {{
> message|safe }}
> {% else %}
> 
>  style="color:#01ABAA;">{{ message|safe
> }}
> {% endif %}
> 
> 
> {% endfor %}
> {% endif %}
> ```
>
> Please help me to solve this issue.
>
> Thanks
> ~Salima
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMSz6bkPYRUwSidJd1ay-q-GdeM5Q8CKqY%2BnYU3j7wk%2BEAmYOQ%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGp2JVFj6DZ74w_Fv1an8SwtoDReG7YseridBDJ1PScuKdwUoQ%40mail.gmail.com.


  1   2   >