I'm implementing a search feature where I'm matching keys from the description. and also matching media if description and media type of
['mp4','mkv','mov','avi']match so the condition is satisfied.So I have tried many methods but didn't find an efficient way. to make it possible without for loop.
I want to use those together.
- description and media type
['mp4','mkv','mov','avi']
postinlang_queryset = PostInLanguages.objects.filter(description__contains=search_name) media_type_query_set = LanguageMedia.objects.filter(content_type__contains ['mp4','mkv','mov','avi'])- description and media type
filter queryset for multiple models in Django
97 Views Asked by Zain Jack At
1
There are 1 best solutions below
Related Questions in DJANGO
- Django Admin Panel and Sub URLs Returning 404 Error on Deployment
- How to return HTTP Get request response from models class in Django project
- Issue with Quantity Increment in Django E-commerce Cart
- Can't install Pipenv on Windows
- use dict from python in django html template and also in js
- 'pyodbc.Cursor' object has no attribute 'callproc', mssql with django
- Django socketio process
- Root path analogue in uWSGI as in Uvicorn
- Django - ModuleNotFoundError: No module named 'backend'
- Does Python being a loosely typed programming language make it less secure?
- sorl-thumbnail adds a background color when padding is used
- Can't connect to local postgresql server from my docker container
- Why ProductHunt api dont work with Python?
- why i have to put extra space in before write option selected because it show error if i don't ' option:selected'
- Django Arrayfield migration to cloud sql (Postgresql) not creating the column
Related Questions in DJANGO-REST-FRAMEWORK
- Django - ModuleNotFoundError: No module named 'backend'
- Cookie doesn't send different domain django and react
- "Troubleshooting Image Upload Failure: React-admin to Django REST Framework Backend"
- How to send Stripe session checkout parameters in subscription mode
- Deploy my Django rest framework app to Vercel
- Should i use GET or POST for request with body in DRF?
- KeyFeatures for Product implementation
- How to change status field automatically from 1 to 0 when end_time is reached
- DRF, corsheaders and SSL certificate error on deploy on VPS
- Taking field from another model in serializers
- Want to retrieve a Foreign Key value instead of the whole object with django-rest-framework serializers
- How to get Notification to admin Using Rest Api
- Request header field access-control-allow-origin is not allowed by Access-Control-Allow-Headers in preflight response, nginx, django, waitress
- Error creating auth token for newly registered user in Django Rest Framework
- fix django login bug
Related Questions in DJANGO-VIEWS
- use dict from python in django html template and also in js
- Django - ModuleNotFoundError: No module named 'backend'
- Error fetching the entry page through Django url path
- How can I get a comma separated list with related posts from a many-to-many field?
- I am experiencing a 404 error in the console on my django project
- Issue Passing Size Parameter from JavaScript to Django Backend
- Should i use GET or POST for request with body in DRF?
- My djanco configuration fail to download images but store them in the db without occuring any error
- MultipleObjects returned when selecting a choice and creating an object for it
- Unable to see text in the dropdown list
- KeyFeatures for Product implementation
- Always incorrect password in Django
- fix django login bug
- How to get an object for editing transfer to a form?
- Can't display page content in Django
Related Questions in DJANGO-QUERYSET
- django-tables2 sorting on custom column
- Django: how to annotate average of average?
- How to Implement in Annotate and Filter in Django
- Django join on a field that isn't the ForeignKey
- How to combine queries in django that span foreign key relationships?
- Django complex distinct based on timestamp
- Query using reverse relationship or objects manager?
- How to create alias for first active item in reverse relation in Django models?
- Django form error when queryset is changed to none or subset
- Create a queryset that automatically queries onetoone objects
- Django - how do I update the database with an expression of a field?
- Django taggit view leading to FieldError: Related Field got invalid lookup: name
- Getting 'QuerySet' object has no attribute 'append' when making a function that automatically add a certain value from a ManyToManyField in Django
- How to force evaluation of some annotated fields before others in Django with MySQL? And why does it seem to prevent a "Too many columns." error?
- Is it possible to annotate already united annoated querysets using Djnago ORM without raw SQL
Related Questions in DRF-QUERYSET
- Update existing data by django-rest-framework upload file
- Django: AttributeError - type object has no attribute '_meta'
- Filter queryset from filename field based on two words that appear one after the other Django
- Django order by pviot table column
- How to access QuerySet in Serializers.py
- request = self.context.get('request') , give me'NoneType' object has no attribute 'data'
- Why N+1 problem is enormous in DRF and how can I solve it?
- Count objects in queryset by value in a field
- Why the User has no attribute 'objects'
- Update only 2 field in DRF
- Django - Object of type User is not JSON serializable
- Why django-rest-framework is generating same api url for two views (both views having same queryset)?
- is it possible to avoid n+1 django query here? If so, how?
- filter queryset for multiple models in Django
- DRF multi fields base match filter queryset
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
yes, it's possible without for loop.Just follow the following script:
N.B:
content_type__in=['mp4','mkv','mov','avi']If we pass an empty list then it will never throw exceptions but return empty queryset