S
S
serik2018-04-26 16:09:46
Django
serik, 2018-04-26 16:09:46

How to restrict user access to models.py model entries in the admin panel?

Wrote a model where you can add companies and information about them.

class Company(models.Model):
    name = models.CharField("Название компании", max_length = 80)
    city = models.CharField("Город", max_length = 80)
    background = models.ImageField("Фон", upload_to="annex/img/%Y/%m/%d", default='')

    def __str__(self):
        return self.name
        return self.city

    class Meta:
      verbose_name = "Все компании"
      verbose_name_plural = "Все компании"

5ae1ce8cecbce761148170.pngPlease help , how can I make it so that, depending on the authorized user, only the corresponding record is displayed in this model?
5ae1cef96685f996877379.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artem Spiridonov, 2018-04-26
@customtema

How to restrict user access to model entries

The controller.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question