Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Not showing result, it is showing blank page
this is my views.py file ''' from django.shortcuts import render from django.views.generic import ListView, DetailView from .models import Product class ProductListView(ListView): queryset = Product.objects.all() template_name = "products/list.html" class ProductDetailView(ListView): queryset = Product.objects.all() template_name = "products/Detail.html" def get_context_data(self, *args, **kwargs): context = super(ProductDetailView, self).get_context_data(*args, **kwargs) print(context) return context ''' this is my details.html file ''' {{ object.title }} <br/> {{ object.description }} <br/> ''' while running this it is not showing any error but on a webpage it is not showing anything, it is literally empty -
Passing Query params in Django Class Based View
I'm trying to form a url like this, http://localhost:8000/mealplan/meals/search/2?from_date=2019-12-29&to_date=2019-12-30&from_time=06:00&to_time=22:00 This is what I tried in urls.py url(r'^meals/search/(?P<user_id>[\w.-]+)/(?P<from_time>[\w.-]+)/(?P<to_time>[\w.-]+)/(?P<from_date>[\w.-]+)/(?P<to_date>[\w.-]+)$', FilterMealList.as_view(), name='filter_meals'), Clearly this didn't work. Also this is my class based view. class FilterMealList(views.APIView): def get(self, request, **kwargs): try: from_time, to_time, from_date, to_date = kwargs.get('from_time'), kwargs.get('to_time'), kwargs.get( 'from_date'), kwargs.get('to_date') return Response({"Suceess": "{}, {}, {}, {}".format(from_time, to_time, from_date, to_date)}, status=status.HTTP_200_OK) except KeyError as e: return Response({"Failure": "Incomplete query params"}, status=status.HTTP_400_BAD_REQUEST) So my question, 1. How do I define an url to take query params in django? 2. How do I capture the params in my class based view? How can I create an url to take query params in django -
Get variable OneToOneField in Django
Lets say I have a model Form class Form(models.Model): name = models.TextField() date = models.DateField() and various "child" models class FormA(models.Model): form = models.OneToOneField(form, on_delete=models.CASCADE) property_a = models.TextField() class FormB(models.Model): form = models.OneToOneField(form, on_delete=models.CASCADE) property_b = models.IntegerField() class FormC(models.Model): form = models.OneToOneField(form, on_delete=models.CASCADE) property_c = models.BooleanField() a Form can be one AND ONLY ONE of 3 types of forms (FormA, FormB, FormC). Given a Query Set of Form, is there any way I can recover what types of Form (A, B or C) they are? -
TypeError: __str__ returned non-string (type UserProfile)
I was trying to build an inventory panel, Am not able to run save_model() in IssuedAdmin in admin.py I was trying to get the username of the person who has issued the item In InventoryIssued class : User represents the person who issued it. get_users is the list of all the users present in UserProfile models.py class InventoryIssued(models.Model): """Inventory Issued to person """ get_user_type = models.ForeignKey(RoleOfUser, on_delete=models.CASCADE) user = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, blank=True, on_delete=models.SET_NULL, ) get_users = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name = 'issued') item_name = models.ManyToManyField(InventoryPresent) date = models.DateField(auto_now_add = True) quantity = models.IntegerField(default = '1') status = [("APP","Approved"), ("DEC","Declined"),] item_status = models.CharField(choices = status, blank=False, max_length = 3) def __str__(self): return self.get_users class Meta: verbose_name_plural = 'Inventory Issued' class User_manager(BaseUserManager): def create_user(self, username, email, name, phone_number,password): email = self.normalize_email(email) user = self.model(username=username, email=email, name=name, phone_number=phone_number,) user.is_active = True user.set_password(password) user.save(using=self.db) return user def create_superuser(self, username, email, name, phone_number,password): user = self.create_user(username=username, email=email, name=name, phone_number=phone_number, password=password) user.is_superuser = True user.is_staff = True user.save(using=self._db) return user class UserProfile(PermissionsMixin, AbstractBaseUser): username = models.CharField(max_length=32, unique=True,) email = models.EmailField(max_length=32, unique=True,) name = models.CharField(max_length=32, blank=False,) user_type = models.ForeignKey( RoleOfUser, on_delete=models.CASCADE, null=True, blank=True) phone_number = PhoneField(unique=True, blank=False,) date_created = models.DateField(auto_now_add = True) is_active = models.BooleanField(default=False) is_superuser = models.BooleanField(default=False) … -
Is it possible to process a task at django-background-tasks without entering the command 'python manage.py process_tasks'?
Is it possible to process a task at django-background-tasks without the 'command python manage.py process_tasks'? my task needs start when the application starts but I don't want to enter a command to do it. Thanks in advance. -
heroku keeps installing django packages during each deployment
Im using django 3 and Python 3.7.4 I don't have any issues with the deployment and the project is working, it's just the first time I face this issue. Normally when deploying to Heroku all packages in the requirements file get installed during the first deployment process, and any further deployment will only update or install the new packages the get added. In my case, everytime I deploy, heroku is installing the whole packages again. Please advise if there is a way to handle this issue. thanks -
Django models, How to make two optional fields, but when one is filled, the other one must also be filled
So, I have created a model which has some attributes, but I want to focus on these two. class Profile(models.Model): RANK_OPTIONS = ( ('A', 'A'), ('B', 'B'), ) related_office = models.ForeignKey('OtherModule.office', related_name='office', on_delete=models.CASCADE ) rank = models.CharField(('rank'),max_length=1, choices=RANK_OPTIONS) Basically, I need these two attributes to be optional, but the moment the attribute "Rank" is filled, then the attribute related_office must also be filled. You can have a related_office and not a Rank, but the moment you have a Rank, you also need a related Office. how can I do that? -
How do i use slug urls correctly in Django?
Hello, i'm new to Django, and I'm trying to build a web site. at the admin page http://127.0.0.1:8000/admin/posts/post/ i added two posts, eatch one have a slug, the **first slug is first and the second one is second the problem is when i try to reach http://127.0.0.1:8000/posts/first or http://127.0.0.1:8000/posts/second it gives me a 404 error and it tells me** Using the URLconf defined in custom.urls, Django tried these URL patterns, in this order: admin/ posts/ [name='posts_list'] <slug> The current path, posts/first, didn't match any of these. this is models.py from django.db import models from django.conf import settings Create your models here. User = settings.AUTH_USER_MODEL class Author(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) email = models.EmailField() phone_num = models.IntegerField(("Phone number")) def __str__(self): return self.user.username class Post(models.Model): title = models.CharField(max_length=120) description = models.TextField() slug = models.SlugField() image = models.ImageField() author = models.OneToOneField(Author, on_delete=models.CASCADE) def __str__(self): return self.title this is views.py from django.shortcuts import render, get_object_or_404 from .models import Post # Create your views here. def posts_list(request): all_posts = Post.objects.all() return render(request, "posts/posts_list.html", context = {"all_posts": all_posts}) def posts_detail(request, slug): unique_slug = get_object_or_404(Post, slug = slug) return render(request, "posts/posts_detail.html", {"post": unique_slug}) this is the urls.py from django.contrib import admin from django.urls import path from posts.views … -
How to write this query using Django model class object filter
This is the working sql query. I wanted to use filter if possible. SELECT DISTINCT(B.country), A.lat, A.long, B.count from appuser_a as A,(SELECT DISTINCT(country),count(*) as count FROM `appuser_a` GROUP BY country) AS B WHERE A.country = B.country -
JavaScript & Stripe | PaymentMethods
I Have no experience with Javascript and I've been working on an integration with Stripe. I'm slowly able to learn how their code is working but need advice on how to get the result sent back with the form to go into my next function. Here is the old code that will work and sends back the 'token' for a single payment: var purchaseButton = document.getElementById('purchase-button'); purchaseButton.classList.add('is-loading'); stripe.createToken(card).then(function (result) { if (result.error) { // Inform the customer that there was an error. var errorElement = document.getElementById('card-errors'); errorElement.textContent = result.error.message; purchaseButton.classList.remove('is-loading'); } else { // Send the token to your server. stripeTokenHandler(result.token); } }); } }); function stripeTokenHandler(token) { // Insert the token ID into the form so it gets submitted to the server var form = document.getElementById('payment-form'); var hiddenInput = document.createElement('input'); hiddenInput.setAttribute('type', 'hidden'); hiddenInput.setAttribute('name', 'stripeToken'); hiddenInput.setAttribute('value', token.id); form.appendChild(hiddenInput); // Submit the form form.submit(); } This comes back with 'stripetoken' in post, I want to use my newer code below and get the same effect, but retrieving the result.paymentMethod described here: https://stripe.com/docs/js/payment_intents/create_payment_method Here is my newer code that is talking to stripe, I just need to get the resulting information for the call var purchaseButton = document.getElementById('purchase-button'); purchaseButton.classList.add('is-loading'); stripe.createPaymentMethod({ type: 'card', … -
I send my token, but still get an error :(
I send my token via ajax but still get an error Forbidden (CSRF cookie not set.): /main/create/ мой View.py # Create your views here. def main(request): if request.method == 'POST': # print(str(request.POST)) # print('I have a post!') markx = request.POST.get("coordx") marky = request.POST.get("coordy") markcoord.objects.create(xcord=markx, ycord=marky, city=City[0]) list_of_marks_cord = [] list_of_marks = [] else: allmarks = markcoord.objects.all() list_of_marks_cord = [] list_of_marks = [] for mark in allmarks: time = mark.timecreate.replace(tzinfo=None) dif = datetime.datetime.utcnow() - time # print(dif.total_seconds() // 3600) if dif.total_seconds() // 3600 >= 3: markcoord.objects.filter(id=mark.id).delete() else: list_of_marks_cord.append([mark.xcord, mark.ycord]) list_of_marks.append([mark.id, mark.hate_point, mark.like_point]) return render(request, 'index.html', {'marklist': list_of_marks, 'cord_List': list_of_marks_cord}) My main.js var myMap; var MyIconContentLayout; ymaps.ready(init); function getCookie(name) { var cookieValue = null; if (document.cookie && document.cookie !== '') { var cookies = document.cookie.split(';'); for (var i = 0; i < cookies.length; i++) { var cookie = jQuery.trim(cookies[i]); // Does this cookie string begin with the name we want? if (cookie.substring(0, name.length + 1) === (name + '=')) { cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); break; } } } return cookieValue; } var csrftoken = getCookie('csrftoken'); function place(coords) { var placemark = new ymaps.Placemark([coords[0], coords[1]], {iconContent: 'DPS'}, { iconLayout: 'default#image', // iconImageClipRect: [[0,0], [26, 47]], iconImageHref: 'static/img/metka.svg', iconImageSize: [30, 30], iconImageOffset: [-15, … -
How to combine two django model objects values in a single queryset
I need a queryset which should be combination of two model objects. Please look the code models.py class BudgetSubcategory(models.Model): sub_category = models.CharField( _("Sub Category"), max_length=255, default=False) sub_budget = models.DecimalField( _("Budget"), max_digits=15, decimal_places=2, default=Decimal('0.0000')) class BudgetActivity(models.Model): sub_category = models.ForeignKey(BudgetSubcategory, on_delete=models.CASCADE) activity = models.CharField( _("Activity"), max_length=255, default=False) cost = models.DecimalField( _("Cost"), max_digits=15, decimal_places=2, default=Decimal('0.0000')) in views I'm calling qs1 = BudgetActivity.objects.values('activity').annotate(budget_cost=Sum('cost')) qs2 = BudgetSubcategory.objects.values('sub_category').annotate( actual_cost=Sum('sub_budget')) q1 will be [{'activity': 'activity1', 'budget_cost': Decimal('300.00')}, {'activity': 'activity2', 'budget_cost': Decimal('2000.00')}] q2 will be [{'sub_category': 'sub_category1', 'actual_cost': Decimal('500.00')}, {'sub_category': 'sub_category2', 'actual_cost': Decimal('2300.00')}] But what I need is [{'sub_category': 'sub_category1', 'actual_cost': Decimal('500.00'), 'budget_cost': Decimal('300.00')}, {'sub_category': 'sub_category2', 'actual_cost': Decimal('2300.00'),'budget_cost': Decimal('2000.00')}] Please Help me regarding this issue -
Get every record but the first one that share 2 fields in common
So I have 2 models: WishList and Profile. GOAL: I would like to filter for all but the first WishList which shares the same product and Profile. Note: The first is determined by its timestamp models.py class Wishlist(BaseModel): class Product: TOYS = 't' CLOTHES = 'c' PRODUCT_CHOICES = ( (Product.TOYS, 'toys'), (Products.CLOTHES, 'clothes'), ) profile = models.ForeignKey(Profile) product = models.CharField(max_length=2, choices=PRODUCT_CHOICES, null=True, blank=True) timestamp = models.DateTimeField(db_index=True) class Profile(BaseModel): first_name = models.CharField(max_length=100) This is what I tried: ProductWaitlist.objects.values('profile', 'product').annotate(ids=ArrayAgg('id')) >>> [{'profile': 1424324, 'product': u'i', 'ids': [1, 40, 41]}, {'profile': 1423956, 'product': u'i', 'ids': [5, 3]}] From the result above, I would like to remove id 1 from the first group and id 5 from the second group. -
I get the following error when I attempt to create a Django superuser
I get the following error when I run: Python manage.py createsuperuser Traceback (most recent call last): File "/Users/project/env/lib/python3.7/site-packages/django/contrib/auth/password_validation.py", line 174, in __init__ with gzip.open(password_list_path, 'rt', encoding='utf-8') as f: File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/gzip.py", line 53, in open binary_file = GzipFile(filename, gz_mode, compresslevel) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/gzip.py", line 163, in __init__ fileobj = self.myfileobj = builtins.open(filename, mode or 'rb') FileNotFoundError: [Errno 2] No such file or directory: '/Users/project/env/lib/python3.7/site-packages/django/contrib/auth/common-passwords.txt.gz' -
Using django-rest-auth registration with multiple user types
I'm actually learning Django Rest Framework and I have this project that involves multiple user types so for example it consists of Students, Teachers and Admins each one with his attributes so I created a User model that inherits from AbstractUser and 3 other models for each type where each type has a foreign key of it's corresponding user. So here comes the problem how can I use Django-Rest-Auth library with these user types so for example when I use the register endpoint how can I modify it in order to create a Student in the students model based on the request data ? I would appreciate any ones help. Thanks in advance -
Djoser Add additonal functionality after user verification
After a user has clicked the link in their email to confirm their account, is there a way to add additional functionality on verification? -
How to send reset password token via a single link
I have a list of users in a ListView CBV and want to add a "reset password" link that will send an email with a reset password token to that user with one click (as the auth_views are currently set up to after you submit a request via a form). For example: <td>{{ user.email }}</td> <td><a href="{% url 'reset_link' user.pk %}">Reset password</a></td> I am using the CBV auth_views so know I could reset this user's password manually via redirecting to a form and using Django's inbuilt auth_views.PasswordResetView. However as I already have the user.pk I just want a link that instantly sends the relevant email. Is there a way to send the email using user.pk via a single link if I already know the pk? -
How to dynamically activate categories in main navigation as products are added to the category?
I am working on a site where users upload products. When the user uploads a product, they can currently select from about 50 categories. I would like to have all categories listed in my main navigation, however they won't all have products listed in the category in the early stages of the site. The ones that don't should not be linked and the text would be greyed out. The part that is confusing is how to manipulate the main nav via a view. All of my views are for specific pages, so I'm not sure how to have a view function that runs prior to each page's view function, sort of like a custom middleware in Node + Express routing. Or perhaps this is not Djangoic, and there is a better method to achieve this? Thanks for any tips. -
How can we change ModelForm instance before sending it to template as response?
I wonder if we can change the field values of instance of a ModelForm in Django view. For example, I have this: models.py class hotel(models.Model): image = models.ImageField(upload_to='hotel', verbose_name="Hotel Image") name = models.CharField(max_length=60) country = models.ForeignKey('country', on_delete=models.DO_NOTHING) state = models.ForeignKey('state', on_delete=models.DO_NOTHING) city = models.ForeignKey('city', on_delete=models.DO_NOTHING) def __str__(self): return self.name class Meta: verbose_name_plural = "hotels" class Hotel(ModelForm): class Meta: model = hotel fields = '__all__' views.py form = Hotel() Is it possible to modify the city, state and country fields of this form before I pass it to the Django template: return render(request, 'web/hotels.html', {'form':form}) I am trying to send empty values for state and country fields to the Django template. -
How to write and retrieve data from ManyToManyField inside overrided save() method?
I need to write any data to ManyToManyField via Model's form in the template, but i get an error like "... needs to have a value for field "id" before this many-to-many relationship can be used.". It shows when I try to use self.service("service" is my ManyToManyField) in my overrided save() method. I know that ManyToManyField is not basic field and it returns something like queryset, but how can i manipulate data inside save() method, because "self.service" doesn't work. # models.py class Appointments(models.Model): name = models.CharField(max_length=200, db_index=True, verbose_name='Имя, фамилия') tel = models.CharField(max_length=200, db_index=True, verbose_name='Номер телефона') e_mail = models.CharField(max_length=200, blank=True, db_index=True, verbose_name='E-mail') car = models.ForeignKey('Cars', null=True, on_delete=models.PROTECT, verbose_name='Тип автомобиля') num_car = models.CharField(max_length=200, null=True, db_index=True, verbose_name='Гос.номер автомобиля') **service = models.ManyToManyField(Services, verbose_name='Тип услуги')** date_created = models.DateTimeField(auto_now_add=True, db_index=True, verbose_name='Дата публикации заявки') date_service = models.DateField(db_index=True, verbose_name='Дата') time_service = models.TimeField(db_index=True, help_text="Введите время в таком формате: 15:00", verbose_name='Время') price = models.CharField(max_length=50, db_index=True, null=True, verbose_name='Цена') def save(self, *args, **kwargs): for i in Services_prices.objects.all(): ccar = i.car sservice = i.service for d in self.service: if self.car == ccar and d == sservice: self.price = i.price break elif ccar == None and d == sservice: self.price = i.price break super().save(*args, **kwargs) # forms.py class AppointmentForm(forms.ModelForm): service = forms.ModelMultipleChoiceField(queryset=Services.objects.all(), required=False, widget=forms.CheckboxSelectMultiple()) … -
VScode debugger throws an error but the django server starts successfully
I have been using VScode to build a django application for a few weeks now however one day the debugger started throwing errors and failing to start however, I am able to use python runserver to successfully start the application and interact with it without any error. the error message Performing system checks... SystemCheckError: System check identified some issues: ERRORS: courses.Course.thumbnail: (fields.E210) Cannot use ImageField because Pillow is not installed. HINT: Get Pillow at https://pypi.org/project/Pillow/ or run command "pip install Pillow". At first I thought I was indeed missing a package so I ran pip list and confirmed the package was actually downloaded result of pip list Django (2.2.7) django-cors-headers (3.2.0) djangorestframework (3.10.3) djangorestframework-jwt (1.11.0) dodgy (0.1.9) isort (4.3.21) lazy-object-proxy (1.4.3) mccabe (0.6.1) pep8-naming (0.4.1) Pillow (6.2.1) pip (9.0.1) pkg-resources (0.0.0) I have disabled every vscode extension except the python one, I have also deleted the .vscode folder and the debug congfigurations but still nothing. I have also ensured that I'm using the correct interpreter and still no luck. Has anyone experienced this before and how can I fix it. -
gunicorn worker booting interrupting python script
I have a Django application running in a Docker container with gunicorn that generates reports. I'm seeing an issue where it seems that when a new worker boots, it interrupts the Python script running in my Django application. For example, when generating the same report, I see in my Docker logs that gunicorn booted a new worker (but I don't see anything about a worker facing a critical timeout) and anything my script is supposed to do after (mainly, save the report and return to user) does not happen. Is it probable that this is an issue with gunicorn, or is it more likely something to do with Docker/Django? If it is a gunicorn issue, can it be fixed by increasing the timeout time or something different? Attempt 1 putting aq pandas to excel at Fri_Dec_20_2019_151807 styling cells at Fri_Dec_20_2019_151807 styling cells at Fri_Dec_20_2019_151808 [2019-12-20 15:19:06 +0000] [45] [INFO] Booting worker with pid: 45 Attempt 2 -- got one step further putting aq pandas to excel at Mon_Dec_30_2019_150212 styling cells at Mon_Dec_30_2019_150212 styling cells at Mon_Dec_30_2019_150213 end of write_xl function at Mon_Dec_30_2019_150213 [2019-12-30 15:03:18 +0000] [126] [INFO] Booting worker with pid: 126 -
Django: Count() in multiple annotate()
I have a Django project with ForumPost, ForumComment, ForumPostLike, ForumCommentLike models. Post has multiple comments, multiple forumpostlikes. Comment has multiple forumcommentlikes. Each user can only like a post or a comment once. What I want: I want to order posts by calculated = (num_comments*5 + num_postlikes + num_commentlikes) Questions: With the following code, It seems that I am getting what I wanted. But there are some weird behaviors of Count(). Also, I would like to know if there is a better way of achieving my goal. models.py class ForumPost(models.Model): # author, title .. etc. class ForumComment(models.Model): post = models.ForeignKey(ForumPost, on_delete=models.CASCADE, related_name='comments') #other fields class ForumPostLike(models.Model): liker = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name='liked_forumposts') post = models.ForeignKey(ForumPost, on_delete=models.CASCADE, related_name='forumpostlikes') class ForumCommentLike(models.Model): liker = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name='liked_forumcomments') comment = models.ForeignKey(ForumComment, on_delete=models.CASCADE, related_name='forumcommentlikes') views.py posts= ForumPost.objects.filter(published_date__lte=timezone.now()).\ prefetch_related('comments', 'forumpostlikes') posts_top = posts\ .annotate(num_commentlikes=Count('comments__forumcommentlikes__liker'))\ .annotate(num_postlikes=Count('forumpostlikes', distinct=True))\ .annotate(num_comments=Count('comments', distinct=True))\ .annotate(calculated=(F('num_comments')*Value(5)) + F('postlikes') +F('commentlikes')*Value(0.5))\ .order_by('-calculated') Weird behavior of Count(): annotate(num_commentlikes=Count('comments__forumcommentlikes__liker')) using this code, I wanted to get the total number of likes from all comments associated with the current post. But the result shows 2*correct number. Once I realized this, I multiplied this number with Value(0.5) to reflect correct number. If I use distinct as follow: annotate(num_commentlikes=Count('comments__forumcommentlikes__liker', distinct=True)) this code … -
Change function to Signal login
I want to run this function only when the user login. def purchased_today(self): check = Rating.objects.filter(user=self.user, book__collection=self.collection, score__lte=4).order_by('newest')[:50] a = check.count() today = datetime.now().strftime("%Y-%m-%d") if self.last_checked.date().strftime("%Y-%m-%d") != today: return a I tried it: @receiver(user_logged_in) def reviewd_today(sender, user, request, **kwargs): check = Rating.objects.filter(user=self.user, book__collection=self.collection, score__lte=4).order_by('newest')[:50] a = check.count() today = datetime.now().strftime("%Y-%m-%d") if self.last_checked.date().strftime("%Y-%m-%d") != today: return a But return: name 'self' is not defined. how can i replace the self? -
Django: finding overlaping dates into an especific range
i'm learning Django and i'm having a lot of fun :D I have an issue with finding an overlaping date range I have two models, reunion which have a range of dates and resource. class reunion(models.Model): resource = models.ForeignKey(resource, on_delete=models.CASCADE) start = models.DateTimeField() end = models.DateTimeField() title = models.CharField(max_length=100) And the resource model class resource (models.Model): site = models.ForeignKey(site, on_delete=models.CASCADE) name = models.CharField(max_length=60) def isAvaible(self, endDate, initialDate): try: self.reunion_set.get(Q(start__lt=endDate) | Q(end__gt=initialDate)) return False except: return True Ok, when i need to make a new reunion with an especific range of dates i need to find a non-overlaping resource so i use this method: def getAvaibleAccount(initialDate, endDate): avaibleResources = resource.objects.all() for avaibleResource in avaibleResources: if avaibleResource.isAvaible(initialDate,endDate): return avaibleResource return None But my code says that the date range: (12/30/2019 11:00 - 12/30/2019 12:00) overlaps with (12/31/2019 11:30 - 12/31/2019 12:30) as if just comparing time and not the date. i've searching a lot and not having luck... where is my error? i'm getting the dates as str and parsing it with dateutil.parser.parse()