Re: SChedule email

2021-07-01 Thread Luis Zárate
You can create a custom command using this doc
https://docs.djangoproject.com/en/3.1/howto/custom-management-commands/

Now, you can call it like

python manage.py mycustomcommandname

so in Linux environment  you can use crontab (with crontab -e) to execute
the command.


El jue, 1 jul 2021 a las 15:28, SKYLINE TV ()
escribió:

>
> *You can check out celery and how to integrate it with django. Once done,
> task scheduling is easy,first add your gmail configuration in settings.py
> as follows:*
>
> *EMAIL_BACKEND = 'django_smtp_ssl.SSLEmailBackend' *
> *EMAIL_USE_TLS = True *
> *EMAIL_HOST = 'smtp.gmail.com ' *
> *EMAIL_HOST_USER = 'your_email' *
> *EMAIL_HOST_PASSWORD = 'your password' *
> *DEFAULT_FROM_EMAIL = EMAIL_HOST_USER EMAIL_PORT = 465*
>
> Then in your tasks.py you can add the function for scheduling emails as
> follows:
>
> *from django.template.loader import render_to_string *
> *from django.core.mail import EmailMessage*
>
> @periodic_task
> ( run_every=(crontab(hour=3, minute=34)), #runs exactly at 3:34am every
> day
> name="Dispatch_scheduled_mail",
>  reject_on_worker_lost=True, ignore_result=True)
> def schedule_mail():
>  message = render_to_string('app/schedule_mail.html')
>  mail_subject = 'Scheduled Email' to_email = getmail email =
> EmailMessage(mail_subject, message, to=[to_email])
>  email.send()
>
> *Then finally your email template 'schedule_mail.html*
> {% autoescape off %}
> Hello ,
>  This is a test email if you are seeing this,
>  your email got delivered!
>  Regards, Coding Team.
>  {% endautoescape %}
> On Thursday, July 1, 2021 at 1:54:31 PM UTC+1 divyamu...@gmail.com wrote:
>
>> HI,
>>
>> I wanted to schedule a email every jan and aug 6 monthly basis without
>> celery using settings.py. Can anyone help?
>>
>> once in every 6months mail should be triggered
>>
> --
> 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/a87a8623-d123-404d-91b8-d30a01d91dc0n%40googlegroups.com
> 
> .
>


-- 
"La utopía sirve para caminar" Fernando Birri

-- 
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/CAG%2B5VyPk%3D31F3j1D%2BsH8AA_2DDtK6XQikKBK1aRcvpzEvJJR-A%40mail.gmail.com.


Re: ValueError: Field 'stufees' expected a number but got 'None'.

2021-07-01 Thread SKYLINE TV
kindly add the screenshort to enable me see your model

On Thursday, July 1, 2021 at 10:58:40 PM UTC+1 abeer.e...@gmail.com wrote:

> Hi Waqar,
>
> Could you add your models.py and a screenshot or copy of the error you are 
> observing?
>
> Thanks!
>
> On Thu, Jul 1, 2021 at 5:31 PM waqar khan  wrote:
>
>> I have create model class and run success fully
>> But Issues add field like stufees ,
>> stufess=models.FloatField(),
>> right value default ,
>> as soon as reply 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/5ac34a99-30c8-4dbe-80f6-0700d938709dn%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/bfd8833d-c3c7-4da6-bac0-d3fea47817f6n%40googlegroups.com.


Re: ValueError: Field 'stufees' expected a number but got 'None'.

2021-07-01 Thread Abeer Eltanawy
Hi Waqar,

Could you add your models.py and a screenshot or copy of the error you are
observing?

Thanks!

On Thu, Jul 1, 2021 at 5:31 PM waqar khan  wrote:

> I have create model class and run success fully
> But Issues add field like stufees ,
> stufess=models.FloatField(),
> right value default ,
> as soon as reply 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/5ac34a99-30c8-4dbe-80f6-0700d938709dn%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/CACbngZd7UTK3ocHXxrXtx33uhpGFC4U2N1OdoScGHLBhcSLsAg%40mail.gmail.com.


Re: Sorting price and discount price (urgent)

2021-07-01 Thread SKYLINE TV
the word urgen is bad, do lot of google boss

On Thursday, July 1, 2021 at 1:28:13 PM UTC+1 arit...@gmail.com wrote:

> Hi,
>
> I will avoid using 'urgent'. The problem is as described above, I want to 
> sort my products in ascending or descending price order which will include 
> the discount price too if it exists. Right now, if there are two products, 
> A and B; A being ₹900 and B being ₹1200 too but after discount, ₹ 800, the 
> sorting order highest to lowest price is: B,A instead of A,B. As Shailesh 
> asked, discount_price is a model field as I've given in the code about. And 
> the 'fields = {'price': 'discount_price'}' is wrong after I searched a bit 
> on the internet, kindly ignore that. 
>
> Kindly suggest a way to include discount_price in the sorting parameter 
> where it'll be considered instead of the original price itself. 
>
> On Thu, 1 Jul, 2021, 4:06 pm Shailesh Yadav,  
> wrote:
>
>> yes, I agree with Kasper please don't use urgent  OR very urgent, and 
>> please describe your questions in detail.
>> from where you getting this *discount_price* and why you using the 
>> *price* key for two different values. (can you check by printing 
>> *discount_price*)
>>
>> fields={
>> 'price': 'price',
>> 'price':'discount_price'
>> },
>>
>>
>>
>> Thanks & Regards
>> Shailesh Yadav
>>
>>
>>
>> On Thu, Jul 1, 2021 at 1:33 PM Aritra Ray  wrote:
>>
>>> I tried to describe the problem but till my capability and it is urgent, 
>>> not just for increasing the possibility of getting help. Thank you for your 
>>> advice and help.
>>>
>>> On Thu, 1 Jul, 2021, 1:30 pm Kasper Laudrup,  
>>> wrote:
>>>
 On 7/1/21 8:03 AM, Aritra Ray wrote:
 > I am facing a problem in including the discount_price into 
 consideration 
 > when sorting price through the products. Kindly help me to do so. The 
 > below attached files are filters.py, views.py and  models.py.
 >

 Instead of writing "urgent" in hope it will increase your chances of 
 getting help faster, you'll have a much better chance of getting some 
 useful help if you spend some time describing the exact problem you 
 have 
 instead of just "a problem".

 This might help you:


 https://betterprogramming.pub/how-to-ask-questions-about-programming-dcd948fcd2b

 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...@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/django-users/0c454b7d-cb51-ea95-d0e8-ca4be0c2bad7%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...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/CAFecadvpnYg3CWXRtZfNjWpLPbd4KyqndZ5EdmVUmaP_dbvR0Q%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/CAMQ-AEVPDkAeFihwbd1xYWNskvUc8zta-9FZW1ePr_rYZ0vnGA%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/2540fcd5-1ae1-4576-a9d2-c654266e8318n%40googlegroups.com.


how to develop crypto investment site with django

2021-07-01 Thread SKYLINE TV
hello i  am new in django i just finish building my first blog and am still 
learning to enhance myself,
 currently i  use  php for all my projects.  but i needed an advenge 
porgarmining language to move to the next level, that is why i pick up 
django. my aim is to develop an investment  site and level multi marketting 
site with django.
where user can register and select investment package and make a certain % 
within a month or week.
the invesment will grow daily 
the truth is that i dont know where to start.

any body with ideas or code  where i can look at to get started thanks.
email skyline...@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/4876d987-f974-41fc-83c0-317024d5ef17n%40googlegroups.com.


Re: SChedule email

2021-07-01 Thread SKYLINE TV

*You can check out celery and how to integrate it with django. Once done, 
task scheduling is easy,first add your gmail configuration in settings.py 
as follows:*

*EMAIL_BACKEND = 'django_smtp_ssl.SSLEmailBackend' *
*EMAIL_USE_TLS = True *
*EMAIL_HOST = 'smtp.gmail.com' *
*EMAIL_HOST_USER = 'your_email' *
*EMAIL_HOST_PASSWORD = 'your password' *
*DEFAULT_FROM_EMAIL = EMAIL_HOST_USER EMAIL_PORT = 465*

Then in your tasks.py you can add the function for scheduling emails as 
follows:

*from django.template.loader import render_to_string *
*from django.core.mail import EmailMessage*

@periodic_task
( run_every=(crontab(hour=3, minute=34)), #runs exactly at 3:34am every day 
name="Dispatch_scheduled_mail",
 reject_on_worker_lost=True, ignore_result=True) 
def schedule_mail(): 
 message = render_to_string('app/schedule_mail.html') 
 mail_subject = 'Scheduled Email' to_email = getmail email = 
EmailMessage(mail_subject, message, to=[to_email]) 
 email.send()

*Then finally your email template 'schedule_mail.html*
{% autoescape off %} 
Hello , 
 This is a test email if you are seeing this,
 your email got delivered! 
 Regards, Coding Team.
 {% endautoescape %}
On Thursday, July 1, 2021 at 1:54:31 PM UTC+1 divyamu...@gmail.com wrote:

> HI,
>
> I wanted to schedule a email every jan and aug 6 monthly basis without 
> celery using settings.py. Can anyone help?
>
> once in every 6months mail should be triggered
>

-- 
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/a87a8623-d123-404d-91b8-d30a01d91dc0n%40googlegroups.com.


Re: HELP WITH INSTALLING AND RUNNING PGAGENT AS A DAEMON

2021-07-01 Thread Kasper Laudrup
On 01/07/2021 17.49, Sunday Iyanu Ajayi wrote:
> 
> Please I need guidance in setting up Pgagent as a daemon on my ubuntu

https://gist.github.com/v4r15/b246b81ec09c488ebecac4610d975456

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/4419c780-f9e9-b7ab-da69-7e94757ba218%40stacktrace.dk.


OpenPGP_signature
Description: OpenPGP digital signature


HELP WITH INSTALLING AND RUNNING PGAGENT AS A DAEMON

2021-07-01 Thread Sunday Iyanu Ajayi
Dear Team,

Please I need guidance in setting up Pgagent as a daemon on my ubuntu
*AJAYI Sunday *
(+234) 806 771 5394
*sunnexaj...@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/CAKYSAw2fJ7E1Ge80UTo%2BPkFGYaqdxxVnTjoJuhycoarNyBuswA%40mail.gmail.com.


ValueError: Field 'stufees' expected a number but got 'None'.

2021-07-01 Thread waqar khan
I have create model class and run success fully
But Issues add field like stufees ,
stufess=models.FloatField(),
right value default ,
as soon as reply 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/5ac34a99-30c8-4dbe-80f6-0700d938709dn%40googlegroups.com.


Re: SChedule email

2021-07-01 Thread divya murugulla
can you please send me some code sample that i can achieve through settings

On Thursday, July 1, 2021 at 6:56:39 PM UTC+5:30 sachinb...@gmail.com wrote:

> look for the croon jobs or schedulers that may work,
>
> thank you
> Sachin b.g
>
> On Thu, 1 Jul 2021 at 18:45, divya murugulla  wrote:
>
>> i cannot use celery suggest me something different
>>
>> On Thursday, July 1, 2021 at 6:27:51 PM UTC+5:30 aadil1...@gmail.com 
>> wrote:
>>
>>> Use *Django-celery*
>>>
>>> On Thu, 1 Jul, 2021, 6:23 PM divya murugulla,  
>>> wrote:
>>>
 HI,

 I wanted to schedule a email every jan and aug 6 monthly basis without 
 celery using settings.py. Can anyone help?

 once in every 6months mail should be triggered

 -- 

>>> 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/ba849b82-e054-45a8-ae1e-e67cde6b23b5n%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/e35ea3bc-2777-4515-b9df-c5ab51d799c2n%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/669c9cc8-1c39-48bc-8ccf-41f548c7fd34n%40googlegroups.com.


Re: SChedule email

2021-07-01 Thread sachinbg sachin
look for the croon jobs or schedulers that may work,

thank you
Sachin b.g

On Thu, 1 Jul 2021 at 18:45, divya murugulla 
wrote:

> i cannot use celery suggest me something different
>
> On Thursday, July 1, 2021 at 6:27:51 PM UTC+5:30 aadil1...@gmail.com
> wrote:
>
>> Use *Django-celery*
>>
>> On Thu, 1 Jul, 2021, 6:23 PM divya murugulla, 
>> wrote:
>>
>>> HI,
>>>
>>> I wanted to schedule a email every jan and aug 6 monthly basis without
>>> celery using settings.py. Can anyone help?
>>>
>>> once in every 6months mail should be triggered
>>>
>>> --
>>>
>> 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/ba849b82-e054-45a8-ae1e-e67cde6b23b5n%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/e35ea3bc-2777-4515-b9df-c5ab51d799c2n%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/CAOs61rzqVSbuZLvQ0cHXtjZJKR3hs%2BqzRZs%2BcRmAAChTQvkt9Q%40mail.gmail.com.


Re: SChedule email

2021-07-01 Thread divya murugulla
i cannot use celery suggest me something different

On Thursday, July 1, 2021 at 6:27:51 PM UTC+5:30 aadil1...@gmail.com wrote:

> Use *Django-celery*
>
> On Thu, 1 Jul, 2021, 6:23 PM divya murugulla,  
> wrote:
>
>> HI,
>>
>> I wanted to schedule a email every jan and aug 6 monthly basis without 
>> celery using settings.py. Can anyone help?
>>
>> once in every 6months mail should be triggered
>>
>> -- 
>>
> 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/ba849b82-e054-45a8-ae1e-e67cde6b23b5n%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/e35ea3bc-2777-4515-b9df-c5ab51d799c2n%40googlegroups.com.


Re: SChedule email

2021-07-01 Thread Julio Cojom
I remember a python library called django-cron, it's stable in Linux
environments

El jue., 1 de julio de 2021 6:54 a. m., divya murugulla <
divyamurugu...@gmail.com> escribió:

> HI,
>
> I wanted to schedule a email every jan and aug 6 monthly basis without
> celery using settings.py. Can anyone help?
>
> once in every 6months mail should be triggered
>
> --
> 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/ba849b82-e054-45a8-ae1e-e67cde6b23b5n%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/CAHRQUHkCkp1hR2LGu6H16y3%2BQ-Moah47Z-cYFXmY-JijPLY-iw%40mail.gmail.com.


Re: SChedule email

2021-07-01 Thread Aadil Rashid
Use *Django-celery*

On Thu, 1 Jul, 2021, 6:23 PM divya murugulla, 
wrote:

> HI,
>
> I wanted to schedule a email every jan and aug 6 monthly basis without
> celery using settings.py. Can anyone help?
>
> once in every 6months mail should be triggered
>
> --
> 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/ba849b82-e054-45a8-ae1e-e67cde6b23b5n%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/CAAYXZx8vxbGttx_JxXZ-s%2BgKAiqmUi170oQPeJShkZRKKNZLQA%40mail.gmail.com.


SChedule email

2021-07-01 Thread divya murugulla
HI,

I wanted to schedule a email every jan and aug 6 monthly basis without 
celery using settings.py. Can anyone help?

once in every 6months mail should be triggered

-- 
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/ba849b82-e054-45a8-ae1e-e67cde6b23b5n%40googlegroups.com.


Schedule settings

2021-07-01 Thread divya murugulla
schedule concept 

-- 
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/0baca774-6f18-45b9-8ce0-7bfcdef06dc3n%40googlegroups.com.


Re: Sorting price and discount price (urgent)

2021-07-01 Thread Aritra Ray
Hi,

I will avoid using 'urgent'. The problem is as described above, I want to
sort my products in ascending or descending price order which will include
the discount price too if it exists. Right now, if there are two products,
A and B; A being ₹900 and B being ₹1200 too but after discount, ₹ 800, the
sorting order highest to lowest price is: B,A instead of A,B. As Shailesh
asked, discount_price is a model field as I've given in the code about. And
the 'fields = {'price': 'discount_price'}' is wrong after I searched a bit
on the internet, kindly ignore that.

Kindly suggest a way to include discount_price in the sorting parameter
where it'll be considered instead of the original price itself.

On Thu, 1 Jul, 2021, 4:06 pm Shailesh Yadav, 
wrote:

> yes, I agree with Kasper please don't use urgent  OR very urgent, and
> please describe your questions in detail.
> from where you getting this *discount_price* and why you using the *price*
> key for two different values. (can you check by printing *discount_price*)
>
> fields={
> 'price': 'price',
> 'price':'discount_price'
> },
>
>
>
> Thanks & Regards
> Shailesh Yadav
>
>
>
> On Thu, Jul 1, 2021 at 1:33 PM Aritra Ray  wrote:
>
>> I tried to describe the problem but till my capability and it is urgent,
>> not just for increasing the possibility of getting help. Thank you for your
>> advice and help.
>>
>> On Thu, 1 Jul, 2021, 1:30 pm Kasper Laudrup, 
>> wrote:
>>
>>> On 7/1/21 8:03 AM, Aritra Ray wrote:
>>> > I am facing a problem in including the discount_price into
>>> consideration
>>> > when sorting price through the products. Kindly help me to do so. The
>>> > below attached files are filters.py, views.py and  models.py.
>>> >
>>>
>>> Instead of writing "urgent" in hope it will increase your chances of
>>> getting help faster, you'll have a much better chance of getting some
>>> useful help if you spend some time describing the exact problem you have
>>> instead of just "a problem".
>>>
>>> This might help you:
>>>
>>>
>>> https://betterprogramming.pub/how-to-ask-questions-about-programming-dcd948fcd2b
>>>
>>> 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/0c454b7d-cb51-ea95-d0e8-ca4be0c2bad7%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/CAFecadvpnYg3CWXRtZfNjWpLPbd4KyqndZ5EdmVUmaP_dbvR0Q%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/CAMQ-AEVPDkAeFihwbd1xYWNskvUc8zta-9FZW1ePr_rYZ0vnGA%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/CAFecaduF3yum-%2BXVDqYTmcaBgSK5UajT8tBYYyErWGoJe7FsAw%40mail.gmail.com.


Re: Sorting price and discount price (urgent)

2021-07-01 Thread Shailesh Yadav
yes, I agree with Kasper please don't use urgent  OR very urgent, and
please describe your questions in detail.
from where you getting this *discount_price* and why you using the *price*
key for two different values. (can you check by printing *discount_price*)

fields={
'price': 'price',
'price':'discount_price'
},



Thanks & Regards
Shailesh Yadav



On Thu, Jul 1, 2021 at 1:33 PM Aritra Ray  wrote:

> I tried to describe the problem but till my capability and it is urgent,
> not just for increasing the possibility of getting help. Thank you for your
> advice and help.
>
> On Thu, 1 Jul, 2021, 1:30 pm Kasper Laudrup, 
> wrote:
>
>> On 7/1/21 8:03 AM, Aritra Ray wrote:
>> > I am facing a problem in including the discount_price into
>> consideration
>> > when sorting price through the products. Kindly help me to do so. The
>> > below attached files are filters.py, views.py and  models.py.
>> >
>>
>> Instead of writing "urgent" in hope it will increase your chances of
>> getting help faster, you'll have a much better chance of getting some
>> useful help if you spend some time describing the exact problem you have
>> instead of just "a problem".
>>
>> This might help you:
>>
>>
>> https://betterprogramming.pub/how-to-ask-questions-about-programming-dcd948fcd2b
>>
>> 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/0c454b7d-cb51-ea95-d0e8-ca4be0c2bad7%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/CAFecadvpnYg3CWXRtZfNjWpLPbd4KyqndZ5EdmVUmaP_dbvR0Q%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/CAMQ-AEVPDkAeFihwbd1xYWNskvUc8zta-9FZW1ePr_rYZ0vnGA%40mail.gmail.com.


Re: Django

2021-07-01 Thread Théodore KOSSI
okay thanks you very much


Le jeu. 1 juil. 2021 à 08:56, Kasper Laudrup  a
écrit :

> On 7/1/21 9:14 AM, Théodore KOSSI wrote:
> > How can I do it ?
> >
>
> The exact same way you normally pass arguments to constructors.
>
> 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/0b13125a-846c-d7f6-ff19-3957bdf4b321%40stacktrace.dk
> .
>


-- 
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/CAKiMjQE_s57_4QChhqZ1SXfSdEAcc%2BUSxCzfeZZ4vCzqeHEaPw%40mail.gmail.com.


paginate_by attribute not giving error.

2021-07-01 Thread sunday honesty
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.


Re: Sorting price and discount price (urgent)

2021-07-01 Thread Aritra Ray
I tried to describe the problem but till my capability and it is urgent,
not just for increasing the possibility of getting help. Thank you for your
advice and help.

On Thu, 1 Jul, 2021, 1:30 pm Kasper Laudrup,  wrote:

> On 7/1/21 8:03 AM, Aritra Ray wrote:
> > I am facing a problem in including the discount_price into consideration
> > when sorting price through the products. Kindly help me to do so. The
> > below attached files are filters.py, views.py and  models.py.
> >
>
> Instead of writing "urgent" in hope it will increase your chances of
> getting help faster, you'll have a much better chance of getting some
> useful help if you spend some time describing the exact problem you have
> instead of just "a problem".
>
> This might help you:
>
>
> https://betterprogramming.pub/how-to-ask-questions-about-programming-dcd948fcd2b
>
> 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/0c454b7d-cb51-ea95-d0e8-ca4be0c2bad7%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/CAFecadvpnYg3CWXRtZfNjWpLPbd4KyqndZ5EdmVUmaP_dbvR0Q%40mail.gmail.com.


Re: Sorting price and discount price (urgent)

2021-07-01 Thread Kasper Laudrup

On 7/1/21 8:03 AM, Aritra Ray wrote:
I am facing a problem in including the discount_price into consideration 
when sorting price through the products. Kindly help me to do so. The 
below attached files are filters.py, views.py and  models.py.




Instead of writing "urgent" in hope it will increase your chances of 
getting help faster, you'll have a much better chance of getting some 
useful help if you spend some time describing the exact problem you have 
instead of just "a problem".


This might help you:

https://betterprogramming.pub/how-to-ask-questions-about-programming-dcd948fcd2b

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/0c454b7d-cb51-ea95-d0e8-ca4be0c2bad7%40stacktrace.dk.


Re: Django

2021-07-01 Thread Kasper Laudrup

On 7/1/21 9:14 AM, Théodore KOSSI wrote:

How can I do it ?



The exact same way you normally pass arguments to constructors.

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/0b13125a-846c-d7f6-ff19-3957bdf4b321%40stacktrace.dk.


Django security releases issued: 3.2.5 and 3.1.13

2021-07-01 Thread Mariusz Felisiak

Details are available on the Django project weblog:

https://www.djangoproject.com/weblog/2021/jul/01/security-releases/

--
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/31690f63-8470-c2ef-6353-7db4ced9567d%40gmail.com.


Re: In django you can either obtain a `csrftoken` from a cookie or the form can generate a nonce `csrftoken`. How does django validate both?

2021-07-01 Thread Patrice Chaula
Okay, thank you Antonis. I wanted to have a clear understanding how it
works.

On Thu, 1 Jul 2021 at 07:54, Antonis Christofides <
anto...@antonischristofides.com> wrote:

> What if I can copy that cookie (samesite)  in developer tools from
> legitimate-site.com and create a new cookie for malicious-site.com using
> developer tools. After I do that I make a request. Will it be successful?
>
> I think it would probably work. (This is not a security issue, though,
> since the user agrees. The problem is when malicious-site.com tries to do
> something to legitimate-site.com using the user's credentials without the
> user knowing.)
>
> Antonis Christofides
> +30-6979924665 (mobile)
>
>
>
> On 01/07/2021 01.48, Patrice Chaula wrote:
>
> What if I can copy that cookie (samesite)  in developer tools from
> legitimate-site.com and create a new cookie for malicious-site.com using
> developer tools. After I do that I make a request. Will it be successful?
>
> On Wed, Jun 30, 2021, 3:43 PM Antonis Christofides <
> anto...@antonischristofides.com> wrote:
>
>> Django does not store csrftoken on the server.
>>
>> Django provides the csrftoken in two places: 1) The cookie; 2) A hidden
>> form field.
>>
>> When the browser makes a POST request, then:
>>
>>1. It sends back the cookie anyway (that's what cookies do)
>>2. It submits the csrftoken as a form field (or as the X-CSRFToken
>>HTTP header in case of AJAX).
>>
>> All Django does after that is verify that the token it receives with (2)
>> is the same as the token it receives with (1).
>>
>> Why this helps? Because the attack it is designed to mitigate is one
>> where you visit malicious-site.com which contains the following:
>>
>> https://legitimate-site.com;
>> >
>> 
>> 
>> 
>> 
>>
>> For this attack to succeed, malicious-site.com would need to specify a
>> csrftoken as, say, a hidden form field (which is possible) AND provide the
>> same token through a cookie. This is not possible. malicious-site.com
>> can't set cookies of another site. The post request may indeed send a
>> csrftoken as a cookie to legitimate-site.com, but this will be the
>> csrftoken received the previous time the user visited legitimate-site.com.
>> It will not be the same as the csrftoken sent as a hidden field, because
>> malicious-site.com can't read cookies of another site, so it can't
>> possibly read that cookie and set the hidden field to its value.
>>
>> Antonis Christofides
>> +30-6979924665 (mobile)
>>
>>
>>
>>
>> On 30/06/2021 15.14, Patrice Chaula wrote:
>>
>> In django you can either obtain a `csrftoken` from a cookie. Or the form
>> can generate a nonce `csrftoken`. How does django validate both and where
>> are they stored on the server. Are they stored as part of the session?
>> --
>> 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/83f3da74-ecbc-4197-9627-0c9ab9e8492fn%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/7732c858-fd8c-53de-9a0f-99ae704ae4c6%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/CAE%3DG6DY1gG71vdqEUiax%3DQqfuqukC%3Dyi-qo9zKnwyra4i3ujDw%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/af840a8d-5baa-dbed-faea-86d6e787be41%40antonischristofides.com
> 
> 

Re: Django

2021-07-01 Thread Théodore KOSSI
How can I do it ?


Le mar. 29 juin 2021 à 13:00, Kasper Laudrup  a
écrit :

> On 6/29/21 1:13 PM, Théodore KOSSI wrote:
> > Can I give arguments to HtpResponseRedirect()?
> >
>
> Yes.
>
> 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/82ec33fb-c5bc-341b-2856-e4766d6c3861%40stacktrace.dk
> .
>


-- 
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/CAKiMjQHu2K13wBMWTNSdvkWbNnGwAjUrZ%3Dib%2Bn54Tc7F-Th7dA%40mail.gmail.com.


Sorting price and discount price (urgent)

2021-07-01 Thread Aritra Ray
I am facing a problem in including the discount_price into consideration
when sorting price through the products. Kindly help me to do so. The below
attached files are filters.py, views.py and  models.py.

Regards,
Aritra

class ProductFilter(django_filters.FilterSet):
sort = OrderingFilter(
choices=(
('price', 'Lowest to Highest'),
('-price', 'Highest to Lowest'),
),
fields={
'price': 'price',
'price':'discount_price'
},
)
price = RangeFilter()
class Meta:
model = Items
fields = ['size', 'category']

class Product(ListView):
model = Items
paginate_by = 6
template_name = 'products.html'
ordering = ["-id"]

def get_queryset(self):
queryset = super().get_queryset()
filter = ProductFilter(self.request.GET, queryset)
return filter.qs

def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
queryset = self.get_queryset()
filter = ProductFilter(self.request.GET, queryset)
context["filter"] = filter
return context
class Items(BaseModel):
title = models.CharField(max_length=100, null=True, blank=True)
price = models.FloatField(null=True, blank=True)
discount_price = models.FloatField(max_length=100, blank=True, null=True
)
description = models.TextField(max_length=500)
size = models.CharField(choices=SIZES, default=SIZES[0][0], max_length=
10)
category = models.CharField(choices=CATEGORY, default=CATEGORY[0][0
], max_length=1)
featured = models.BooleanField(default=False)
availability = models.CharField(choices=AVAILABILITY, default=
AVAILABILITY[0][0], max_length=1)
image = ResizedImageField(upload_to="", null=True, blank=True)
slug = models.SlugField(max_length=100)
date_added = models.DateField(default=timezone.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/CAFecadsUerZLP7gj7M23DLjytHQcuWc1ys2nqEcs_JNLKMc_Qg%40mail.gmail.com.