I am trying to use selenium on django server (hosting with ssh, user permission). Os: FreeBSD 12.2-RELEASE amd64 display = Display(visible=False, size=(1325, 744)) display.start() opts = Options() opts.add_argument('--headless') import os path = os.path.abspath(os.getcwd()) driver = webdriver.Firefox(executable_path =path+"/geckodriver", options=opts) The …
I am building a small BlogApp and I build a feature of adding favorite users. User can search and add the user in his favorite users list I am now building a feature if searched user is already in another's …
I got this weird problem. I work with a PostgreSQL database. I made a model and form and migrated it, registered it in admin.py. When I am in the admin panel, I can add data to the form. One of …
I recently updated my DRF app from Django 2.1 to Django 3.1. But I keep receiving the error below when running the app. Before the upgrade the app was working fine. I'm using python version 3.9.0. Thanks in advance! …
I am trying to add to cart a single product, but i have been encountering a problem and now i am stucked, I have tried different ways, but none of them worked. Please help as I am trying to learn …
I have few db tables for practice i am converting complex sql queries to django orm queries This is sql code i am stucked in: "SELECT hla.`id`, CASE WHEN hla.`id` IS NULL THEN 'Not enabled' ELSE 'Enabled' END AS scv_user …
I've been trying to deploy my React/Django app on heroku for a while and I still can't fix the collect static error. I've seen and tried plenty of solutions but none of them seems to cut it for me. The …
When i hit submit, the signup page just refreshes itself and doesn't save the data in he User model. I confirmed it by visiting the admin site. Urls.py: from django.urls import path, include from . import views urlpatterns = [ …
I used this bootstrap code to insert a carousel in my django website homepage , but the local images just wont load , how ever if i use images from web apis like unsplash they load perfectly fine , or …
I'd like to return a custom value from my serializer. I'm getting authentication tokens for the user and would like to return them as part of the registration process. At the moment I'm returning the user object and I don't …
I'm trying to create a view that can save me multiple objects of the same type. with the code I wrote below it only creates an object with the data of the last compiled object, leaving out those above form.py …
В backend'е совсем новичок. По возможности опишите максимально подробно. Заранее Спасибо!
I have a project in Django Rest Framework (djangorestframework == 3.12. *) And I am now using drf-spectacular == 0.17.0 and I have an open api version 3.0.3. I need open api version 3.0.1. Tried to do so by downgrading …
I am implementing a custom Django user from scratch. Almost all things are working, but an issue arises when I create new user from the Django admin panel as follows. django.db.utils.IntegrityError: UNIQUE constraint failed: accounts_user.username Why does this error …
I'm trying to create a todoapp with google login to create personal todolist for each users. here's views.py from django.contrib.auth.decorators import login_required @login_required def todoView(request): all_todo_items = Todoitem.objects.filter(userid=request.user.id) return render(request, 'todoapp/home.html', {'all_items': all_todo_items}) def addTodo(request): add_new_item = Todoitem(content=request.POST['content']) add_new_item.save() return …
I want to make foreign key from auth_group_permissions table.(the M2M table between permission and group) I know that I can use through, but it isn't appropriate if I make modify in Django library. I used Django guardian …
I created a user with a password password123 but in the database the password field look like this pbkdf2_sha256$260000$rJZWVrYXlokRG8fGMS1fek$S7Dm9soflUsy0Q74CJP8sB60tgfRWuRPdqj5XL0DBV0= the problem: is when I create new user via rest framework i got the poassword feidl look like passsword123 …
I need to make object selections in my database by time interval currently i found a method to select only objects from a day but not from an interval with this: data.filter(end_at__day=datetime.datetime.now().day) I saw this on the …
I am having the following error in DRF ( Django Rest Framework ): Internal Server Error: /book/book/ Traceback (most recent call last): File "/home/divyessh/Desktop/Projects/club-booking/booking-new/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner response = get_response(request) File "/home/divyessh/Desktop/Projects/club-booking/booking-new/venv/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response response = wrapped_callback(request, …
I developed a django prject which uses social_auth (Google) for logins and when the user logs in to the website, their details (pre-stored in database) will be displayed to them and the user can select an option from a dropdown …
I want to only .xlsm files to be uploadable to the form.I tried a lot of thing according to this question. But did not work. I don't know why? How can I solve it? models.py from django.core.validators import FileExtensionValidator …
I'm working on Django project where I have to make a API. In my normal Django I have one functionality named Run , that I want to add that functionality in my API View Here's my model class Robot(models.Model): robot …
Hello I want to delete my field : tag_number = models.PositiveIntegerField('Tag number', validators=[ MinValueValidator(1), MaxValueValidator(MAX_TAG_NUMBER), ]) and write fo this method: # @require_POST def book_tag(request, pk): book = get_object_or_404(Book, pk=pk) book.tag_number = **book.tag_number.delete()** book.tag_number = book.generate_tag() book.save() return redirect('book:book-list') …
I am using a viewset.ModelViewSet to list, retrieve, update and delete Car objects. I have two urls: one ends with .as_view({'get': 'list'}) and other with .as_view({'get': 'retrieve'}), and latter one is used for updating and deleting a car object. Is …
I am looking for a best practice approach on how to compile translation files in Django. Currently the following is given: GitHub + POEditor Importing into POEditor is done with Webhooks, which works quite fine. Exporting is also done automatically, …
So I got a QuerySet result from an aggregate function to display in a low-spec eBay clone of mine. But my problem is displaying certain fields in the Django template as I want, for example, I want to display the …
I have a custom serializer to get tokens without a password for a user: class ObtainTokensWithoutPasswordSerializer(TokenObtainPairSerializer): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields['password'].required = False def validate(self, attrs): attrs.update({'password': ''}) return super(TokenObtainPairWithoutPasswordSerializer, self).validate(attrs) In my views I use it …
I'm having some issue with a django app and it's CSS file refreshing. Basically I can see that the changes I make in my file are identified and copied in the root folder of my website, however when I open …
I can't figure out for more than a week, I need to send an image to the Django server, but I get the error: 415 (Unsupported Media Type) If I change ContentType to multipart/form-data, I get: 400 (Bad Request) is …
My payload is in string form as below: payload= "[{"message":"message text", "id":1, "code":0}, {"message":"message text", "id":2, "code":1}, {"message":"message text", "id":3, "code":0}]" I am getting the pay load from query string. ex = https:\xyz.com\endpoint?payload=[{"message":"message text", "id":1, "code":0}, {"message":"message …
I want to get the body measurements through an image using pip library body_measurements. Is there any material related to this? I have seen openCV2 library for this thing but that does not my requirement.
How do I fetch like specific data I want to a django form. I know how to fetch the entire database to a table by using loops. But I want to fetch specific data according to what user select. At …
I am having a problem with Django forms. I am currently using the request.POST to validate the POST within views. I want to send inputed-data(radio type) from my template with the same name. In my template.py: <form method="post" action="{% url …
I'm using jazzmin for django admin and mptt. After adding mptt to admin, in jazzmin theme add button disappeared. I'm using latest versions of all libraries class CustomMPTTModelAdmin(MPTTModelAdmin): # specify pixel amount for this ModelAdmin only: mptt_level_indent = 30 admin.site.register(Menu, …
I create a virtual environment named djangoenv. I can run it with using cmd but I cannot in python terminal this is cmd picture and this is python terminal picture how can I run …
I'm having a problem debugging Django (main/4.0.dev20210730183450) projects in Pycharm (2021 CE) and following is my config I can run (by clicking the run button) the project with no problem; Server runs …
My Dockerfile FROM python:3 ENV PYTHONUNBUFFERED=1 WORKDIR /django COPY requirements.txt requirements.txt RUN pip install -r requirements.txt My docker-compose.yml version: '3' services: db: image: postgres volumes: - ./data/db:/var/lib/postgresql/data environment: - POSTGRES_DB=postgres - POSTGRES_USER=postgres - POSTGRES_PASSWORD=postgres container_name: postgres_db web: build: . …
I've setup a basic django app using scaffolding which creates all those nice admin panels for free. I want to expose a REST api so I've followed this tutorial to get it running and add JWT authentication …
Hello I have 1 question that i want to integrate my outlook with my django website that means if i send any email with website that also show me on my email's sent box. Can anyone help me to do …
Scenario: I want to make an app that has servers(500+) as a model and another model that has posts as a foreign key to the server model to log what we did on each server.So as I said I have …