Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Change label of ManyToMany Field django?
class PermissionForm(forms.ModelForm): class Meta: model = Group fields = ['permissions'] widgets = { 'permissions': forms.CheckboxSelectMultiple, } If I render the above form I get the output as: I need to show only the marked area(red color) as label.And one more for example,in the below image there is a accordion,I want to show permission of Group model under role tab and permission of organization model under organization tab.I don't have any idea how to start with -
No module named 'usersdjango', Could someone help me out?
I'm working with Django and I have a problem in running local server because of this error: No module named 'usersdjango' here's the $tree: [ |-- = folder ] learning_logs folder: |--django_venv |--learning_logs |--llog |--users manage.py urls.py in users folder: from django.urls import path,include app_name = 'users' urlpatterns = [ path('', include('django.contrib.auth.urls')), ] login.html in users folder: {% extends 'learning_logs/base.html' %} {% block content %} {% if form.errors %} <p> Your username and password diden't match. </p> {% endif %} <form action="{% url 'users:login'%}" method='post'> {% csrf_token %} {{form.as_p}} <button name='submit'>Log in</button> <input type='hidden' name='next' value="{% url 'learning_logs:index'%}" /> </form> {% endblock %} base.html in learning_logs(templates) folder: <p> <a href="{% url 'learning_logs:index' %}"> Learning_log </a> - <a href="{% url 'learning_logs:topics' %}"> Topics </a> - {% if user.is_authenticated%} Hello, {{user.username}} {% else %} <a href="{% url 'users:login'%}">Log in </a> {% endif %} </p> {% block content %}{% endblock %} -
FieldError: Cannot resolve keyword 'shopfavorite' into field
I'm using reverse foreignkey using django predefine function prefetch_related. but i'm getting the error: FieldError: Cannot resolve keyword 'shopfavorite' into field. . What is the exact issue? Any helpful, would be much appreciated. thank you so much in advance. models : class ShopOwnerShopDetails(models.Model): shop_name = models.CharField(max_length=80, blank=True, null=True) shop_location = models.CharField(max_length=200) class ShopFavorite(models.Model): shop_id = models.ForeignKey(ShopOwnerShopDetails, on_delete=models.CASCADE, related_name='favorite_shop_id') favorited_by = models.ForeignKey(User, on_delete=models.CASCADE, related_name='user_favorite_shop') views : queryset = ShopOwnerShopDetails.objects.filter(shopfavorite__favorited_by=user).prefetch_related('shopfavorite_set',) serializer = ShopOwnerShopDetailsSerializer(queryset, many=True, context={'request': request}) data = serializer.data -
Django does not filter by non english letters
In my database I have objects with slavic letters (śćę etc.). It is displayed correctly in my database, admin panel and even when I call my object in template. User can search for this object by providing what he wants in text input box: template.html <input type="text" class="form-control" placeholder="Model" name="searched_model" id="searched_model" value=""> Hovewer when I filter the objects database in my view: views.py found_products = ProductBase.objects.filter(Q(model__contains=searched_model).order_by('model') It filters and displays correctly until slavic letter is provided. For example, user wants object with model property as: ObjectŚĆobject If he writes in my search field object it will find and display ObjectŚĆobject. But if he writes objectŚ or even Ś only it will not show anything. My view returns found_products to template and displays it in table: template.html {% for item in found_products %} ... <td> {{item.model}} </td> I don't know where lies the problem. In settings.py I have correct LANGUAGE_CODE = 'pl-pl'. -
Access Multiple FIles Upload in Django
I am new to Django and I had created a form for uploading multiple files as well as some text values. Here are my files: forms.py class UploadFileForm(forms.Form): report_file = forms.FileField() data1_file = forms.FileField() data2_file = forms.FileField() year = forms.IntegerField() Name = forms.CharField(max_length=50) views.py def uploads(request): if request.method == 'POST': form = UploadFileForm(request.POST, request.FILES) process_data(<parameters>) # will accept all the form parameters but don't know how access the files individually. messages.info(request, "Success!" ) return HttpResponseRedirect('') else: form = UploadFileForm() return render(request, 'app/home.html', {'form': form}) I want to access all those files and file names along with the name and year from the view and pass it on to another function for data processing. Can you suggest ideas on how to achieve that? -
Docker + Django + Vue.js + Webpack how to properly configure nginx?
At the moment I have the following configuration, in which I get an error: Failed to load resource: the server responded with a status of 404 (Not Found) As I understand it, I entered the path incorrectly and nginx cannot give the build.js file, which is missing from this path. How can I properly configure nginx so that it serves this file. Config nginx: upstream music { server web:8000; } server { listen 80; server_name ***; access_log /var/log/nginx/logs.log; location /vue-frontend/ { root /home/app/web/vue-frontend/dist; } location / { proxy_pass http://music; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; proxy_redirect off; } location /staticfiles/ { root /home/app/web; } location /media/ { root /home/app/web; } } The entire vue js project lies in the django project folder. Vue is embedded in the django template along the templates / base.html path {% load static %} <!DOCTYPE html> <html lang="en"> <head> {% load render_bundle from webpack_loader %} </head> <body> <div class="main_content"> <div id="app"></div> {% render_bundle 'main' %} </div> </body> </html> file docker-compose.prod.yml: version: "3.8" services: web: build: context: ./ dockerfile: Dockerfile.prod command: gunicorn music.wsgi:application --bind 0.0.0.0:8000 volumes: - static_volume:/home/app/web/static - media_volume:/home/app/web/media expose: - 8000 env_file: - ./.env.prod depends_on: - db vue: build: context: ./vue-frontend dockerfile: Dockerfile.prod volumes: … -
Reverse for 'program-details' with keyword arguments '{'slug': ''}' not found. 1 pattern(s) tried: ['program\\-details/(?P<slug>[^/]+)/$']
What's wrong with my code i got this error enter image description here urls.py enter image description here views.py enter image description here program.html (template) enter image description here models.py enter image description here -
Calling an External API That Fails Randomly
I am using Django server to call a Korean government's weather API to retrieve weather data for around 1800 locations. However, this weather API results in time out most of the time. I tried giving resting periods. For example, for every request, it will sleep for 0.8 seconds and after every 30 requests, it will sleep for 30 seconds. But this does not really work well for 1800 requests. At one point, it was successful. All other times, it ended up with fail. In this kind of situation, what else should I do to make sure that 1800 requests are completed within one hour? Is there any way for this to restart the request sequence from the exact point it failed previously? For someone who is curious about what this code looks like, I am posting it below: class WeatherCreate(View): def get(self, request): today = date.today().strftime("%Y%m%d") today = str(today) current_time = datetime.now(pytz.timezone('Asia/Seoul')).strftime('%H') current_time = str(current_time) + "00" current_time = "1100" print(current_time) if current_time not in ("0200", "0500", "0800", "1100", "1400", "1700", "2000", "2300"): return JsonResponse(data={"message": "DATA IS NOT AVAILABLE AT THIS TIME. TRY AGAIN LATER."}, status=406) # Call every single distinct address addresses = Address.objects.all() locations = [address.location for address … -
Migrate Laravel User and Password table to Django
I just want to know how can i migrate the users and passwords that is made with laravel 5.8 to a fresh django application. i searched for some answers how to decrpyt the password back to plain text so i can encrypt/hash the password to the technology that django uses. if you have different approach just reply to the thread. Thank you. -
How safe is a deployed Django app (with login only)?
I am about to deploy my first Django app. The plan is to push the locally running Docker container somehow to Google Cloud Run and now I wonder how safe my data will be then. I am aware of the Deployment checklist and I read the Security chapter in Django for Professionals. In my case, the whole app is accessible for logged in users only and, for the beginning, only a couple of trustworthy people will have an account. My assumption is, that – even if inside the app something should be not perfectly secure yet (let's say I forgot a csrf_token) – only logged in users could do any harm. Is this assumption too naive? So I have to make sure that everybody has a strong password and I should install some protection against fraudulent login by brute force password guessing, right? Is there anything else I have to consider? -
UnreadablePostError, partial results are valid but processing is incomplete
I'm getting this error continuously (in my server) and the server is getting down at the time of this. Please advise solving the issue. I've seen some suggestions like 'it is due to an incomplete request to the server', but no one suggested a real solution for this. -
gettin bad request on tests using django rest framework
I'm learning django rest framework and I'm trying and a test get me a bit nervous, so if someone can help me I would appreciate my tests.py file: def test_post_method(self): url = '/arvores/' self.especie = Especies.objects.create(descricao='Citrus aurantium') data = {'descricao':'Laranjeira', 'especie':self.especie.id, 'idade':12} response = self.client.post(url, data, format='json') self.assertEqual(response.status_code, status.HTTP_201_CREATED) my views.py file: class EspeciesViewSet(viewsets.ModelViewSet): queryset = Especies.objects.all() serializer_class = EspeciesSerializer class ArvoresViewSet(viewsets.ModelViewSet): queryset = Arvores.objects.all() serializer_class = ArvoresSerializer serializer.py file: class EspeciesSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Especies fields = ['id', 'descricao'] class ArvoresSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Arvores fields = ['id','especies', 'descricao', 'idade'] and models.py : class Especies(models.Model): descricao = models.CharField(verbose_name='Descrição', max_length=255) class Arvores(models.Model): especies = models.ForeignKey(Especies, on_delete=models.CASCADE) descricao = models.CharField(verbose_name='Descrição', max_length=255) idade = models.PositiveSmallIntegerField() -
ModuleNotFoundError: No module named 'mysite' when try to call django-admin
when I run the command django-admin collectstatic in terminal this error is appear! ModuleNotFoundError: No module named 'mysite' The folders structure myProject | +----mysite | | | +----settings.py | +----wsgi.py | +----urls.py | | +----todo (app) | +----accounts(app) | +----myvenv setting.py BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) WSGI_APPLICATION = 'mysite.wsgi.application' wsgi.py import os from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings') application = get_wsgi_application() even when I run '''django-admin''' the error of No module named 'mysite' appears at the end of the list django-admin commands help Type 'django-admin help <subcommand>' for help on a specific subcommand. Available subcommands: [django] check compilemessages createcachetable dbshell diffsettings dumpdata flush inspectdb loaddata makemessages makemigrations migrate runserver sendtestemail shell showmigrations sqlflush sqlmigrate sqlsequencereset squashmigrations startapp startproject test testserver Note that only Django core commands are listed as settings are not properly configured (error: No module named 'mysite'). -
Problems while adding images with Django summenote
I succesfully added summernote to my admin site for a blog, however, when I add an image to a post directly via Image URL address it occupies the "Read more" button. (Picture related: Error when trying to render the page.) However this does not happen when uploading the picture directly from my computer. I'm sure it has something to do with the HTML autoescaping, but I relatively new at this and I dont know how to debug it. The HTML I used is the following: <div class="col-md-8 mt-3 left"> {% for post in post_list %} {% autoescape off %} <div class="card mb-4"> <div class="card-body"> <h2 class="card-title">{{ post.title }}</h2> <p class="card-text text-muted h6">{{ post.author }} | {{ post.created_on}} </p> <p class="card-text">{{post.content|slice:":200" }}</p> {% endautoescape %} <a href="{% url 'post_detail' post.slug %}" class="btn btn-primary">Read more &rarr;</a> </div> </div> {% endfor %} </div> -
Python-Django Trying to Add Users to my Database
I'm new to Django and I'm trying to create a page that allows users to register to my website. But I keep getting a page not found error. Using the URLconf defined in myapp.urls, Django tried these URL patterns, in this order: 1. admin/ 2. home [name='home'] 3. account/ register/ [name='register'] The current path, account/register/register, didn't match any of these. Here's the code inside my html file 'register.html': <form action = 'register' method = "POST"> {% csrf_token %} <input type='text' name='first_name' placeholder = "First Name"><br> <input type='text' name='last_name' placeholder = "Last Name"><br> <input type='text' name='username' placeholder = "Username"><br> <input type='password' name='password' placeholder = "Password"><br> <input type='Submit' placeholder='Submit'> </form> And here's the code inside 'myapp.views': from django.shortcuts import render, redirect from django.contrib.auth.models import User, auth def register(request): if request.method == 'POST': first = request.POST['first_name'] last = request.POST['last_name'] usern = request.POST['username'] passw = request.POST['password'] user = User.objects.create_user(first_name = first, last_name = last, username = usern, password = passw) user.save() return redirect('/home') else: return render(request, 'register.html') Why doesn't it create a new user in my database and redirect to '/home', and instead go to 'account/register/register'? Thanks in advance. -
URL keyword argument named "user". Fix your URL conf, or set the `.lookup_field` attribute on the view correctly
I am getting AssertionError in articledetails view. I am getting bellow error AssertionError: Expected view ArticleDetailView to be called with a URL keyword argument named "user". Fix your URL conf, or set the `.lookup_field` attribute on the view correctly. I want to use RetrieveAPIView to Used for read-only endpoints to represent a single model instance. Where I did wrong? And what is the correct way to fix this? below is my view.py file class ArticleDetailView(RetrieveAPIView): serializer_class = ArticleDetailSerial permission_classes = [permissions.AllowAny] lookup_field = 'user' queryset = ArticleDetail.objects.all() def get(self, request, *args, **kwargs): return self.retrieve(request, *args, **kwargs) def retrieve(self, request, *args, **kwargs): instance = self.get_object() # here the object is retrieved serializer = self.get_serializer(instance) return Response(serializer.data) def get_object(self): """ Returns the object the view is displaying. You may want to override this if you need to provide non-standard queryset lookups. Eg if objects are referenced using multiple keyword arguments in the url conf. """ queryset = self.filter_queryset(self.get_queryset()) # Perform the lookup filtering. lookup_url_kwarg = self.lookup_url_kwarg or self.lookup_field assert lookup_url_kwarg in self.kwargs, ( 'Expected view %s to be called with a URL keyword argument ' 'named "%s". Fix your URL conf, or set the `.lookup_field` ' 'attribute on the view correctly.' % … -
Django websocket: Exception inside application: object.__init__() takes no parameters
everyone. I just moved my django project from my former server to my new server. When I tried to run websocket, It returns "Django websocket: Exception inside application: object.init() takes no parameters". But when I went back to my former server to run the project, it was running without any error. Does anyone know the problem it might be? BTW, the django version is 3.1.3 in my new server and 3.1.2 in the former server. Others are the same. detailed error info: WebSocket HANDSHAKING /webssh/ [218.88.113.148:60549] Exception inside application: object.__init__() takes no parameters Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/channels/routing.py", line 71, in __call__ return await application(scope, receive, send) File "/usr/local/lib/python3.6/dist-packages/channels/sessions.py", line 47, in __call__ return await self.inner(dict(scope, cookies=cookies), receive, send) File "/usr/local/lib/python3.6/dist-packages/channels/sessions.py", line 172, in __call__ return await self.inner(self.scope, receive, self.send) File "/usr/local/lib/python3.6/dist-packages/channels/auth.py", line 181, in __call__ return await super().__call__(scope, receive, send) File "/usr/local/lib/python3.6/dist-packages/channels/middleware.py", line 26, in __call__ return await self.inner(scope, receive, send) File "/usr/local/lib/python3.6/dist-packages/channels/routing.py", line 160, in __call__ send, File "/usr/local/lib/python3.6/dist-packages/asgiref/compatibility.py", line 33, in new_application instance = application(scope) File "/usr/local/lib/python3.6/dist-packages/channels/generic/websocket.py", line 23, in __init__ super().__init__(*args, **kwargs) TypeError: object.__init__() takes no parameters -
Custom URLs/routes API with Django Rest Framework
I'm trying to make an api according to the teachings of the course, but it is difficult, because I can't customize the urls, it is possible to explain how you do this in the image: Basically I'm trying to pass the plate through the url, but I can only pass the id = ( I wanted that when accessing parking it showed only the license plate and when accessing / parking /: plate it showed the details of the car. But so hard to do something along these lines that I no longer know who to look for. I need help to learn this. Can you just guide me in some way? Thanks! Somebody help me. Almost 1 month trying and nothing 🥺 My code is this, please help me! https://github.com/eltonsantos/parking_control -
Django inline formset won't validate
This is the first time I am using formsets, and it won't validate for some reason. As I understand it, all form fields need to be non-empty for the form to validate. Are there any other conditions? What could be wrong, there are no error messages, the call to formset.is_valid just returns false when I'm expecting it to be true. views.py PhraseMatchFormset = inlineformset_factory(parent_model=Exercise, model=ExercisePhraseMatch, fields=( 'is_active', 'givenPhrase', 'matchPhrase'), extra=4, can_delete=True) formset = PhraseMatchFormset( instance=exercise, initial=initial_dict) if formset.is_valid(): formset.save() Validation function is_valid() is always returning false for some reason. initial_dict output [{'id_exercisephrasematch-TOTAL_FORMS': '4', 'id_exercisephrasematch-INITIAL_FORMS': '0', 'id_exercisephrasematch-MIN_NUM_FORMS': '0', 'id_exercisephrasematch-MAX_NUM_FORMS': '1000', 'id_exercisephrasematch-0-is_active': 'on', 'id_exercisephrasematch-0-givenPhrase': 'oih', 'id_exercisephrasematch-0-matchPhrase': 'buhip', 'id_exercisephrasematch-0-DELETE': 'off', 'id_exercisephrasematch-1-is_active': 'on', 'id_exercisephrasematch-1-givenPhrase': 'oih', 'id_exercisephrasematch-1-matchPhrase': 'biuo', 'id_exercisephrasematch-1-DELETE': 'off', 'id_exercisephrasematch-2-is_active': 'on', 'id_exercisephrasematch-2-givenPhrase': 'uiygv', 'id_exercisephrasematch-2-matchPhrase': 'vyui', 'id_exercisephrasematch-2-DELETE': 'off', 'id_exercisephrasematch-3-is_active': 'on', 'id_exercisephrasematch-3-givenPhrase': 'uyv', 'id_exercisephrasematch-3-matchPhrase': 'vuy', 'id_exercisephrasematch-3-DELETE': 'off'}] models.py class ExercisePhraseMatch(models.Model): exercise = models.ForeignKey(Exercise, default=1, on_delete=models.CASCADE) course = models.CharField( default='', max_length=255, verbose_name="Course Name") lesson = models.CharField( default='', max_length=255, verbose_name="Lesson Name") sequence = models.IntegerField( default=1, verbose_name='Sequence') is_active = models.BooleanField( default=True, verbose_name='Active') givenPhrase = models.CharField( default='', max_length=255, verbose_name="Given Phrase") matchPhrase = models.CharField( default='', max_length=255, verbose_name="Match Phrase") def __str__(self): return('course: ' + self.course + ' lesson: ' + self.lesson + ' exercise no. ' + self.sequence) -
GCP Kubernetes Ingress Unhealthy Service failing
I have a deployment, service, and ingress for a Django application in Google Cloud Kubernetes. When I apply all configuration, ingress fails because the Django service is unhealthy. Below is the configuration. My Django app returns status 200 on "/"; however, when I swapped my image with another, ingress worked fine. So it seems it could be my image which uses Gunicorn, but I can't seem to solve the issue. See the code examples below. Thank you a lot! Django routes # urls.py def index(request): html = "<html><body><h1>API</h1></body></html>" return HttpResponse(html) urlpatterns = [ path('', index), ] Dockerfile FROM python:3.8-slim ENV APP_HOME /app WORKDIR $APP_HOME # Install dependencies. COPY requirements.txt . RUN pip install -r requirements.txt # Copy local code to the container image. COPY ./api . ENV PYTHONUNBUFFERED TRUE k8 deployment # Deployment apiVersion: apps/v1 kind: Deployment metadata: labels: app: api name: api spec: replicas: 1 selector: matchLabels: app: api template: metadata: labels: app: api name: api spec: containers: - name: api image: gcr.io/xxxxx/django-api ports: - containerPort: 8080 protocol: TCP imagePullPolicy: Always command: [ "gunicorn", "--workers", "3", "--bind", ":8080", "--log-level", "INFO", "--timeout", "90", "api.wsgi:application" ] resources: limits: cpu: 50m memory: 2048Mi requests: cpu: 50m memory: 2048Mi k8 service apiVersion: v1 … -
AttributeError: module 'main.views' has no attribute 'home'
I'm making a django project and whenever I run "python manage.py runserver". I see the above error. views.py > from django.shortcuts import render from django.http import HttpResponse from .models import ToDoList, Item Create your views here. def index(response, id): ls = ToDoList.objects.get(id=id) return render(response, "main/base.html", {}) def home(response): return render(response, "main/home.html", {}) main/url.py from django.urls import path from main import views from . import views urlpatterns = [ path("<int:id>", views.index, name="index"), path("", views.home, name="home") ] mysite/url.py from django.contrib import admin from django.urls import path, include urlpatterns = [ path('admin/', admin.site.urls), path('', include("main.urls")), ] Thank you for the help. -
django select related with 3 tables
i have 3 models in django like this: class SlackConfigurationMode(models.Model): MODES = ( ("NORMAL", "normal"), ("ALERT", "alert"), ("DANGER", "danger") ) mode = models.CharField(choices=MODES, default=MODES[0][0], max_length=20) time_send_slack_notification_minute = models.IntegerField(default=0) time_send_slack_notification_hour = models.IntegerField(default=0) description = models.TextField(blank=True) class WebHookConfiguration(models.Model): webhook_url = models.CharField(max_length=100) slack_configuration_mode = models.ForeignKey( SlackConfigurationMode, on_delete=models.CASCADE, related_name='webhook_configurations' ) class MonitorSource(models.Model): TYPES = ( ("FACEBOOK", "facebook"), ("WEBSITE", "website"), ("YOUTUBE", "youtube") ) target = models.CharField(max_length=100) type = models.CharField(choices=TYPES, max_length=20) created_at = models.DateTimeField(auto_now_add=True) owner = models.ForeignKey("auth.User", on_delete=models.CASCADE) name = models.CharField(max_length=100) slack_configuration = models.ForeignKey( SlackConfigurationMode, on_delete=models.DO_NOTHING, default=SlackConfigurationMode.objects.filter(mode="NORMAL")[0].id, related_name='monitor_sources' ) i want to get data of webhook_configuration and monitorsource filter by slackconfiguration by mode i use this query: queryset = SlackConfigurationMode.objects.select_related('webhook_configurations', 'monitor_sources').filter( mode='HIGH' ) but have the error: Invalid field name(s) given in select_related: 'monitor_sources', 'webhook_configurations'. Choices are: (none) how can i fix it, and why my query won't work, tks -
Using geodesic in annotate in djnago
I tried to use geodesic in annotate in django to order the fields in model as per distance.Here is my code; from geopy.distance import geodesic from django.db.models import F origin = (some_lat, some_lng) result = model.objects.annotate(distance=geodesic(origin, (F("latitude"), F("longitude"))).kilometers).order_by('distance') #where latitude and longitude are float fields in my model. But it shows an error; TypeError at /tac float() argument must be a string or a number, not 'F' How to do it correctly or is it annotate which doesn't support geodesic. -
No module named 'XXXXXXXX' in Django Heroku deployment
I am looking to make my first HEROKU deploy for django app. I get the following error: Traceback (most recent call last) File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker worker.init_process() File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/workers/base.py", line 119, in init_process self.load_wsgi() File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi self.wsgi = self.app.wsgi() File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi self.callable = self.load() File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load return self.load_wsgiapp() File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp return util.import_app(self.app_uri) File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/util.py", line 358, in import_app mod = importlib.import_module(module) File "/app/.heroku/python/lib/python3.7/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level File "<frozen importlib._bootstrap>", line 1006, in _gcd_import File "<frozen importlib._bootstrap>", line 983, in _find_and_load File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "<frozen importlib._bootstrap>", line 1006, in _gcd_import File "<frozen importlib._bootstrap>", line 983, in _find_and_load File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked ModuleNotFoundError at=error code=H10 desc="App crashed" method=GET path="/" host=temporalworld.herokuapp.com request_id=facb0a69-8362-4cea-99b1-152866e0487b fwd="146.112.251.213" dyno= connect= service= status=503 bytes= protocol=http looks like i am missing a module. Is anybody familiar with this please? -
How to filter data transaction in created_at > 15 minutes django
How to filter data transaction in created_at > 15 minutes django time_filter = datetime.datetime.now() - timedelta(minutes=15) transaction = Transaction.objects.using(apps).filter( created_at__lte=time_filter, payment_progress__in=['BO', 'ST', 'SC'], email_status__isnull=True ).order_by('-id')[:100]