S
S
Sergey Y2021-05-27 10:56:29
Django
Sergey Y, 2021-05-27 10:56:29

How to implement order processing in Django?

There are orders left by visitors and there are employees who sort these orders, how to implement so that when choosing orders, there are only relevant, not previously selected

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
AlexNest, 2021-05-27
@sergey_1990

Offhand two options:

  1. add a boolean field, with false by default and update to true when taken.
  2. Add order fulfillment status (published, accepted, closed, etc.)

(in the second case, you can either create a separate model and store it in it, or set statuses in the code)
Example
#models.py
 
#Django Models ChoiceField    
class Profile(models.Model):
    # Country Choices
    CHOICES = (
        ('US', 'United States'),
        ('FR', 'France'),
        ('CN', 'China'),
        ('RU', 'Russia'),
        ('IT', 'Italy'),
    )
    username = models.CharField(max_length=300)
    country = models.CharField(max_length=300, choices = CHOICES)
 
    def __str__(self):
        return self.username

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question