Skip to content

Packages can have a max capacity of None #62

@LudvigHz

Description

@LudvigHz

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions