Skip to content

Tag: django

Adding Variables to SQL queries

I have the following code which returns a table from my ms sql Database How would I add the one_yrs_ago variable to the SQL query in this situation , like so : Answer Not seeing the full context but this is how I would do it in SQL Server I would say parameterize what you pass in is important as

Array to string with Django and MySQL

I need to design SQL query in html on Django I have an array in my table like : When I call this array in my page : I have : [‘aa’, ‘bb’, ‘cc’] What do I do if I want : a b c I tried with .split(‘,’) but I’ve already ‘[]’ I tried with for item …

Two dependent conditions in exclude DJANGO

I want to check whether the current user already has the same movie id in his personal list or not. If he has it then I want to exclude that movie from my trending list. I want it to be something like this. views.py models.py Answer You can .exclude(…) with: If you specified a related_query_name=… [Django-doc…