I want to go to a users page and see the their photos, so I was trying to get the objects assigned to a foreign key, but I keep getting the error above AttributeError at /user/30/ ‘QuerySet’ object has no attribute ‘file’. I feel like the problem is in my syntax, but I really have no c…
Tag: python
django charfield not showing in admin panel
i create a model in django and register it in admin.py when i go to admin panel it shows the model but when i want to create object it doesn’t show the charfields and i can just create the oject without any details this is my codes below view.py model.py stting.py admin.py this screenshot is from my adm…
How to calculate time to load URl in selenium python automation
I have a selenium python automation test, which calculates Response time and adds it to JSON report. The problem is the code that I have calculates response time as before opening the URL and after it stops the test. I want to calculate the time it takes to load the URL page. following is my code test_screens…
How to find contours in dotted text captcha image
I am newbie to OpenCV. I’m trying to find the contours of the captcha image. It does not work only when my captcha image contains the dotted text. I have done following code for that: Can anyone help in this? Is there any way to find contours in this image? Answer Here is my code and output
Search Email Of Last N Minutes Using IMAP-TOOLS
The following code uses IMAP to log into an Outlook email and checks the contents of the Junk folder. It returns the content of the last unseen email with subject “Title”. I would like to add one thing to the source code. Is it possible to get the last email of for example the last 10 minutes? So …
How can i get the number of an image of a certain sprite in pygame
I randomly share pictures of houses on the screen. Then I drive a car across the screen.When the car hits a house, the image of that house should be replaced with a modified copy of that house. I distribute the images with the following function I check the collision car with house …. How do I then get …
How do I filter a Django Model by month or year from a JSON dict?
I am trying to parse through a JSON database and filter by month or by year using Django and this is driving me up a wall since this should be simple. An example of the dict key value pair in the JSON object is formatted as so: From my views.py file, I set up this function to filter the model:
Extracting data from Django Queryset and inserting into a Python list
I am trying to get one column of data from a Django model into a python list for further processing the in Django view. I have successfully created a simple Django model and populated the data. The fields are: “id”, “x_coord”, “y_coord”. I have run a few commands to extract…
running python script with argparser
Trying to run my script using argparser, where the program does not run, unless correct argument is in place, however it does not seem to work; Also when the –sync arg is given it ask for another, then when I add one more argument. SYNC, then it returns attribute error. Edit Trying to make the program r…
cv2 creates a unreadable .mp4v (and .avi) file
I’m trying to create a simple screen recorder with Python. This is the code It doesn’t give any error while it’s going, and it creates a .mp4v file correctly, however when I try to watch the video that was supposed to be recorded, it can’t be opened. I tried with VLC and other apps but…