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e
mWmP8Y/z4X2qaCpW/GHS+XFccT1h8CxqsFxnAhnecjdMCv/TJLXMNk9LihEeUEZo
4U7bitCfyO17dt6NC/7wbGZCJmNPO7V3YYeI8MwzOkvmXqLcHz0IPQATuLMB1HKr
oG/Vrwq029ftqnuDluS/DzmuIqWLuAT+2nIe1JLWFlS9OUTi4i+y0NDlxWCZOaGp
ucR+ueFKv1de3nVjdd6oN+MIO9gQ3NE53FrO46A3APy6Ex02Mxub8nNnQjXcStHZ
BHO6KilQ+QLzSektD8IpHM7tR6P+5PP6AQ==
=NePe
-----END PGP PUBLIC KEY BLOCK-----
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+unsubscribe@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.

Re: Negative Stock Prevention

Hello,

Sorry the error is:

django.db.utils.IntegrityError: CHECK constraint failed: quantity



On Thu, Sep 1, 2022 at 3:45 AM Ryan Nowakowski <ryan@fattuba.com> wrote:
I don't see any error. Did you forget to post it?

On August 31, 2022 5:57:32 AM CDT, tech george <techgeorge4@gmail.com> 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 <t.couch@ucl.ac.uk> 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+unsubscribe@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+unsubscribe@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+unsubscribe@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.

Re: Negative Stock Prevention

I don't think you need that constraint after using the PositiveIntegerField .


On Thu, 1 Sep 2022, 02:45 Ryan Nowakowski, <ryan@fattuba.com> wrote:
I don't see any error. Did you forget to post it?

On August 31, 2022 5:57:32 AM CDT, tech george <techgeorge4@gmail.com> 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 <t.couch@ucl.ac.uk> 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+unsubscribe@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+unsubscribe@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+unsubscribe@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.

Re: Negative Stock Prevention

I don't see any error. Did you forget to post it?

On August 31, 2022 5:57:32 AM CDT, tech george <techgeorge4@gmail.com> 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 <t.couch@ucl.ac.uk> 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+unsubscribe@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.

Re: Deploy Django Project in AAPanel

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 <javierleonet@gmail.com> 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+unsubscribe@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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CANVqoJ8%3DNe7DREP8KKase32F%2B7s9DFt0oh236906ZENe89Lwzg%40mail.gmail.com.

Deploy Django Project in AAPanel

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+unsubscribe@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.

how can i solve that

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+unsubscribe@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: Bug with Watchman on Windows

-----BEGIN PGP PUBLIC KEY BLOCK-----

xsDNBGBJfrABDACxIFOMQIsP94wTkgf76JEHyTITmYnprsTeRmDet01G5etZ9ZHm
RmrqYVFzXu1aSBbaejm/ppbRrBB7YmFETbpnZepWJnuhridvjV37duRH3g/9ppiy
tNkhOOIYA/l8ppvyaRlrp/jPjAm27HVxi1Nu0syaWwTFKbUTtLKldIhuWvAXkgxp
xyBdB3jfmKoJ4rvTzZU+saKgaFExRmdd5TptwRP9cPRWIoR5fcRA8RQ1X66NkIpl
VBbH7NeLuTtICAa0dnyTh50x+Wapu1kDEWmr8ssUzf6c8yBJAHKBohQowZmQ8sYt
w2h4gX0zT4V3TY9y8TvTFGhPlM7l5QRFBlZqCBp5K/6xkyaAf+VlUwsdMqe8UOz5
mMJ5ZLU9JEzFyfSiM8xScwIzPcyQhOiLAgqIozTag+9B6QgD66Xa80yrFmfXyVtU
OtS6ykQsepR/fq6ySUKjWGFJ/Psq0wNuBaCHzEwEfeShZquL/jXmcUFJhVbeDYIZ
cPngktFCZ30fYuMAEQEAAc0mS2FzcGVyIExhdWRydXAgPGxhdWRydXBAc3RhY2t0
cmFjZS5kaz7CwQ8EEwEIADkWIQS5plkBvlt0D6iFDi7l2crGSqpV6wUCYEl+sQUJ
BaOagAIbAwULCQgHAgYVCAkKCwIFFgIDAQAACgkQ5dnKxkqqVeuAxQwApU4laVk3
4B2dZpFUMmkO46OeimzLiZaNYgs+SVIDw/WtaVbLUq+KH/TIMTiX5wgGRZ4WEC2L
4w66j8EzVx8vE2fNPx+yP1bM+lfbk1UBbtt9o6F6vIGzV0lHfO8rAPo4wB7lP0QB
dOAaJqnnDecGgse91HAqk1TR7oH4W7QkAshNbWEJfHpgJHNqXUa/2dp8jPAQfVcH
S0j5/4ovfVKg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/WECIG2RSE0N6C4RfKIC03ysl
L4lnhSc426Bnxkf8sZm+oFo4ian0GcuNdIQBdBdAek9F2CX6whDbL4mZFAeY/e6e
mWmP8Y/z4X2qaCpW/GHS+XFccT1h8CxqsFxnAhnecjdMCv/TJLXMNk9LihEeUEZo
4U7bitCfyO17dt6NC/7wbGZCJmNPO7V3YYeI8MwzOkvmXqLcHz0IPQATuLMB1HKr
oG/Vrwq029ftqnuDluS/DzmuIqWLuAT+2nIe1JLWFlS9OUTi4i+y0NDlxWCZOaGp
ucR+ueFKv1de3nVjdd6oN+MIO9gQ3NE53FrO46A3APy6Ex02Mxub8nNnQjXcStHZ
BHO6KilQ+QLzSektD8IpHM7tR6P+5PP6AQ==
=NePe
-----END PGP PUBLIC KEY BLOCK-----
On 31/08/2022 18.52, David V wrote:
> Hello All,
>
> Apologies if this is the wrong place to submit this. I couldn't find
> clear enough documentation on where to do this, so I guess I ended up here.
>

Maybe open an issue on the issue tracker on github?

https://github.com/facebook/watchman

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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4a0fec42-ee50-d9d5-5d60-913c607e551c%40stacktrace.dk.

Bug with Watchman on Windows

Hello All,

Apologies if this is the wrong place to submit this. I couldn't find clear enough documentation on where to do this, so I guess I ended up here.

I installed pywatchman along with FB's watchman expecting StatReloader to change to WatchmnaReloader. Sadly, I was mistaken.

Python version: 3.9
Django version: 4.1
pywatchman version: 1.4.1
OS: Windows 11
PyCharm version: 2022.2.1
conda environment

Steps to reproduce:
Install Django
Install pywatchman
Install Watchman
Confirm Watchman is running
Start a django project
run: python manage.py runserver

I tracked the issue down to django.utils.autoreload.py. It seems that on client.capabilityCheck(), optional is a keyword argument set equal to None (optional=None), which is a problem because later when pywatchman call capabilities.synthesize() in pywatchman.capabilityCheck() (line 1079), it doesn't work because a for loop gets called on optional that was passed in. In Python for x in None: does not work. Could we get a kwarg added optional = [ ] in the function call for result = cliient.capabilityCheck() on line 628 in autoreload.py? I was able to sidestep the issue by inserting version = (4, 9) above line 627 where the try:...except:... is initialized in check_availability and then commenting out lines 627–632—try:...version = get_vers....

I know that then it won't provide the correct Watchman version, but it would be nice if it worked out of the box like it is supposed to.

Please let me know what further steps I should take to make sure that watchman works out of the box like it is supposed to.

Thanks,

David V.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/8dad35c6-0442-4cdb-837b-5629dc89ffdan%40googlegroups.com.

Re: Negative Stock Prevention

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 <t.couch@ucl.ac.uk> 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+unsubscribe@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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CADYG20F0occUAajR%3DSseRtiW%2Bzjh4THmgN6FEFbFsGcpsmMLZg%40mail.gmail.com.

enumerate login in django

how to create a function to login with user nam e. if user name and password is already exist, but want to login with user for super user.

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

Tuesday, August 30, 2022

Re: What do you do with large project and forms?

You need to work with model forms, but not forms, in your templates implement crispy forms  to avoid over coding

On Wed, Aug 31, 2022, 03:03 Mike Dewhirst <miked@dewhirst.com.au> wrote:
1. Create a forms directory
2. Create ../forms/__init__.py
3. Move your forms.py into the forms directory
4. In ./__init__.py write from .forms import (
  FormThis,
  FormThat,
  EtcForm,
)

This gives you unchanged forms calling from wherever ... from appname.forms import etc

5. When all that is working split your 3k forms.py into appropriately named smaller files each containing the form class or classes you prefer and adjust the ./__init__.py imports accordingly

You might encounter occasional circular imports but you should get the hang of it soon enough.

Cheers

Mike



--
(Unsigned mail from my phone)



-------- Original message --------
From: Julio Cojom <jul.alejandro5@gmail.com>
Date: 31/8/22 03:42 (GMT+10:00)
Subject: What do you do with large project and forms?

I have a large project and forms.py per app is bigger than I thought with 3k+ lines in each file, I'm looking for options to make a good scalation structure, does anyone have experience with this? What do you do to organize your forms in your projects?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHRQUHnd2zdPeaOmw2VzWhP2y1xN%3Dv2Z%2BQ%2B%2BsSw1B10AuxEnjA%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/630ea50d.620a0220.480de.4507SMTPIN_ADDED_MISSING%40gmr-mx.google.com.

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

Re: User authentication with simple-jwt drf

hii 

import pandas as pd
from django.contrib import messages
from django.core.mail import EmailMessage
from django.shortcuts import render
from django.template.loader import render_to_string
from app_1.form import NotificationForm


def email_generic_template(request):
form = NotificationForm(request.POST)
if form.is_valid():
csv_file = request.FILES['file']
data = pd.read_csv(csv_file)
subj = request.POST.get('subject')
msg = request.POST.get('message')
BCC = request.POST.get('bcc_email')
CC = request.POST.get('cc_email')
answer = request.POST.get('selected_option')
demo = list()
try:
for k, r in data.iterrows():
value = r.to_dict()
recipient = value["email_id"]
Subject = subj.format(**value)
Body_of_message = msg.format(**value)
bcc = BCC.format(**value)
cc = CC.format(**value)
FROM_EMAIL = "example@gmail.com"
html_template = render_to_string('mail_template.html', {'content': Body_of_message})
email1 = EmailMessage(
Subject,
html_template,
FROM_EMAIL,
[recipient],
bcc=[bcc],
cc=[cc]
)
email1.content_subtype = 'html'
sent = email1.send()
value['sent'] = sent
demo.append(value)
if sent == 1:
sent = 'success'
print(sent)
else:
sent = 'Fail'
print(sent)
if answer == 'sample_mail':
break
context = {
'form': form,
'value': demo,
}
return render(request, 'index.html', context)
except Exception as e:
messages.error(request, e)
context = {
'form': form,
'value': demo
}
return render(request, 'index.html', context)

else:
context = {'form': form}
return render(request, 'index.html', context)
  



this is my code...I want to show failed mail to the template...I am new to Django I did not know how to do it. anyone  help me
On Wednesday, August 24, 2022 at 7:24:23 PM UTC+5:30 dashlaksh...@gmail.com wrote:
Hello everyone,
I want to create a user authentication app using ReactJS and django. But facing problems in authenticating with the jsonwebtokens in ReactJS. Can anybody provide correct guide of implementing DjangoRestFramework simple-jwt and ReactJS jet ?


Disclaimer© 2022 VVDN Technologies Pvt. Ltd. This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful.


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

Re: e

What problem do you have ? 

Try with a update in the console with your environment actived.

sudo apt update upgrade

Else:

You can try install:

pip install Django==3.2


Install this version with your environment actived. 



El lun., 29 de agosto de 2022 9:06 a. m., Samuel Alie Mansaray <mansarays910@gmail.com> escribió:
Hello, am a django beginner, I want to add apps, modules and APIs but am finding it difficult especially with the new version of django because I have been following a tutorial of Version 3.

Please I need help with the updated version.

On Thu, 25 Aug 2022, 21:44 Ahmed Abdelmonem, <ahmed.moname@gmail.com> wrote:
Use validate method to output the user details (name, age, ...etc)  along side with the token, now you have the token and the user, u don't have to extract the user from the token.
use the token and the user together instead of using the token only in React


check this, line 69

Here is the full project (Django DRF for backend, React for Front-end )

On Thu, Aug 25, 2022 at 9:03 PM Aman Stark <aman.stark1925@gmail.com> wrote:
Can we use 2-3 level of primary key like .  (1/1 , 1/2 , 1/3 ) , (2/1,2/2,2/3) .


On Wednesday, 24 August 2022 at 19:24:23 UTC+5:30 dashlaksh...@gmail.com wrote:
Hello everyone,
I want to create a user authentication app using ReactJS and django. But facing problems in authenticating with the jsonwebtokens in ReactJS. Can anybody provide correct guide of implementing DjangoRestFramework simple-jwt and ReactJS jet ?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a555f04d-b312-4626-9bfc-1b46c6826d5cn%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPV6dzg%2BBDqVxLumLjb9X9j%2B1AoDR7mHAeXrCoY7ovq6w35jbg%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAAEwWnxb-xy64%3DvM3RBCdP159gsvrKZvHmpxWnqBoiX2HCmbCA%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAL-qgjcQ0bq9mrZU8y-bu%3DbN1FUrVYndR-fjBVE%3Ddq0zHn6aeA%40mail.gmail.com.

RE: What do you do with large project and forms?

1. Create a forms directory
2. Create ../forms/__init__.py
3. Move your forms.py into the forms directory
4. In ./__init__.py write from .forms import (
  FormThis,
  FormThat,
  EtcForm,
)

This gives you unchanged forms calling from wherever ... from appname.forms import etc

5. When all that is working split your 3k forms.py into appropriately named smaller files each containing the form class or classes you prefer and adjust the ./__init__.py imports accordingly

You might encounter occasional circular imports but you should get the hang of it soon enough.

Cheers

Mike



--
(Unsigned mail from my phone)



-------- Original message --------
From: Julio Cojom <jul.alejandro5@gmail.com>
Date: 31/8/22 03:42 (GMT+10:00)
To: django-users@googlegroups.com
Subject: What do you do with large project and forms?

I have a large project and forms.py per app is bigger than I thought with 3k+ lines in each file, I'm looking for options to make a good scalation structure, does anyone have experience with this? What do you do to organize your forms in your projects?

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

Re: What do you do with large project and forms?

Yes

On Tue, 30 Aug 2022, 10:41 pm Julio Cojom, <jul.alejandro5@gmail.com> wrote:
I have a large project and forms.py per app is bigger than I thought with 3k+ lines in each file, I'm looking for options to make a good scalation structure, does anyone have experience with this? What do you do to organize your forms in your projects?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHRQUHnd2zdPeaOmw2VzWhP2y1xN%3Dv2Z%2BQ%2B%2BsSw1B10AuxEnjA%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAKa3babEgrL59HZdj%3DkJitLEXKWaboX-iaoMH8JBhpstFhn6uA%40mail.gmail.com.

What do you do with large project and forms?

I have a large project and forms.py per app is bigger than I thought with 3k+ lines in each file, I'm looking for options to make a good scalation structure, does anyone have experience with this? What do you do to organize your forms in your projects?

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

Re: I want to fetch the value of radio field for updation but it only doesn't fetch even i use condition and value does comes but doesn't checked

I have this problem too 

On Wed, Aug 24, 2022, 5:06 PM Mihir Patel <mihir.patel535@gmail.com> wrote:
i dont have much idea but try to do with True Or False value bcz maybe it returns boolean value.

On Mon, Aug 22, 2022 at 12:27 PM Abhinandan K <abhinandan@snakescript.com> wrote:
<label>Email</label>
<input type="email" name="email" value={{datas.email}}>
{% with val_gen=datas.gender%}
{{val_gen}}
<label>gender:</label><br></br>

<input type="radio" name="gender" value="Male"{% if val_gen == Male %} checked{% endif %} >Male</input>
<input type="radio" name="gender" value="Female"{% if val_gen == Female %} checked{% endif %}>Female</input><br><br>
<input type="submit" value="Update">
{% endwith %}
</form>

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAA6_Mp44RQjMeWfVW82vvT2-GLrv5Jpu2nb_6edWON_3sgXQwQ%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAC10kRG9fXHxO3WPaWftOWEH6jXoV%3D6DNEoV2UyoQNah53NaDA%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAEfX8_3JyvBtt%3DHPD%3DEDx-SQ5LEQBkYJS%2Bj37YR8eqkT7igLKA%40mail.gmail.com.

Re: What Programming Language should i learn

-----BEGIN PGP PUBLIC KEY BLOCK-----

xsDNBGBJfrABDACxIFOMQIsP94wTkgf76JEHyTITmYnprsTeRmDet01G5etZ9ZHm
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ATuLMB1HKr
oG/Vrwq029ftqnuDluS/DzmuIqWLuAT+2nIe1JLWFlS9OUTi4i+y0NDlxWCZOaGp
ucR+ueFKv1de3nVjdd6oN+MIO9gQ3NE53FrO46A3APy6Ex02Mxub8nNnQjXcStHZ
BHO6KilQ+QLzSektD8IpHM7tR6P+5PP6AQ==
=NePe
-----END PGP PUBLIC KEY BLOCK-----
On 30/08/2022 16.35, fawemimo olawale wrote:
> Which of these  programming language should i learn
>
> Please I need counselling on this two language though i have prior
> knowledge on Python Web Framework (Django) as a beginner's but i want
> Backend Language
>
> JAVA or ASP.Net
>

ASP.net isn't a programming language, so you should probably start by
learning what a programming language is before attempting to learn to
use one.

Additionally Django is very much a backend framework so your question
doesn't make any sense.

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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/e53820e7-b84c-434a-608a-96eefa0ab3ee%40stacktrace.dk.

Re: Negative Stock Prevention

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+unsubscribe@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.

Re: What Programming Language should i learn

LOL, You mean you learned Django without first learning Python?.

It depends but My suggestion would be to learn Python and later learn C++ (So then you will get much clarity on what is the difference between these two languages). Then after that, you can learn Data structure and Algorithms.


Thanks & Regards
Shailesh Yadav
+91-9920886044

   Linkedin 




On Tue, Aug 30, 2022 at 8:12 PM Ryan Nowakowski <tubaman@fattuba.com> wrote:
On Tue, Aug 30, 2022 at 03:35:26PM +0100, fawemimo olawale wrote:
> Which of these  programming language should i learn
>
> Please I need counselling on this two language though i have prior
> knowledge on Python Web Framework (Django) as a beginner's but i want
> Backend Language
>
> JAVA or ASP.Net

Python!  But of course.... this list is biased :)

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/20220830144155.GD1858%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMQ-AEUg0gV0CXmeGCogZ2s1hkGsBJoC5t9kwYNvCBqRKmczcg%40mail.gmail.com.

Re: Negative Stock Prevention

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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/20220830144358.GE1858%40fattuba.com.

Re: What Programming Language should i learn

On Tue, Aug 30, 2022 at 03:35:26PM +0100, fawemimo olawale wrote:
> Which of these programming language should i learn
>
> Please I need counselling on this two language though i have prior
> knowledge on Python Web Framework (Django) as a beginner's but i want
> Backend Language
>
> JAVA or ASP.Net

Python! But of course.... this list is biased :)

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

Re: What Programming Language should i learn

I dislike asp.net but it's popular and in demand. I prefer JSP and Java.

On Tue, Aug 30, 2022, 10:35 AM fawemimo olawale <developer.wale@gmail.com> wrote:
Which of these  programming language should i learn

Please I need counselling on this two language though i have prior knowledge on Python Web Framework (Django) as a beginner's but i want Backend Language

JAVA or ASP.Net

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CALJWbzqwimbawRhv%2BNk%2BDvJhaw6hYx84pMyTELURGZ-WGROOpw%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAJ4fu7zA7uvRBDenx0wb6x95a4_vkjvjyfh5C23wy7sT7TmzJg%40mail.gmail.com.

What Programming Language should i learn

Which of these  programming language should i learn

Please I need counselling on this two language though i have prior knowledge on Python Web Framework (Django) as a beginner's but i want Backend Language

JAVA or ASP.Net

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

Re: Negative Stock Prevention

As a start, the logic checks for the model should not be in views.py but rather with the model object (in models.py).  You can extend the save() method, for example, and add the checks there.

See: 
* https://docs.djangoproject.com/en/4.1/ref/models/instances/#saving-objects
* https://docs.djangoproject.com/en/4.1/ref/models/instances/#what-happens-when-you-save
* https://docs.djangoproject.com/en/4.1/topics/db/models/#overriding-model-methods

On Monday, 29 August 2022 at 16:19:28 UTC+2 techg...@gmail.com wrote:
Hello,

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)

views.py
try:  

if request.method == 'POST':
if form.is_valid():
username = form.cleaned_data['taken']
qu=form.cleaned_data['dispense_quantity']
ka=form.cleaned_data['drug_id']
# print(username)



stock= eo=Stock.objects.annotate(
expired=ExpressionWrapper(Q(valid_to__lt=Now()), output_field=BooleanField())
).filter(expired=False).get(id=username)
form=DispenseForm(request.POST or None, instance=stock)
instance=form.save()
# print(instance)
if quantity > 0
instance.quantity-=qu
instance.save()
else:
instance.reorder_level-=qu
instanc.save()

form=DispenseForm(request.POST or None ,initial={'patient_id':queryset})
form.save()

messages.success(request, "Drug Has been Successfully Dispensed")

return redirect('manage_patient_pharmacist')
else:
messages.error(request, "Validity Error")

return redirect('manage_patient_pharmacist')

context={
"patients":queryset,
"form":form,
# "stocks":stock,
"drugs":drugs,
"prescrips":prescrips,
"expired":ex,
"expa":eo,

}
if request.method == 'POST':

print(drugs)
context={
"drugs":drugs,
form:form,
"prescrips":prescrips,
"patients":queryset,
"expired":ex,
"expa":eo,

}
except:
messages.error(request, "Dispensing Not Allowed! The Drug is Expired ,please do a re-stock ")
return redirect('manage_patient_pharmacist')
context={
"patients":queryset,
"form":form,
# "stocks":stock,
"drugs":drugs,
"prescrips":prescrips,
"expired":ex,
"expa":eo,

}

return render(request,'templates/discharge.html',context)

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

Re: hello guys I need help

Please share your query
On Monday, August 29, 2022 at 9:02:05 PM UTC+5 bod...@gmail.com wrote:
please I'm a starter on python and django, i need some to help me with an online class training. 

Thank 
Moses 

On Monday, August 29, 2022 at 3:06:26 PM UTC+1 istee...@gmail.com wrote:
I am beginner ,  how to redirect different types of pages to different users after login in 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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7b3a67b4-4a3f-46cd-a145-0fde34c6e2a1n%40googlegroups.com.

Re: hello guys I need help

my name is engr rotimi michael james , i think i can help you please just  make the model  one to one relations , that is  one user to a page and a page to one user, hope it help.

On Mon, Aug 29, 2022 at 3:06 PM ISTEEN ISAC <isteenisac9@gmail.com> wrote:
I am beginner ,  how to redirect different types of pages to different users after login in 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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/90a18a68-d66f-44d9-82e5-4498fa6c5fcen%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAKbLKW3_q1ZaOO47mc9X%2B%3D8dUJ4rSCF9Z3C-S2VP8n4WLFiSAw%40mail.gmail.com.

Monday, August 29, 2022

Re: hello guys I need help

Hello Bode.
When you say different types of pages what do you mean?

Do you mean you want users to see pages specific to them?

For instance, if my name is Joshua, you want me to see a page with my name and if your name is Bode, you want me to see a page with your name. Is this what you mean?

On Mon, 29 Aug 2022, 17:02 bode moses, <bodemss@gmail.com> wrote:
please I'm a starter on python and django, i need some to help me with an online class training. 

Thank 
Moses 

On Monday, August 29, 2022 at 3:06:26 PM UTC+1 istee...@gmail.com wrote:
I am beginner ,  how to redirect different types of pages to different users after login in 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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c5ea9827-410c-4d05-bb6c-2a7e4b875f27n%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMSS1fDJHOtC3o5K30mi9aOAETtHBeH%3D1ZTdFUbCqECo1DSGbQ%40mail.gmail.com.

Re: hello guys I need help

please I'm a starter on python and django, i need some to help me with an online class training. 

Thank 
Moses 

On Monday, August 29, 2022 at 3:06:26 PM UTC+1 istee...@gmail.com wrote:
I am beginner ,  how to redirect different types of pages to different users after login in 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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c5ea9827-410c-4d05-bb6c-2a7e4b875f27n%40googlegroups.com.

Negative Stock Prevention

Hello,

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)

views.py
try:  

if request.method == 'POST':
if form.is_valid():
username = form.cleaned_data['taken']
qu=form.cleaned_data['dispense_quantity']
ka=form.cleaned_data['drug_id']
# print(username)



stock= eo=Stock.objects.annotate(
expired=ExpressionWrapper(Q(valid_to__lt=Now()), output_field=BooleanField())
).filter(expired=False).get(id=username)
form=DispenseForm(request.POST or None, instance=stock)
instance=form.save()
# print(instance)
if quantity > 0
instance.quantity-=qu
instance.save()
else:
instance.reorder_level-=qu
instanc.save()

form=DispenseForm(request.POST or None ,initial={'patient_id':queryset})
form.save()

messages.success(request, "Drug Has been Successfully Dispensed")

return redirect('manage_patient_pharmacist')
else:
messages.error(request, "Validity Error")

return redirect('manage_patient_pharmacist')

context={
"patients":queryset,
"form":form,
# "stocks":stock,
"drugs":drugs,
"prescrips":prescrips,
"expired":ex,
"expa":eo,

}
if request.method == 'POST':

print(drugs)
context={
"drugs":drugs,
form:form,
"prescrips":prescrips,
"patients":queryset,
"expired":ex,
"expa":eo,

}
except:
messages.error(request, "Dispensing Not Allowed! The Drug is Expired ,please do a re-stock ")
return redirect('manage_patient_pharmacist')
context={
"patients":queryset,
"form":form,
# "stocks":stock,
"drugs":drugs,
"prescrips":prescrips,
"expired":ex,
"expa":eo,

}

return render(request,'templates/discharge.html',context)

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