Remove duplicates from queryset
📁 django
Hello, I have a queryset and need to remove duplicates from it:
example = models.Object.objects.values('name', 'photo__name').distinct()
We have a join, and as a result we need to ensure that name and photo__name do not have identical values. How can this be implemented using Django ORM? Thank you!
Try through http.server:
import http.serverimport urllibPORT = 9097class MyProxy(http.server.SimpleHTTPRequestHandler): def do_GET(self): url=self.path[1:] self.send_response(200) self.end_headers() self.copyfile(urllib.urlopen(url), self.wfile)httpd = socketserver.ForkingTCPServer(('', PORT), MyProxy)print (""Now serving at"", str(PORT))httpd.serve_forever()`` Log in to leave an answer