Re: Job Request As A Software Developer

2022-09-01 Thread Gobi Dasu
Hi Onjomba,

I noticed you have a strong, in-demand skill set. We'd love to have you
join our talent network of software developers, data scientists, and
designers, called LD Talent - ldtalentwork.com. By joining LD Talent,
you’ll have the following benefits:

- Explore remote opportunities: both contract and full-time, with US-based
companies
- Set your own hourly rate and work on your own schedule
- Gain financial incentives upon posting new learnings on our Github/Blog -
blog.ldtalentwork.com
- Get funded to build your own ideas through the LD Ventures wing

Become a part of the network by sending your resume to i...@ldtalentwork.com
and learn more about how you can advance your career. If you have any
questions, here’s our bookable calendar - ldtalentwork.com/contact/ . Thank
you.

Regards
Gobi

On Thu, Sep 1, 2022, 13:24 Onjomba Felix  wrote:

> Hae,
> I am humbly requesting if you have any job or referral to a job just tell
> me bellow is my Cover Letter and CV.
> [image: WhatsApp Image 2022-08-30 at 21.03.40.jpg]
>
> --
> You received this message because you are subscribed 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/CAJU16zc2C9BGiQaAEnrbUDLdXgL%2B4zFs%3DpJzfLJjKrsiD3BNDQ%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/CAMk8evnmoTNRq2ET-AwazYcvmTCHj1%3DQm184cHgZsgLhpWuJOA%40mail.gmail.com.


Checking API Results before saving

2022-09-01 Thread lone...@gmail.com
Hello all,

I am sending an GET request to an external API and I would like to 
validate the response before I save it to my model.  How do I do this?

Thank you.

-- 
You received this message because you are subscribed 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/0b724dc1-cb08-4168-8cc0-a5eac8a7c011n%40googlegroups.com.


Re: Negative Stock Prevention

2022-09-01 Thread Ryan Nowakowski
If you get this error during migration you likely have some existing Stock rows 
in your database with quantity that is less than 0. If this site is in 
production already, you'll need to create a data migration to change your 
negative quantities to zero.

https://docs.djangoproject.com/en/4.1/topics/migrations/#data-migrations

If this project isn't in production yet, just delete your database and 
migrations and start from ground zero.

On September 1, 2022 12:18:22 AM CDT, tech george  wrote:
>Hello,
>
>Sorry the error is:
>
>django.db.utils.IntegrityError: CHECK constraint failed: quantity
>
>
>
>On Thu, Sep 1, 2022 at 3:45 AM Ryan Nowakowski  wrote:
>
>> I don't see any error. Did you forget to post it?
>>
>> On August 31, 2022 5:57:32 AM CDT, tech george 
>> wrote:
>>>
>>> Hello,
>>>
>>> Sorry for the late reply.
>>>
>>> I changed the models as below and added checkConstraint , But when I
>>> migrate I get the below error.
>>>
>>> What am I still doing wrong?
>>>
>>> class Stock(models.Model):
>>> quantity = models.PositiveIntegerField(default='0', blank=True,
>>> null=True)
>>> reorder_level = models.PositiveIntegerField(default='0', blank=True,
>>> null=True)
>>>
>>> class Meta:
>>> CheckConstraint(check=Q(quantity__gt=0), name='quantity')
>>>
>>>
>>>
>>> On Tue, Aug 30, 2022 at 6:09 PM Thomas Couch  wrote:
>>>
 I don't see where you define the quantity variable, should that be
 instance.quantity? Also, presumably you want to check if quantity is
 greater than or equal to qu rather than 0.
 Try changing `if quantity > 0` to `if instance.quantity >= qu`


 On Tuesday, August 30, 2022 at 3:44:51 PM UTC+1 Ryan Nowakowski wrote:

> On Mon, Aug 29, 2022 at 05:18:39PM +0300, tech george wrote:
> > Please help crack the below code, I want to prevent negative stock,
> and if
> > the stock is == 0, deduct it from reorder_level instead.
> > Currently, the stock goes negative.
> >
> > models.py
> >
> > class Stock(models.Model):
> > quantity = models.IntegerField(default='0', blank=True, null=True)
> > reorder_level = models.IntegerField(default='0', blank=True,
> null=True)
> >
> > class Dispense(models.Model):
> > drug_id = models.ForeignKey(Stock,
> > on_delete=models.SET_NULL,null=True,blank=False)
> > dispense_quantity = models.PositiveIntegerField(default='1',
> > blank=False, null=True)
> > taken=models.CharField(max_length=300,null=True, blank=True)
>
> Maybe change quantity and reorder_level to PositiveIntegerField?
>
 --
 You received this message because you are subscribed 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/9ef2d260-7c1a-4ff1-95ca-c13ded5f9f7bn%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/DDF83E16-47C4-4E38-90DE-6CDAE28268DB%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/CADYG20H6Yv_Y0vkgqVzOU90emRP%3DnvUw7vRrM--HGNbb0zZCAA%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/5FF4241B-B0E2-4082-9537-F1CDE9AF821D%40fattuba.com.


Re: Performance regression when moving from 3.1 to 3.2 (same with 4)

2022-09-01 Thread Ryan Nowakowski
Can you dump the generated sql from both Django versions?

https://docs.djangoproject.com/en/4.1/faq/models/#how-can-i-see-the-raw-sql-queries-django-is-running

On September 1, 2022 8:58:08 AM CDT, Marc Parizeau  wrote:
>Hi,
>
>I am seing a sharp increase in execution time for some of my queries when 
>moving from Django 3.1 to 3.2. And the performance hit appears to be the 
>same for Django 4.
>
>My backend is Postgres 14.2. 
>
>My Django project has forums for different types of content. The forum app 
>consists essentially of 5 tables:
>
>   1. a Post table that contains forum posts (essentially a text field);
>   2. a Thread table where rows point to a specific content and post;
>   3. a FollowUp table where rows point to a specific thread and post;
>   4. a ThreadEntry table where rows point to a thread, a user, and the 
>   last seen thread post for this user;
>   5. a FollowUpEntry table where rows point to a followup, a user, and the 
>   last seen followup post for this user.
>
>Here is an example query that executes 2 times slower on 3.2 than on 3.1:
>Content.objects.all().annotate(
>  has_unread_posts=Greatest(
># a content is unread if at least one condition is true
>Exists(
>  # a thread has never been read (has no user entry)
>  Thread.objects.filter(
>content=OuterRef('pk'),
>  ).exclude(threadentry__user=user)
>),
>Exists(
>  # a thread entry is not up-to-date
>  ThreadEntry.objects.filter(
>thread__content=OuterRef('pk'),
>user=user,
>  ).exclude(post=F('thread__post'))
>),
>Exists(
>  # a followup has no user entry
>  FollowUp.objects.filter(
>thread__content=OuterRef('pk')
>  ).exclude(followupentry__user=user)
>),
>Exists(
>  # a followup entry is not up-to-date
>  FollowUpEntry.objects.filter(
>followup__thread__content=OuterRef('pk'),
>user=user,
>  ).exclude(post=F('followup__post'))
>),
>  )
>).filter(
>  has_unread_posts=True,
>).order_by(
>  'course__uid',
>  '-version__start',
>).select_related(
>  'course',
>  'version',
>)
>
>Course and Version are other tables related to Content.
>
>I want to know with this query, for each of the user's content, whether or 
>not there is something new in the corresponding forum.  There is something 
>new if any one of the following condition is true:
>
>   1. there exists a thread for which the user has no thread entry (an 
>   entry is added when the thread is first read by the user);
>   2. there exists a user thread entry for which the last read post is not 
>   up to date with the current thread post (the thread owner has modified the 
>   post since);
>   3. there exists a followup for which the user has no followup entry (an 
>   entry is added when the followup is first read by the user);
>   4. there exists a user followup entry for which the last read post is 
>   not up to date with the followup post (the followup owner has modified the 
>   post since).
>
>On my machine, just by changing the Django version using pip, and nothing 
>else, this query takes about 1 second of execution on Django 3.1.14, and a 
>little more than 2 seconds on Django 3.2.15, so about a 2x increase. Here 
>are the current table sizes for these execution times:
>
>   1. Content: 33
>   2. Thread: ~30K
>   3. FollowUp: ~46K
>   4. ThreadEntry: ~1.3M
>   5. FollowUpEntry: ~4.5M
>   6. Post: ~103K
>
>Am I the only one observing such performance regressions with Django 3.2? 
>On other more complex queries that contain subqueries inside subqueries, I 
>have seen up to 30x execution time increases. 
>
>Did something major happen in SQL generation from 3.1 to 3.2?
>
>Am I doing something wrong? How can this happen?
>
>Any help on understanding what is going on with Django 3.2 would be much 
>appreciated.
>
>Best 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/54287aec-dcf2-4179-b939-f099876e05a9n%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/34B8F624-61B9-4930-A127-8E2384AC3B30%40fattuba.com.


Re: Deploy Django Project in AAPanel

2022-09-01 Thread Luqman Lawal
Okay

On Thu, Sep 1, 2022, 6:54 AM 'Kasper Laudrup' via Django users <
django-users@googlegroups.com> wrote:

> On 01/09/2022 02.10, Javier L. Camacaro wrote:
> > Does someone how to deploy a Django Project in AAPanel?
> >
>
> https://forum.aapanel.com/d/13338-python-manager-deploy-djangoblog
>
> 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/f916369f-b05d-0c33-d094-49dc401157e1%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/CAHj0e%2BTD1R%3Ddb50YKPf9h6_KWk7AmWmtbMbLguz5tiUjwMa7_A%40mail.gmail.com.


Re: ImportError: cannot import name 'employees' from 'rest_framework'

2022-09-01 Thread Luqman Lawal
Okay

On Thu, Sep 1, 2022, 4:21 PM Ashish Rawat 
wrote:

> There is error in line number 3 you are importing the module from restapi
> but you should take that from model
>
> On Thu, Sep 1, 2022, 7:30 PM Pooja Kumari  wrote:
>
>> Can anyone explain this error?
>>
>> --
>> You received this message because you are subscribed 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/2920648e-f12c-4e26-a089-59a196fd653an%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/CAJf3Dr%2Bipj0t3zXoA3C1D-FF%3DCe0BvJH-Xd1OWneYF9e%2B1Pu%2Bg%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/CAHj0e%2BT2H2KOiPFv%3DN2w%2BrJrvmfCoSvErqbwD6%3DK%3Dcm3jUXWZQ%40mail.gmail.com.


Re: ImportError: cannot import name 'employees' from 'rest_framework'

2022-09-01 Thread M Adnan
>From webapp.models import employee

On Thu, 1 Sep 2022, 7:02 pm Pooja Kumari,  wrote:

> Can anyone explain this error?
>
> --
> You received this message because you are subscribed 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/2920648e-f12c-4e26-a089-59a196fd653an%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/CABNyTSqR989ABXXJj3T0iZaH595Vk31hmUR2NiJOSyyOZeBrZw%40mail.gmail.com.


Re: ImportError: cannot import name 'employees' from 'rest_framework'

2022-09-01 Thread Shams Ulhaq
>From . models import employees
Then use in serializer

On Thu, 1 Sep 2022, 19:02 Pooja Kumari,  wrote:

> Can anyone explain this error?
>
> --
> You received this message because you are subscribed 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/2920648e-f12c-4e26-a089-59a196fd653an%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/CACbcXAVj1R83-VmWJ6m%3DT2VL8Lu8R%3D8T0kpx03NrCbnxexAL2g%40mail.gmail.com.


Re: Bad Request 400 in Django

2022-09-01 Thread Marcella Carvalho
Paste here your settings code

On Thu, Sep 1, 2022, 4:14 PM Eric smith  wrote:

> I have some issues in running django server.
>
> System check identified no issues (0 silenced).
> September 01, 2022 - 10:58:47
> Django version 4.0.1, using settings 'project.settings'
> Starting development server at http://127.0.0.1:8000/
> Quit the server with CTRL-BREAK.
> [01/Sep/2022 10:58:57] "GET / HTTP/1.1" 400 143
> [01/Sep/2022 10:58:58] "GET /favicon.ico HTTP/1.1" 400 143
>
> Please help me if you are expert on it.
>
> --
> You received this message because you are subscribed 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/7034243a-72ba-47bb-a5a3-6c1bcdec67aan%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/CAE2b%3DZF4hCt2-WOwwaTzWrRPJ4uPXnfZCazGeiEvgZe8tqPWSw%40mail.gmail.com.


Re: Bad Request 400 in Django

2022-09-01 Thread Jishnu Ramachandran
藍藍

On Thu, 1 Sep, 2022, 11:02 pm Lakshyaraj Dash, 
wrote:

> What ??? It's September not july
>
> On Thu, Sep 1, 2022, 22:29 subin  wrote:
>
>> I will look forward to meeting you on July 11
>>
>> On Thu, Sep 1, 2022 at 4:14 PM Eric smith 
>> wrote:
>>
>>> I have some issues in running django server.
>>>
>>> System check identified no issues (0 silenced).
>>> September 01, 2022 - 10:58:47
>>> Django version 4.0.1, using settings 'project.settings'
>>> Starting development server at http://127.0.0.1:8000/
>>> Quit the server with CTRL-BREAK.
>>> [01/Sep/2022 10:58:57] "GET / HTTP/1.1" 400 143
>>> [01/Sep/2022 10:58:58] "GET /favicon.ico HTTP/1.1" 400 143
>>>
>>> Please help me if you are expert on it.
>>>
>>> --
>>> You received this message because you are subscribed 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/7034243a-72ba-47bb-a5a3-6c1bcdec67aan%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/CAJnMy6f18fkS2%2BMThaestycUN-NKGh2m3TV%2BpUH9ogkwX2Li_g%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/CAF7qQgA8POoZSH0_BtZ18Z-BhTh%2BYeFMAoCs%2BkXzcV0KDt3_fQ%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/CACoV%2BeFX1MrhDSf3OePf8MMfK-Fj2unGRz6dsgEw7gCOvvj%2BKA%40mail.gmail.com.


Re: Bad Request 400 in Django

2022-09-01 Thread Lakshyaraj Dash
What ??? It's September not july

On Thu, Sep 1, 2022, 22:29 subin  wrote:

> I will look forward to meeting you on July 11
>
> On Thu, Sep 1, 2022 at 4:14 PM Eric smith 
> wrote:
>
>> I have some issues in running django server.
>>
>> System check identified no issues (0 silenced).
>> September 01, 2022 - 10:58:47
>> Django version 4.0.1, using settings 'project.settings'
>> Starting development server at http://127.0.0.1:8000/
>> Quit the server with CTRL-BREAK.
>> [01/Sep/2022 10:58:57] "GET / HTTP/1.1" 400 143
>> [01/Sep/2022 10:58:58] "GET /favicon.ico HTTP/1.1" 400 143
>>
>> Please help me if you are expert on it.
>>
>> --
>> You received this message because you are subscribed 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/7034243a-72ba-47bb-a5a3-6c1bcdec67aan%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/CAJnMy6f18fkS2%2BMThaestycUN-NKGh2m3TV%2BpUH9ogkwX2Li_g%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/CAF7qQgA8POoZSH0_BtZ18Z-BhTh%2BYeFMAoCs%2BkXzcV0KDt3_fQ%40mail.gmail.com.


Re: ImportError: cannot import name 'employees' from 'rest_framework'

2022-09-01 Thread Pooja Kumari
Understood.
Thank you very much

On Thu, Sep 1, 2022, 7:45 PM MAHESH KUMAR 
wrote:

> You can write  your serializers in 3rd line
>
> From .models import employees
>
> Thanks,
> Mahesh
>
> On Thu, Sep 1, 2022, 19:30 Pooja Kumari  wrote:
>
>> Can anyone explain this error?
>>
>> --
>> You received this message because you are subscribed 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/2920648e-f12c-4e26-a089-59a196fd653an%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/CAPvC_H847-a5M3fdmTmWRT%2BU3ZESG-RqHDA3h6JBQXnGFe0a_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/CAHYvwbVQ4Rywj-N0E4H%2Bnk9c8C1pNYkwWESBx2aAvo%2B29sRpAQ%40mail.gmail.com.


Re: Bad Request 400 in Django

2022-09-01 Thread 'Kasper Laudrup' via Django users

On 01/09/2022 17.03, Eric smith wrote:

I have some issues in running django server.

System check identified no issues (0 silenced).
September 01, 2022 - 10:58:47
Django version 4.0.1, using settings 'project.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
[01/Sep/2022 10:58:57] "GET / HTTP/1.1" 400 143
[01/Sep/2022 10:58:58] "GET /favicon.ico HTTP/1.1" 400 143

Please help me if you are expert on it.



HTTP 400 error means the client sent a request the server couldn't 
understand. What the client is, what it sent and why the server couldn't 
understand it, no expert is able to tell you. Only you can answer that.


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/52c013c6-f52b-8843-5727-95f520e4a712%40stacktrace.dk.


OpenPGP_0xE5D9CAC64AAA55EB.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


Re: Bad Request 400 in Django

2022-09-01 Thread subin
I will look forward to meeting you on July 11

On Thu, Sep 1, 2022 at 4:14 PM Eric smith  wrote:

> I have some issues in running django server.
>
> System check identified no issues (0 silenced).
> September 01, 2022 - 10:58:47
> Django version 4.0.1, using settings 'project.settings'
> Starting development server at http://127.0.0.1:8000/
> Quit the server with CTRL-BREAK.
> [01/Sep/2022 10:58:57] "GET / HTTP/1.1" 400 143
> [01/Sep/2022 10:58:58] "GET /favicon.ico HTTP/1.1" 400 143
>
> Please help me if you are expert on it.
>
> --
> You received this message because you are subscribed 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/7034243a-72ba-47bb-a5a3-6c1bcdec67aan%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/CAJnMy6f18fkS2%2BMThaestycUN-NKGh2m3TV%2BpUH9ogkwX2Li_g%40mail.gmail.com.


Re: ImportError: cannot import name 'employees' from 'rest_framework'

2022-09-01 Thread subin
Thanks again for the info.

On Thu, Sep 1, 2022 at 4:21 PM Ashish Rawat 
wrote:

> There is error in line number 3 you are importing the module from restapi
> but you should take that from model
>
> On Thu, Sep 1, 2022, 7:30 PM Pooja Kumari  wrote:
>
>> Can anyone explain this error?
>>
>> --
>> You received this message because you are subscribed 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/2920648e-f12c-4e26-a089-59a196fd653an%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/CAJf3Dr%2Bipj0t3zXoA3C1D-FF%3DCe0BvJH-Xd1OWneYF9e%2B1Pu%2Bg%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/CAJnMy6ePf1VWGFTJgXr4mEHbm78AJMC6PoWVB98zbQL_KpDoaQ%40mail.gmail.com.


Re: Bad Request 400 in Django

2022-09-01 Thread subin
Hi

On Thu, Sep 1, 2022 at 4:25 PM Lipede Tope  wrote:

> Check your code
>
> On Thu, Sep 1, 2022, 4:13 PM Eric smith  wrote:
>
>> I have some issues in running django server.
>>
>> System check identified no issues (0 silenced).
>> September 01, 2022 - 10:58:47
>> Django version 4.0.1, using settings 'project.settings'
>> Starting development server at http://127.0.0.1:8000/
>> Quit the server with CTRL-BREAK.
>> [01/Sep/2022 10:58:57] "GET / HTTP/1.1" 400 143
>> [01/Sep/2022 10:58:58] "GET /favicon.ico HTTP/1.1" 400 143
>>
>> Please help me if you are expert on it.
>>
>> --
>> You received this message because you are subscribed 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/7034243a-72ba-47bb-a5a3-6c1bcdec67aan%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/CABp6AaB2JzWBbSyFvNYPwDFn96bx2f%3DKT-ScUUgNNGuHVOYQpg%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/CAJnMy6fxSb5P9VdJrYMJLV5%3Dx6AJ%2B9K1YaJffOja1%3DXoUmxK2A%40mail.gmail.com.


Re: Bad Request 400 in Django

2022-09-01 Thread Lipede Tope
Check your code

On Thu, Sep 1, 2022, 4:13 PM Eric smith  wrote:

> I have some issues in running django server.
>
> System check identified no issues (0 silenced).
> September 01, 2022 - 10:58:47
> Django version 4.0.1, using settings 'project.settings'
> Starting development server at http://127.0.0.1:8000/
> Quit the server with CTRL-BREAK.
> [01/Sep/2022 10:58:57] "GET / HTTP/1.1" 400 143
> [01/Sep/2022 10:58:58] "GET /favicon.ico HTTP/1.1" 400 143
>
> Please help me if you are expert on it.
>
> --
> You received this message because you are subscribed 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/7034243a-72ba-47bb-a5a3-6c1bcdec67aan%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/CABp6AaB2JzWBbSyFvNYPwDFn96bx2f%3DKT-ScUUgNNGuHVOYQpg%40mail.gmail.com.


Re: ImportError: cannot import name 'employees' from 'rest_framework'

2022-09-01 Thread Ashish Rawat
There is error in line number 3 you are importing the module from restapi
but you should take that from model

On Thu, Sep 1, 2022, 7:30 PM Pooja Kumari  wrote:

> Can anyone explain this error?
>
> --
> You received this message because you are subscribed 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/2920648e-f12c-4e26-a089-59a196fd653an%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/CAJf3Dr%2Bipj0t3zXoA3C1D-FF%3DCe0BvJH-Xd1OWneYF9e%2B1Pu%2Bg%40mail.gmail.com.


Bad Request 400 in Django

2022-09-01 Thread Eric smith
I have some issues in running django server.

System check identified no issues (0 silenced).
September 01, 2022 - 10:58:47
Django version 4.0.1, using settings 'project.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
[01/Sep/2022 10:58:57] "GET / HTTP/1.1" 400 143
[01/Sep/2022 10:58:58] "GET /favicon.ico HTTP/1.1" 400 143

Please help me if you are expert on it.

-- 
You received this message because you are subscribed 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/7034243a-72ba-47bb-a5a3-6c1bcdec67aan%40googlegroups.com.


Re: ImportError: cannot import name 'employees' from 'rest_framework'

2022-09-01 Thread Akash Kundoo
>From where you're importing employees? Check that?

On Thu, 1 Sep, 2022, 7:31 pm Pooja Kumari,  wrote:

> Can anyone explain this error?
>
> --
> You received this message because you are subscribed 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/2920648e-f12c-4e26-a089-59a196fd653an%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/CACTgikHJx6PUikfv6apyxe0suW%3D9tZNZCNy-0A%3D%3DXBv6%3DR2FyA%40mail.gmail.com.


Re: ImportError: cannot import name 'employees' from 'rest_framework'

2022-09-01 Thread MAHESH KUMAR
You can write  your serializers in 3rd line

>From .models import employees

Thanks,
Mahesh

On Thu, Sep 1, 2022, 19:30 Pooja Kumari  wrote:

> Can anyone explain this error?
>
> --
> You received this message because you are subscribed 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/2920648e-f12c-4e26-a089-59a196fd653an%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/CAPvC_H847-a5M3fdmTmWRT%2BU3ZESG-RqHDA3h6JBQXnGFe0a_w%40mail.gmail.com.


Performance regression when moving from 3.1 to 3.2 (same with 4)

2022-09-01 Thread Marc Parizeau
Hi,

I am seing a sharp increase in execution time for some of my queries when 
moving from Django 3.1 to 3.2. And the performance hit appears to be the 
same for Django 4.

My backend is Postgres 14.2. 

My Django project has forums for different types of content. The forum app 
consists essentially of 5 tables:

   1. a Post table that contains forum posts (essentially a text field);
   2. a Thread table where rows point to a specific content and post;
   3. a FollowUp table where rows point to a specific thread and post;
   4. a ThreadEntry table where rows point to a thread, a user, and the 
   last seen thread post for this user;
   5. a FollowUpEntry table where rows point to a followup, a user, and the 
   last seen followup post for this user.

Here is an example query that executes 2 times slower on 3.2 than on 3.1:
Content.objects.all().annotate(
  has_unread_posts=Greatest(
# a content is unread if at least one condition is true
Exists(
  # a thread has never been read (has no user entry)
  Thread.objects.filter(
content=OuterRef('pk'),
  ).exclude(threadentry__user=user)
),
Exists(
  # a thread entry is not up-to-date
  ThreadEntry.objects.filter(
thread__content=OuterRef('pk'),
user=user,
  ).exclude(post=F('thread__post'))
),
Exists(
  # a followup has no user entry
  FollowUp.objects.filter(
thread__content=OuterRef('pk')
  ).exclude(followupentry__user=user)
),
Exists(
  # a followup entry is not up-to-date
  FollowUpEntry.objects.filter(
followup__thread__content=OuterRef('pk'),
user=user,
  ).exclude(post=F('followup__post'))
),
  )
).filter(
  has_unread_posts=True,
).order_by(
  'course__uid',
  '-version__start',
).select_related(
  'course',
  'version',
)

Course and Version are other tables related to Content.

I want to know with this query, for each of the user's content, whether or 
not there is something new in the corresponding forum.  There is something 
new if any one of the following condition is true:

   1. there exists a thread for which the user has no thread entry (an 
   entry is added when the thread is first read by the user);
   2. there exists a user thread entry for which the last read post is not 
   up to date with the current thread post (the thread owner has modified the 
   post since);
   3. there exists a followup for which the user has no followup entry (an 
   entry is added when the followup is first read by the user);
   4. there exists a user followup entry for which the last read post is 
   not up to date with the followup post (the followup owner has modified the 
   post since).

On my machine, just by changing the Django version using pip, and nothing 
else, this query takes about 1 second of execution on Django 3.1.14, and a 
little more than 2 seconds on Django 3.2.15, so about a 2x increase. Here 
are the current table sizes for these execution times:

   1. Content: 33
   2. Thread: ~30K
   3. FollowUp: ~46K
   4. ThreadEntry: ~1.3M
   5. FollowUpEntry: ~4.5M
   6. Post: ~103K

Am I the only one observing such performance regressions with Django 3.2? 
On other more complex queries that contain subqueries inside subqueries, I 
have seen up to 30x execution time increases. 

Did something major happen in SQL generation from 3.1 to 3.2?

Am I doing something wrong? How can this happen?

Any help on understanding what is going on with Django 3.2 would be much 
appreciated.

Best 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/54287aec-dcf2-4179-b939-f099876e05a9n%40googlegroups.com.


how can i solve that

2022-09-01 Thread amr ahmed
[image: iii.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/6657e33a-bd88-4079-8515-394674bc424bn%40googlegroups.com.


Re: Deploy Django Project in AAPanel

2022-09-01 Thread Abdul Qoyyuum Haji Abdul Kadir
Hi Javier,

This doesn't sound like an issue with Django.

Try raising a ticket on AAPanel GitHub repo with a full error message and
steps to reproduce it.

Abdul Qoyyuum Bin Haji Abdul Kadir
about.me/qoyyuum

On Thu, Sep 1, 2022, 8:11 AM Javier L. Camacaro 
wrote:

> Does someone how to deploy a Django Project in AAPanel?
>
> I tried Python Maganer 2.0 but impossible for me!
> I get this error:
>
> Sorry, something went wrong: Traceback (most recent call last): File
> "class/flask_sockets.py", line 30, in *call* handler, values =
> adapter.match() File
> "/www/server/panel/pyenv/lib/python3.7/site-packages/werkzeug/routing.py",
> line 1945, in match raise NotFound() werkzeug.exceptions.NotFound: 404 Not
> Found: The requested URL was not found on the server. If you entered the
> URL manually please check your spelling and try again.
>
> ...and many others after that
>
> Please help 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/66e880c0-9561-41bb-93bb-e08475f9eb19n%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/CANVqoJ8%3DNe7DREP8KKase32F%2B7s9DFt0oh236906ZENe89Lwzg%40mail.gmail.com.


Re: Job Request As A Software Developer

2022-09-01 Thread R V Tulasi
My company recruting
Pls share cv to 9966342766 through whatsapp
Python developer vacancy

On Thu, Sep 1, 2022, 1:09 PM Onjomba Felix  wrote:

> Hae,
> I am humbly requesting if you have any job or referral to a job just tell
> me bellow is my Cover Letter and CV.
> [image: WhatsApp Image 2022-08-30 at 21.03.40.jpg]
>
> --
> You received this message because you are subscribed 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/CAJU16zc2C9BGiQaAEnrbUDLdXgL%2B4zFs%3DpJzfLJjKrsiD3BNDQ%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/CAAMQv6Jh_iL3SjgXHmf3Lz0e4OFuiyFe_rdTAgXdPZ1RyWVv%2BQ%40mail.gmail.com.


Re: Deploy Django Project in AAPanel

2022-09-01 Thread Javier L. Camacaro
Thanks Kasper, I did it with this tutorial, works fine, but with my project
it doesn't.

I received a lot of errors:
























*Sorry, something went wrong:Traceback (most recent call last):File
"class/flask_sockets.py", line 30, in __call__handler, values =
adapter.match()File
"/www/server/panel/pyenv/lib/python3.7/site-packages/werkzeug/routing.py",
line 1945, in matchraise NotFound()werkzeug.exceptions.NotFound: 404 Not
Found: The requested URL was not found on the server. If you entered the
URL manually please check your spelling and try again.During handling of
the above exception, another exception occurred:Traceback (most recent call
last):File "class/public.py", line 299, in ReadFilef_body = fp.read()File
"/www/server/panel/pyenv/lib/python3.7/codecs.py", line 322, in
decode(result, consumed) = self._buffer_decode(data, self.errors,
final)UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position
0: invalid start byteDuring handling of the above exception, another
exception occurred:Traceback (most recent call last):File
"class/public.py", line 304, in ReadFilef_body = fp.read()File
"/www/server/panel/pyenv/lib/python3.7/codecs.py", lin.and more*


when i try to create a project with python manager 2.0. I can't understand
*.*


*Thanks again!*




El jue, 1 sept 2022 a las 1:55, 'Kasper Laudrup' via Django users (<
django-users@googlegroups.com>) escribió:

> On 01/09/2022 02.10, Javier L. Camacaro wrote:
> > Does someone how to deploy a Django Project in AAPanel?
> >
>
> https://forum.aapanel.com/d/13338-python-manager-deploy-djangoblog
>
> Kind regards,
>
> Kasper Laudrup
>
> --
> 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/GGq1DqwfCGA/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/f916369f-b05d-0c33-d094-49dc401157e1%40stacktrace.dk
> .
>


-- 
___
Javier Camacaro
+(58) 414-445.49.98

-- 
You received this message because you are subscribed 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/CAOrwMe%3DtGkaBN8Ujx8TK2Jvh_q%3DFoEaewCo7DDk%3Drt5L0et4Hw%40mail.gmail.com.


Re: Job Request As A Software Developer

2022-09-01 Thread Kunal Solanke
I don't have any job openings in mind, but I'd suggest you make your CV
again.


1. Keep it 2 pages tops(this is important)
2. No need for about keep it in your linkdein
3. Create Education, Experience and projects and Achievements.
4. Include top 2-3 experiences and projects to make it shorters
5. Use some kind of resume template to make it look better


And lastly you can apply on jobs openings and amazon/databricks they have
intern openings I think.

Hope it helps


Regards


On Thu, Sep 1, 2022, 13:09 Onjomba Felix  wrote:

> Hae,
> I am humbly requesting if you have any job or referral to a job just tell
> me bellow is my Cover Letter and CV.
> [image: WhatsApp Image 2022-08-30 at 21.03.40.jpg]
>
> --
> You received this message because you are subscribed 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/CAJU16zc2C9BGiQaAEnrbUDLdXgL%2B4zFs%3DpJzfLJjKrsiD3BNDQ%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/CAOecAnzLM-PUpBQgUt94_JwczJK2LZRAOrK3_pk2FQt7pLp4iQ%40mail.gmail.com.


Re: Negative Stock Prevention

2022-09-01 Thread tech george
I managed to remove the error,

I had a negative stock in my DB.

Thanks a lot for the help.

On that note, I was also trying to get the dispensed from stock

I was trying to do this but I don't think it can work since there is
already a foreign key at Dispense model fetching drug_id from stock.

What's the best way out?

@property
def dispensed(self):
return (self.quantity - self.dispense.quantity)




On Thu, Sep 1, 2022 at 6:09 AM Ammar Mohammed  wrote:

> I don't think you need that constraint after using the
> PositiveIntegerField .
>
>
> On Thu, 1 Sep 2022, 02:45 Ryan Nowakowski,  wrote:
>
>> I don't see any error. Did you forget to post it?
>>
>> On August 31, 2022 5:57:32 AM CDT, tech george 
>> wrote:
>>>
>>> Hello,
>>>
>>> Sorry for the late reply.
>>>
>>> I changed the models as below and added checkConstraint , But when I
>>> migrate I get the below error.
>>>
>>> What am I still doing wrong?
>>>
>>> class Stock(models.Model):
>>> quantity = models.PositiveIntegerField(default='0', blank=True,
>>> null=True)
>>> reorder_level = models.PositiveIntegerField(default='0', blank=True,
>>> null=True)
>>>
>>> class Meta:
>>> CheckConstraint(check=Q(quantity__gt=0), name='quantity')
>>>
>>>
>>>
>>> On Tue, Aug 30, 2022 at 6:09 PM Thomas Couch  wrote:
>>>
 I don't see where you define the quantity variable, should that be
 instance.quantity? Also, presumably you want to check if quantity is
 greater than or equal to qu rather than 0.
 Try changing `if quantity > 0` to `if instance.quantity >= qu`


 On Tuesday, August 30, 2022 at 3:44:51 PM UTC+1 Ryan Nowakowski wrote:

> On Mon, Aug 29, 2022 at 05:18:39PM +0300, tech george wrote:
> > Please help crack the below code, I want to prevent negative stock,
> and if
> > the stock is == 0, deduct it from reorder_level instead.
> > Currently, the stock goes negative.
> >
> > models.py
> >
> > class Stock(models.Model):
> > quantity = models.IntegerField(default='0', blank=True, null=True)
> > reorder_level = models.IntegerField(default='0', blank=True,
> null=True)
> >
> > class Dispense(models.Model):
> > drug_id = models.ForeignKey(Stock,
> > on_delete=models.SET_NULL,null=True,blank=False)
> > dispense_quantity = models.PositiveIntegerField(default='1',
> > blank=False, null=True)
> > taken=models.CharField(max_length=300,null=True, blank=True)
>
> Maybe change quantity and reorder_level to PositiveIntegerField?
>
 --
 You received this message because you are subscribed 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/9ef2d260-7c1a-4ff1-95ca-c13ded5f9f7bn%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/DDF83E16-47C4-4E38-90DE-6CDAE28268DB%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/CAHs1H7uN4xCF%2B7AKqxSufatWiUN_n9cw4uBALo-ENFOfirp_hg%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/CADYG20EXeqBXyAQsG0zpk6HXxcKixhjvy_R9z1QiY6%3Da5cAvFg%40mail.gmail.com.