Skip to content

Instantly share code, notes, and snippets.

@walison17
Created June 23, 2020 23:39
Show Gist options
  • Save walison17/0877c8fa2447e0cebc28e90e43165344 to your computer and use it in GitHub Desktop.
Save walison17/0877c8fa2447e0cebc28e90e43165344 to your computer and use it in GitHub Desktop.
from django.db import models
from django.conf import settings
class Cliente(models.Model)
# outros campos
cadastrado_por = models.ForeignKey(settings.USER_MODEL, on_delete=models.PROTECT)
def index(request):
clientes = Cliente.objects.filter(cadastrado_por=request.user)
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment