Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How do generate documentation with pydoc for django api?
I need to create documentation for Django API with pydoc Please help me -
xhtml2pdf dynamic frame height
I have some table template, that created with xhtml2pdf. I would like to add user information above table on each printed page. Here is html code: <div id="table_header"> <div>{{ data.user }}</div> <div>{{ data.title }}</div> </div> <table id="table" > </table> Here is style: @page{ size: a4 portrait; margin: 1cm; @frame content { -pdf-frame-content: table_header; top:1cm; left:1cm; height: 60pt; } @frame content { -pdf-frame-content: table; top:60pt; left:1cm; } /*rest of styles*/ } In fact, I'm not sure that user info will always be less than 60pt height (frame height). Is it possible to make frame height dynamic to prevent content overflowing? Seems, it's not possible to use height: auto; and height: 100%; here. Thanks. -
Uploading Scan Results in DefectDojo results in internal server error
i've tried many different things and hope to get some help here. While uploading some scan results in DefectDojo (running inside Docker containers) the application answers with "Internal Server Error", meaning it is not possible to upload files. Below, i have added the response in my Debian terminal. nginx_1 | 2022/01/27 09:09:15 [warn] 6#6: *36 a client request body is buffered to a temporary file /var/cache/nginx/client_temp/0000000002, client: xx.xx.xx.xx.xx, server: , request: "POST /product/1/import_scan_results HTTP/1.1", host: "xxx.amazonaws.com:8080", referrer: "http://xxx.amazonaws.com:8080/product/1/import_scan_results" uwsgi_1 | [27/Jan/2022 09:09:15] ERROR [django.request:224] Internal Server Error: /product/1/import_scan_results uwsgi_1 | Traceback (most recent call last): uwsgi_1 | File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute uwsgi_1 | return self.cursor.execute(sql, params) uwsgi_1 | File "/usr/local/lib/python3.8/site-packages/django/db/backends/mysql/base.py", line 73, in execute uwsgi_1 | return self.cursor.execute(query, args) uwsgi_1 | File "/usr/local/lib/python3.8/site-packages/MySQLdb/cursors.py", line 206, in execute uwsgi_1 | res = self._query(query) uwsgi_1 | File "/usr/local/lib/python3.8/site-packages/MySQLdb/cursors.py", line 319, in _query uwsgi_1 | db.query(q) uwsgi_1 | File "/usr/local/lib/python3.8/site-packages/MySQLdb/connections.py", line 259, in query uwsgi_1 | _mysql.connection.query(self, query) uwsgi_1 | MySQLdb._exceptions.IntegrityError: (1062, "Duplicate entry '17' for key 'PRIMARY'") uwsgi_1 | uwsgi_1 | The above exception was the direct cause of the following exception: uwsgi_1 | uwsgi_1 | Traceback (most recent call last): uwsgi_1 | File "/usr/local/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner uwsgi_1 … -
django dependent dropdown, How can I implement using ModelForm
I have already tried this method dependent. But not working for , Help me. models: class Country(models.Model): id = models.PositiveIntegerField(primary_key=True) name = models.CharField(max_length=50) class Meta: db_table = "countries" verbose_name_plural = 'countries' def __str__(self): return self.name somehow I can chain the country and state fields using ajax but can't store it to the data base. the form is showing errors. class State(models.Model): country = models.ForeignKey(Country, on_delete=models.CASCADE) name = models.CharField(max_length=50) class Meta: db_table = "states" def __str__(self): return self.name forms: class UserAddressForm(forms.ModelForm): class Meta: model = Address fields = ['full_name', 'phone', 'address_line1', 'address_line2', 'country', 'state', 'town_city', 'postcode'] -
django 3.2 and postgres 9 column must appear in the group by clause or be used in an aggregate function
in the admin.py i have a function that determinate a value for a field that doesn't exist in the database when i work with sqlite all it's fine but when i switch in postgres return an error "column must appear in the group by clause or be used in an aggregate function" admin.py ''' imp_f1 = OrdineDB.objects.filter( ~Q(ordine = None), ~Q(ordine__evaso = True), distinta__articolodb__articolo__articolo_lavo__id = id_fase1) .aggregate(total = Sum( quantita_fase1 * F('distinta__articolodb__quantita')) * F('quantita'))['total'] or 0 print(f'impegno f1-{imp_f1}') ''' -
I want to extract a specific value from a string in python
I have a string from which I want to extract value for test1. The string is : I_ID [I_ITEM = [I_ITEM [test1 = F135], I_ITEM [test1 = W1972544]]]]] Any pointers will be helpfull -
Route53 , aws , dns [closed]
I have created a website using Django + gunicorn + Nginx. When i use AWSRoute 53 and I create a CNAME from my host name to a DNS instance name the system doesn't point to the site but to the NGINX start page. It's very strange With the normal Linux 2 AMI and a normal HTML page it works correctly . Is there anyone that can have any idea ? Thanks a lot -
How to count items when their quantity is below reorder level in django
Im confused in counting the items that are quantities are below reorder level. The reorder level is a column in the model of an item too, i think i need to compare their values in __lte in filters but it's not working. Models.py class Item(models.Model): ItemName = models.CharField(max_length=255, blank=True, null=True) Quantity = models.IntegerField(null=True, default=1, validators=[ MaxValueValidator(100), MinValueValidator(0) ]) ModelNum = models.CharField(max_length=255, blank=True, null=True) Category = models.ForeignKey(Category,on_delete=models.CASCADE, null=True) date_created = models.DateTimeField(auto_now_add=True) last_modified = models.DateTimeField(auto_now=True) is_draft = models.BooleanField(default=True) reorder_level = models.IntegerField(blank=True, default=10, validators=[ MaxValueValidator(100), MinValueValidator(1) ]) class Meta: verbose_name_plural = 'Item' def __str__(self): return f'{self.ItemName}' Views.py def dashboard_inventory(request): items_count = Item.objects.all().count() reorder_count = Item.objects.filter(Quantity_lte=reorder_level).count() context={ 'items_count' : items_count, } template_name ='inventory-admin/inventory-dashboard.html' return render(request, template_name, context) -
How do I remove <p> tag from django richtextfield?
I am getting p tag displayed after I post an image or question with ckeditor editor in django ..How can I remove the tag and get the image or text be displayed correctly. [https://i.stack.imgur.com/leLA4.png][1] -
How to check Gmail ID exists or not By Phone Number one bye one Automatically and save phone number which have Gmail ID exists
I want to make an automatic Phone nUmber checking software using phyton that will run in command prompt. Here is the video: https://www.youtube.com/watch?v=ynpmra8bry8 https://www.youtube.com/watch?v=6pSMs7vSyvw I want to make a automatic software like this video.. Please help me with Code If anyone know please share code with me.. thanks a lot -
How to deploy django app on Oracle Linux Server 7.9?
how can I deploy a django application to Oracle Linux Server 7.9 using Putty. Tried to follow this guide but it didn't work. -
maria data base connection error pandas.io.sql.DatabaseError: Execution failed on sql
I am trying to make some changes in the database for that I wrote a script but I think there is a problem with my db_connection I am sharing the script which wrote for the changes from django.conf import settings from farm_management.scripts.db_execute_query import get_data, mysql_db_connect, insert_data def get_boundary_coord(): """ This function will get values from boundary_coord and then return the values into lng and lat """ # create mysql database connection db_conn = mysql_db_connect() print(db_conn, "hello") get_lat_lng_query = "SELECT JSON_EXTRACT(boundary_coord, '$[0][0]') as lng, " \ "JSON_EXTRACT(boundary_coord, '$[0][1]') as lat" \ " FROM farm_management_farm WHERE boundary_coord IS NOT NULL and lng IS NULL and lat IS NULL" # call get_data function to execute get_lng_query, get_lat_query lat_lng_data = get_data(get_lat_lng_query) insert_lat_lng_query = "INSERT INTO `{}`.farm_management_farm(lng, lat) VALUES(%s, %s)".format(settings.IGROW_DB_NAME) # call insert data function by passing database connection, query, farm dataframe to execute insert query insert_data(db_conn, insert_lat_lng_query, lat_lng_data, "farm_management_farm") # close the database connection db_conn.close() def run(): get_boundary_coord() and mysql_db_connection function looks likes def mysql_db_connect(): """ This function creates a connection to mysql database """ db_config = settings.MYSQL_DB_CONFIG mydb = MySQLdb.connect(host=db_config['HOST'], user=db_config['USER'], passwd=db_config['PASSWORD'], db=db_config['NAME']) return mydb but when I am trying my script to make changes in the database It shows an error Exception … -
multiple collapse items that call one django view function, each should submit a different value
I have multiple collapse items. all items should call the same django function while submitting a different value each. I want to achieve this without using django forms dropdown menu. what changes should I make to the current HTML code: HTML: <div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordionSidebar"> <div class="bg-white py-2 collapse-inner rounded"> <h6 class="collapse-header">Filter Options:</h6> <a class="collapse-item" value='1' href={% url 'show_dashboard' %}>Option1</a> <a class="collapse-item" value='2' href={% url 'show_dashboard' %}>Option2</a> <a class="collapse-item" value='3' href={% url 'show_dashboard' %}>Option3</a> <a class="collapse-item" value='4' href={% url 'show_dashboard' %}>Option4</a> <a class="collapse-item" value='5' href={% url 'show_dashboard' %}>Option5</a> <a class="collapse-item" value='6' href={% url 'show_dashboard' %}>Option6</a> <a class="collapse-item" value='7' href={% url 'show_dashboard' %}>Option7</a> </div> </div> -
Django Particular wise total in their respective rows
I am trying to print a particular wise total in the invoice using Django. The problem is if I use for loop, it prints the last items particular wise total in everywhere. I am confused what will be the best way to calculate individual total in their respective rows? Here is my Views.py: def order_complete(request): order_number = request.GET.get('order_number') transID = request.GET.get('payment_id') try: order = Order.objects.get(order_number=order_number, is_ordered=True) ordered_products = OrderProduct.objects.filter(order_id = order.id) total=0 subtotal = 0 for i in ordered_products: total = i.product_price * i.quantity subtotal += total payment = Payment.objects.get(payment_id = transID) context ={ 'order': order, 'ordered_products': ordered_products, 'order_number': order.order_number, 'transID': payment.payment_id, 'payment': payment, 'subtotal': subtotal, 'total':total, } return render(request, 'orders/order_complete.html', context) except(Payment.DoesNotExist, Order.DoesNotExist): return redirect('home') models.py class OrderProduct(models.Model): order = models.ForeignKey(Order, on_delete=models.CASCADE) payment = models.ForeignKey(Payment, on_delete=models.SET_NULL, blank=True, null=True) user = models.ForeignKey(Account, on_delete=models.CASCADE) product = models.ForeignKey(Product, on_delete=models.CASCADE) variations = models.ManyToManyField(Variation, blank=True) quantity = models.IntegerField() product_price = models.FloatField() ordered = models.BooleanField(default=False) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now_add=True) def __str__(self): return self.product.product_name template <dd class="text-right">${{ total }}</dd> suggestion/solutions would be highly appreciated. Here is the result -
cannot send socket messages outside Consumer in Django views or somewhere
from the title shown I am not able to send socket messages here is my code class ChatConsumer(JsonWebsocketConsumer): _user = None @property def cu_user(self): try: self.user = self.scope['user'] self._user = User.objects.get(id=self.user.id) except User.DoesNotExist as e: print(e) return self._user def connect(self): # Join users group async_to_sync(self.channel_layer.group_add)( 'users', self.channel_name ) self.accept() def disconnect(self, close_code): # Leave app async_to_sync(self.channel_layer.group_discard)( 'users', self.channel_name ) self.close() # Receive json message from WebSocket def receive_json(self, content, **kwargs): if content.get('command') == 'chat_handshake': self._handshake(content) elif content.get('command') == 'user_handshake': self.user_handshake() def _handshake(self, data): """ Called by receive_json when someone sent a join command. """ logger.info("ChatConsumer: join_chat: %s" % str(data.get('chat_id'))) try: chat = "%s_%s" % (data.get('chat_type'), data.get('chat_id')) except ClientError as e: return self.handle_client_error(e) # Add them to the group so they get room messages self.channel_layer.group_add( chat, self.channel_name, ) # Instruct their client to finish opening the room self.send_json({ 'command': 'chat_handshake', 'chat_id': str(data.get('chat_id')), 'user': str(self.cu_user), }) # Notify the group that someone joined self.channel_layer.group_send( chat, { "command": "chat_handshake", "user": self.cu_user, } ) def user_handshake(self): key = f'user_{self.cu_user.id}' self.channel_layer.group_add( key, self.channel_name ) self.send_json({ 'command': 'user_handshake', 'user': str(self.cu_user) }) self.channel_layer.group_send( key, { 'command': 'user_handshake', 'user': str(self.cu_user) } ) # this is not working def send_socket(self, event): logger.info(event) print(event) self.send(text_data=json.dumps(event['message'])) I have written my code … -
I am not getting the value from the database
I am using MVT in django. I am using generic CBV (listview, detailview). here are my codes Here is model.py from django.db import models class Singers(models.Model): name= models.CharField(max_length=256) age= models.IntegerField() gender= models.CharField(max_length=10) class Albums(models.Model): name= models.CharField(max_length=256) singer=models.ForeignKey(Singers, on_delete=models.CASCADE) view.py from django.views import generic from core.models import Albums, Singers #in generic view instead of functions, we use classes class AlbumView(generic.ListView): model = Albums template_name = 'index.html' paginate_by = 10 def get_queryset(self): return Albums.objects.all() class DetailView(generic.DetailView): model = Albums template_name = 'detailview.html' Here are urls.py from django.urls import path from core.views import AlbumView, DetailView urlpatterns = [ path('album/', AlbumView.as_view()), path('album/detail/<pk>/', DetailView.as_view()) ] Here is index.html {% block content %} <h2>Albums</h2> <ul> {% for albums in object_list %} <li>{{ albums.name }}</li> {% endfor %} </ul> {% endblock %} here is detailview.html {% block content %} <h1>name: {{Albums.name}}</h1> <p><strong>Singer: {{Albums.Singer}}</strong></p> {% endblock %} The detail view is not working fine. It is not fetching the respective name of the album and singer details. Suggest me what should i do? -
How can I overwrite a models.py entry only if the user id is the current user?
I have genome files, and I want each user to be able to upload their own genome file, but they can only have one of them. I want it so that if they try to upload another, then they will just replace the genome and form data for their last entry. I am using their entries, along with n number of people who use the site (each person also having 1 entry per person) as samples to analyze against that person's genome, so I want to keep a models file full of genomes, names, sex, etc... but only one per user. Here's my models.py file from django.db import models from django.core.exceptions import ObjectDoesNotExist SEX_CHOICES = ( ('M', 'Male'), ('F', 'Female') ) class Genome(models.Model): first_name = models.CharField(max_length=25) last_name = models.CharField(max_length=25) CHOICES = [('M','Male'),('F','Female')] sex = models.CharField(max_length=1, choices=SEX_CHOICES, default='M') genome = models.FileField(upload_to='users/genomes/') #id = request.user.id #if id is the current user then replace old data with new data def __str__(self): return self.title and here is my views function def upload(request): context = {} if request.method == 'POST': form = GenomeForm(request.POST, request.FILES) if form.is_valid(): form.save() return redirect('My-DNA.html') else: form = GenomeForm() return render(request, 'my-DNA.html', {context}) else: print("failure") form = GenomeForm() return render(request, 'Upload.html', … -
Access Foreignkey Instance on Function based Views Django
on Django, I tried to get photos instance on view but not with input parameter because this page has multiple forms, so I try to get photo instance automatically added when I post a comment in recent photos, but I have trouble getting photo instance id on views? everybody can help me? -
django remove m2m instance when there are no more relations
In case we had the model: class Publication(models.Model): title = models.CharField(max_length=30) class Article(models.Model): publications = models.ManyToManyField(Publication) According to: https://docs.djangoproject.com/en/4.0/topics/db/examples/many_to_many/, to create an object we must have both objects saved before we can create the relation: p1 = Publication(title='The Python Journal') p1.save() a1 = Article(headline='Django lets you build web apps easily') a1.save() a1.publications.add(p1) Now, if we called delete in either of those objects the object would be removed from the DB along with the relation between both objects. Up until this point I understand. But is there any way of doing that, if an Article is removed, then, all the Publications that are not related to any Article will be deleted from the DB too? Or the only way to achieve that is to query first all the Articles and then iterate through them like: to_delete = [] qset = a1.publications.all() for publication in qset: if publication.article_set.count() == 1: to_delete(publication.id) a1.delete() Publications.filter(id__in=to_delete).delete() But this has lots of problems, specially a concurrency one, since it might be that a publication gets used by another article between the call to .count() and publication.delete(). Is there any way of doing this automatically, like doing a "conditional" on_delete=models.CASCADE when creating the model or something? Thanks! -
Cannot import model from .models file to nested app sub_directory
Here is my project tree: (base) justinbenfit@MacBook-Pro-3 cds_website % tree . ├── api │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-38.pyc │ │ ├── admin.cpython-38.pyc │ │ ├── apps.cpython-38.pyc │ │ ├── models.cpython-38.pyc │ │ ├── serializers.cpython-38.pyc │ │ ├── urls.cpython-38.pyc │ │ └── views.cpython-38.pyc │ ├── admin.py │ ├── apps.py │ ├── main.py │ ├── management │ │ ├── __init__.py │ │ ├── commands │ │ │ ├── __init__.py │ │ │ ├── __pycache__ │ │ │ │ └── private.cpython-39.pyc │ │ │ ├── private.py │ │ │ └── scrape.py │ │ └── test.py │ ├── migrations │ │ ├── 0001_initial.py │ │ ├── __init__.py │ │ └── __pycache__ │ │ ├── 0001_initial.cpython-38.pyc │ │ └── __init__.cpython-38.pyc │ ├── models.py │ ├── serializers.py │ ├── tests.py │ ├── urls.py │ └── views.py ├── cds_website │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-38.pyc │ │ ├── settings.cpython-38.pyc │ │ ├── urls.cpython-38.pyc │ │ └── wsgi.cpython-38.pyc │ ├── asgi.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── manage.py └── requirements.txt api is an app in a greater project called cds_website. The settings.py file in cds_website project directory contains the following installed apps: INSTALLED_APPS = [ … -
How to create seperate POST request for imagefield in DRF
I need to make seperate api for imagefile. How can I acieve this??? models.py class Organization(models.Model): code = models.CharField(max_length=25, null=False, unique=True) name = models.CharField(max_length=100, null=False) location = models.ForeignKey(Location, on_delete=models.RESTRICT) description = models.TextField() total_of_visas = models.IntegerField(null=False, default=0) base_currency = models.ForeignKey(Currency, on_delete=models.RESTRICT) logo_filename = models.ImageField(upload_to='uploads/') serializers.py class OrganizationSerializer(serializers.ModelSerializer): location = serializers.CharField(read_only=True, source="location.name") base_currency = serializers.CharField(read_only=True, source="base_currency.currency_master") location_id = serializers.IntegerField(write_only=True, source="location.id") base_currency_id = serializers.IntegerField(write_only=True, source="base_currency.id") class Meta: model = Organization fields = ["id", "name", "location", "mol_number", "corporate_id", "corporate_name", "routing_code", "iban", "description", "total_of_visas", "base_currency", "logo_filename", "location_id", "base_currency_id"] def validate(self, data): content = data.get("content", None) request = self.context['request'] if not request.FILES and not content: raise serializers.ValidationError("Content or an Image must be provided") return data def create(self, validated_data): .... def update(self, instance, validated_data): .... views.py class OrganizationViewSet(viewsets.ModelViewSet): queryset = Organization.objects.all() serializer_class = OrganizationSerializer lookup_field = 'id' urls.py router = routers.DefaultRouter() router.register('organization', OrganizationViewSet, basename='organization') urlpatterns = [ path('', include(router.urls)), ]+static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) I don't have idea to make post request for image field from postman?? I am stucing here long time. Any help appreciable,.. -
Django Celery: Clocked task is not running
In a Django app, I have a form that schedules an email to be sent out. It has four fields: name, email, body, send_date. I want to dynamically create a Celery task (email) to run another Celery task at the designated time. I have been able to send out the email at regular intervals (every 30 seconds) based on the form using the following code: schedule, _ = IntervalSchedule.objects.update_or_create(every=30, period=IntervalSchedule.SECONDS) @shared_task(name="schedule_interval_email") def schedule_email_interval(name, email, body, send_date): PeriodicTask.objects.update_or_create( defaults={ "interval": schedule, "task": "email_task" }, name="Send message at interval", args=json.dumps(['name', 'test@test.com', 'body']), ) However, when I have tried to schedule a task to run at a specific time (3 minutes later from the current time) via ClockedSchedule, Celery beat records the tasks and saves all the relevant settings. However, it never actually sends an email. clocked = ClockedSchedule.objects.create(clocked_time=datetime.now() + timedelta(minutes=3)) @shared_task(name="schedule_clock_email") def schedule_email_clocked(name, email, body, send_date): PeriodicTask.objects.create( clocked=clocked, name="Send message at specific date/time", task="email_task", one_off=True, args=json.dumps(['name', 'test@test.com', 'body']), ) I eventually want to dynamically set the clocked field based on the datetime the user enters into the form, so the current code is just trying to test out the way Celery works. I think I'm missing something about how this works, though. … -
Django admin/base.html page override not working
i overridde admin/base.html, changed the order of displaying applications using templatetag, everything works locally, but when I run it from docker, overriding does not work Django==2.2.16 Project structure: my_project/ |-- new_app/ |-- templates/ |-- admin/ |-- base.html settings: TEMPLATE_ROOT = os.path.join(BASE_ROOT, 'templates') TEMPLATE_DIRS = ( TEMPLATE_ROOT, ) INSTALLED_APPS = ( 'django.contrib.admin', ... 'new_app', ) docker-compose: web_app: build: . command: bash -c "python manage.py migrate --no-input && python manage.py collectstatic --no-input && gunicorn invivo.wsgi:application --bind 0.0.0.0:8000 --timeout 600 --workers 3" restart: always volumes: - .:/project - ./static:/static - ./media:/media ports: - 8000:8000 depends_on: - db env_file: - .env -
Tried to use template inheriteance but getting error all the time
I'm trying to inherit index.html and form.html from base.html. But all the time I'm undone. Please give me a solution. I'm learning Django, new in this field. Thanks in advance -
Django ORM, parent and child connecting
Django ORM G'day all, Hope everyone is well. I have two tables I'm looking to join and struggling to join in a particular way. I could easily join them with SQL but rather I would want to do it using Django. Models below; Child: class employee(models.Model): client = models.ForeignKey(client, on_delete=models.CASCADE) mySharePlan_ID = models.CharField(max_length=10, unique=True) payroll_ID = models.CharField(max_length=100) first_name = models.CharField(max_length=155,) middle_name = models.CharField(max_length=155,null=True, blank=True) last_name = models.CharField(max_length=155) TFN = models.IntegerField(null=True,blank=True) subsidary = models.CharField(max_length=155,null=True, blank=True) divison = models.CharField(max_length=155,null=True, blank=True) job_title = models.CharField(max_length=155,null=True, blank=True) tax_rate = models.FloatField(null=True,blank=True) hire_date = models.DateField(null=True,blank=True) terminiaton_date = models.DateField(null=True,blank=True) termination_reason = models.CharField(max_length=155, blank=True) rehire_date = models.DateField(null=True,blank=True) created_on = models.DateTimeField(auto_now_add=True) updated_on = models.DateTimeField(auto_now=True) updated_by = models.ForeignKey(settings.AUTH_USER_MODEL,on_delete=models.DO_NOTHING) class Meta: unique_together = ('client', 'payroll_ID',) def __str__(self): full_name = "Payroll ID: " + self.payroll_ID + ", " + self.first_name + " " + self.last_name return full_name Parent: class offer_eligibility(models.Model): offer = models.ForeignKey(offer,on_delete=models.CASCADE) employee = models.ForeignKey(employee,on_delete=models.CASCADE) amount_offered = models.PositiveBigIntegerField() created_on = models.DateTimeField(auto_now_add=True) updated_on = models.DateTimeField(auto_now=True) updated_by = models.ForeignKey(settings.AUTH_USER_MODEL,on_delete=models.DO_NOTHING) Any employee can have many offers. I'm trying to create a view that shows a list of employees who are in a selected offer and if they have any amount_offered. This requires me to first filter the offer_eligibility by the offer, I have this queryset. …