Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packages can have a max capacity of None #62

Open
LudvigHz opened this issue Nov 11, 2019 · 0 comments
Open

Packages can have a max capacity of None #62

LudvigHz opened this issue Nov 11, 2019 · 0 comments
Labels
bug Something isn't working

Comments

@LudvigHz
Copy link
Member

The Package model max field does not have a default value and is not set as required when creating. This causes causes an error when trying to book a company with the package.

max = models.PositiveIntegerField(
blank=True, null=True, verbose_name=_("number of packages to sell")

Method causing the error:

def update_available_spots(cls):
for package in Package.objects.all():
if package.companies.all().count() >= package.max:
package.is_full = True
else:
package.is_full = False
package.save(log_it=False, notify_subscribers=False)

Suggested fix:
Either:

  • Remove blank=True, null=True
  • Or allow blank, and ignore max when it is None
@LudvigHz LudvigHz added the bug Something isn't working label Aug 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant