As I attempt to launch a Django application on Google App Engine, I am faced with numerous errors along the way. I first tested out this example: https://github.com/GoogleCloudPlatform/appengine-django-skeleton, only to encounter the error: ImportError: ...
I have a unique vision: I want to create posts with different authors in separate models def post_creation(request): author, initiated = Author.objects.get_or_create(name=request.user.username) form = CreationForm(request.POST or None , request.FILES or ...
I am encountering a JSONDecodeError when attempting to send a POST request from AJAX to Django's views.py. The POST request sends an array of JSON data which will be used to create a model. I would greatly appreciate any helpful hints. Error: Exception T ...
I have set up an API using Django-REST Framework and am currently working on connecting it to my frontend. One of the endpoints I created retrieves the last four winners, and when I test it, everything seems to be functioning properly. async function getL ...
Each time an ajax request is made, the page should refresh without clearing all form fields upon loading Custom Form <form method='post'> <input type='text' placeholder='product'/> <input type='number' placeholder='cost'/> <input ...
I have been working on creating a model form using django-crispy-forms for Django 1.8.4 and django-crispy-forms-1.5.2. I am facing some challenges in modifying the form tag attributes. Even after trying to set self.helper.form_tag = False, the <form> ...
Currently, I am attempting to securely store my SECRET_KEY in an environment variable: # settings/base.py def get_env_variable(var_name): """ Retrieve the environment variable or return an exception """ try: return os.environ[var_name] ...
In my development setup, I am utilizing a Django backend with a VueJS frontend, serving a REST API through Django and using VueJS along with vue-router for the single page application. After reading up on this on Stack Overflow, I found a helpful suggesti ...
It might seem unconventional, but I'm attempting to utilize a primary key (pk) in a success function to generate a href for loading. The pk will be new and generated by the save() method. What I would like to know is how to send the self.pk pack to the ja ...
I am encountering an issue with my Django web application. Users are able to upload images successfully, but for some reason the URLs of these images are not being set properly when stored in Azure Cloud Storage. As a result, when I try to display these im ...
Embarking on my journey with django-cms, I set out to install the CMS following the official documentation. After creating a virtual environment and installing Django and django-cms, I moved on to the next steps which involved using django-admin to create ...
I am a novice and I want the form to be autofilled when I select a vehicle ID from the template. Here are my models. class Fuel(models.Model): vehicle = models.ForeignKey(Vehicle, on_delete=models.CASCADE) previous_km = models.IntegerField(blank=False, nul ...
Here is a concise snippet of code I have for retrieving or creating a conversation for the current user: c, created = Conversation.objects.get_or_create( message__sender=request.user, content_type=get_content_type(request.POST['ct']), ...
Currently working on a Django project, I have a test case that inherits from django.test.LiveSeverTestCase and utilizes Selenium: from django.test import LiveServerTestCase from selenium.webdriver.chrome.webdriver import WebDriver class FrontEndTestCase(L ...
I want to make variables from my settings.py accessible in all JavaScript code used throughout my project. What is the best way to accomplish this elegantly? Currently, I am considering two options: Create a context processor and define these globals ...
I am attempting to retrieve data in JSON format. I have a ManyToMany field that is only returning the ID, but I also need the contents of it. Below is my models.py: class Pricing(models.Model): name = models.CharField(max_length = 100) price = mod ...
My goal is to develop a basic API using the django rest framework. The code in my view looks like this: from django.shortcuts import render from moviestash.models import Movie from moviestash.serializer import MovieSerializer from rest_framework impor ...
Greetings fellow Django beginners! I know this question has been asked before, but I'm having trouble finding a solution that fits my specific situation. Here's the issue: I have a Form with a choice field that gets its options from the databas ...
Despite having all the static files in place, only the plain HTML loads without any styles for some unknown reason. I've attempted using collectstatic and even setting up a new project, but to no avail. STATIC_URL is also properly specified along with ...
Recently, I decided to try out a demo of django-dash through this link: https://github.com/barseghyanartur/django-dash. To set up the demo, I had to manually install all the necessary dependencies for django-dash due to some issues with my work computer a ...
I am currently working on uploading a file from an AngularJS 1.6.5 application to a Django server. However, I am facing some challenges with the 'Content-Type' header that needs to be passed along with the $http.patch method. Here is how my Angular app's c ...
When utilizing FormHelper and invoking the Form using {% crispy form %}, it generates a Form wrapped within <form> tags. However, my Template is structured into two columns. The first column displays the dynamically generated {% crispy form %}. The ...
Recently, I encountered a scenario with my Django form setup that involves using a simple form structure like this: class ContactForm(forms.Form): subject = forms.CharField(max_length=100) message = forms.CharField(widget=forms.Textarea) In my vi ...
I have a database with data from 1931 to yesterday. I am using Python Django models to retrieve the data and display it using Highstock. The chart only shows data for specific 15 days on the x-axis and the range selector is not functioning properly. Below ...
I am currently seeking a method to seamlessly insert an image within the text of my Django-powered blog. My goal is to achieve a layout similar to the one showcased in this example: https://i.stack.imgur.com/cFKgG.png The desired layout consists of two c ...
I am currently working on a table that is being populated with user details and I would like to include a Django URL tag within the row, extracting the primary key in the process. Here is an example of what I am trying to achieve: function putTableData(re ...
My task requires pulling data from multiple datasources which can be time-consuming. To enhance user experience, I want to provide real-time information about the progress by displaying messages like "Currently retrieving data from table1" and "Now fetchin ...
Every time I try to log out, this error message pops up: https://i.stack.imgur.com/whRMU.png This is what my html looks like: https://i.stack.imgur.com/QtUTf.png Here's the code in views.py : https://i.stack.imgur.com/Yscb2.png And here's the code in ...
I'm having trouble displaying images in my Django template file. Despite uploading the images to media static files, they do not appear on the template. When I click on the image link in the Django admin page, it shows a "Page not found(404)" error message ...
Trying to implement AJAX in my Django app to validate the existence of a username and display an error message if necessary. Below is the code snippet: HTML: <form method="post" id='my_form'> {% csrf_token %} <input id='username' type="t ...
The code run Here is the HTML document: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Register</title> <!--javascript extensions--> <script src='../st ...
I recently developed a straightforward API for Tax Analysis by processing a ZIP file received from our supplier using the FastAPI framework. However, due to some technical constraints, I have now decided to migrate my APIs to Django. I have been exploring ...
After encountering an error while trying to copy code from a website in order to create models for a file upload form for mp3 files, I received the following error messages: Forbidden (403) CSRF verification failed. Request aborted. The reason provided fo ...
While developing a Realtime chat app with Python, Django, and PyCharm, I encountered an error that says "Unresolved reference 'models'". ...
Having recently started working with the Django framework, I'm facing an interesting challenge that may be of interest to more experienced developers here. Here is the django model in question: STATUS_CHOICES = ( ('CL', 'CLOSED'), ('FR', 'FORWARDE ...
Is there a way to serialize the get_picture(self) method within this model? I am currently working on a social networking project and I need to serialize this method in order to obtain a JSON URL for the user's profile picture to be utilized in an And ...
I have implemented an ajax "follow" button on my website. Currently, the button's attribute disabled changes to "disabled" after submission. However, I would like to modify the button from "follow" to "unfollow" upon submission, similar to how it works on ...
My current framework of choice is Django. I find myself faced with the following code snippet: var done_cancel_order = function(res, status) { alert("xpto"); }; var cancel_order = function() { data = {}; var args = { type:"GET", url:"/exch ...
I'm having issues while attempting to integrate Vue with Django using brunch. Whenever I try to debug my JavaScript code, I notice that it fails at the following line: import Vue from 'vue/dist/vue.js' The error message displayed is 'Uncaught SyntaxError ...
I'm having trouble saving a URL from an input field (the form is inside a Bootstrap popover) - nothing happens when I click the save button. Below is my HTML code: <div id="popover-content" class="hide"> <form name ="bform" method = "post" actio ...
The response I am receiving from an API contains a character \x96 Upon making the API call, the following error is triggered: 'ascii' codec can't encode character u'\x96' in position 56: ordinal not in range(128) This ...
I am attempting to create a JSON variable to pass to a slideshow plugin. Here is the code found within the head section: <script type="text/javascript"> var photos = []; {% for service in company.services.all %} photos.push({ ...
When using Vue, the expression {{ game.data }} will return the following data: [ { "game": 1, "turn": 1, "player": 1, "word": "trend", "score": 18 }, { "game": 1, "turn": 2, & ...
Thank you for taking the time to read this. I've been working on a template that displays 4 forms, each with its own submit button triggering a POST request to the appropriate form. The first 3 forms are functioning correctly, but the last one (Estoq ...
As I work with Angular 1.4.4 and Django 1.8, I encountered an issue when posting data from Angular to Django view. The data is received in the form of a whole key in the QueryDict. Upon evaluating request.POST in debug mode, it returns: <QueryDict: {u ...
I encountered an issue when trying to assign a freelancer to a specific gig, as the get() method returned more than one Freelancer - in fact, it returned 3! I attempted to retrieve the logged-in freelancer who is creating the gig by using freelancer = get_ ...
Looking at my Django codebase, I have an endpoint that performs various tasks. My goal now is to verify if this endpoint is calling the function do_metadata_request with a specific token. Here's the function for reference: def do_metadata_request(url_info, ...
I'm facing an issue with adding custom data-* attributes to the option tag within a select element. Despite using a custom template (widget) with Django, it appears that Django is somehow removing my custom attributes in later stages. Here's my custom opt ...
Just starting out with django and I'm trying to create a superuser. After following all the necessary steps, the terminal confirms that I have successfully created the superuser. However, when I go to the server, I encounter a permission error. I eve ...
As a Django newcomer, I am currently encountering an issue with posting HTML tag data into the database. I have implemented a "PICK CASE" button that, when clicked, should pass the user_id (hidden in an HTML tag with display:none) and case_id from the tag ...
I currently have a PowerPoint file saved on Dropbox at "". My goal is to convert this presentation file into individual slide images (jpg/png..) within my Django template or using a Django def function. Once I have converted the slides, I plan to utilize ...
I've been attempting to create a simple AJAX request in Django, but I keep encountering the 403 forbidden error in both the Chrome Dev and Django consoles. Despite trying various proposed solutions like @csrf_exempt (to eliminate any potential csrf is ...
I am currently working on a project involving Django, Django REST, and Vue JS. I have successfully managed to retrieve information from the API to the Vue JS frontend. However, I am facing an issue where data is not being posted to the Django database when ...
While attempting to install PIL on my Mac OSX, I run sudo python setup.py install and everything seems to be going smoothly until I receive the following output. Has anyone else encountered this issue before? running build_ext --- using frameworks at /S ...
I have a table displaying records from a model using a for loop. Each row has a button that, when clicked, removes the row. However, upon refreshing the page, the removed rows reappear. I want to prevent this. How can I achieve this? <tabl ...
I'm currently working on a Django 1.6 project where I have this form: <form action="/proyecto/" method="POST" id="myform"> {% csrf_token %} <table> <span class="Separador_Modulo"></s ...
I am currently working on a web application using Django and the App platform on DigitalOcean. I have integrated Selenium and Chromedriver into my app, and I was able to install Chromedriver using Python libraries such as chromedriver_binary via pip. Howev ...
In my table, I have an attribute value with a CHAR data type. I am trying to post string data from an HTML template that I obtained from an HTTP GET request using AngularJS. However, when I click the submit button, I receive the following error: `ValueE ...
My backend setup is as follows: Postgres 9.5 Python 2.7 Django 1.9 I have a table with a datetime field named createdAt. I want to use Django ORM to select this field with only the date part and group by the createdAt field. For example, the createdA ...
class MyTestCaseA(TestCase): def setUp(self): # Setting up some initial configurations... def test_case(self): # Executing some test scenarios class MyTestCaseB(TestCase): def setUp(self): # Initializing necessary setu ...
In my Django form, I have a field called monitoring_method that is using an autocomplete-light widget. This widget filters the results based on what the user enters in another field called database_type. My question is: Is there any way to access the value ...
I implemented a form in my Django application that includes a dropdown menu. Models.py class Quiz(models.Model): mtypes = (('A', 'A'), ('B', 'B'), ('C', 'C'), ('D', 'D'), ('E', 'E')) material_type = models.CharField(max_length=255, default=0, ch ...
Hey, I currently have a function in my view that handles the upload of an image and saves it to a database object. I am looking to refactor this functionality out of my view and either move it to my model or in a separate file. filename_bits = request.FIL ...
Currently, I am in the process of learning about DRF. One thing I attempted was to print out print request.query_params, but unfortunately encountered an error: print request.query_params AttributeError: 'WSGIRequest' object has no attribute 'query_pa ...
When dealing with class-based views in Django, methods like ListView and DetailView require parameters such as self and request. I recently discovered that within the self there is actually a self.request field. So, what exactly is the distinction between ...
I am new to using a combination of Javascript and Django. Below is the script I have written: <script> $(document).ready(function() { $("#source").change(function() { var el = $(this); var reg = ...
I'm having difficulty integrating a Bokeh plot into a Django website that includes an upload button. I started with the example provided here and then followed additional instructions on embedding from here. I have successfully used need-a-minimal-django-f ...
I'm currently tackling a new project where each developer has their own settings file to work with. When it comes to running Django, I have to execute the following command: python manage.py runserver --settings="databank_web.settings.dqs.dev_houman ...
It has come to my attention that there is no assurance that the database will be updated synchronously following a call to save() on a model. To test this, I conducted a simple experiment by sending an ajax call to the method below: def save(request, id) ...
As I explore using Valum's Ajax Upload for file uploads on my Django-based website, I am faced with a challenge. Currently, I am avoiding a traditional form because AU sends the entire upload as POST data in an AJAX request. My current approach involves: ...
Exploring Django for the first time, I am attempting to show a dynamic server status on my website. It's puzzling why changing the function in my model to return 'cats' doesn't reflect on my browser immediately - there seems to be a delay of about 5 minute ...
I recently started working with Django as I develop my own website. I have created a base.html file which includes the main body, CSS, js, fonts, and navbar that will be present on all pages of my site. The navbar is located in another HTML file called nav ...
I am currently working on parsing JSON data within a Django view, however I have encountered an issue. Below is the code snippet that I am using: $(document).ready(function(){ $("#mySelect").change(function(){ selected = $("#mySelect option:s ...
I am seeking guidance on how to add a single field to a group of fields within a fieldset in DjangoAdmin. Currently, I have the following setup: class SecretarioAdmin(UserAdmin): model=Secretario def get_fieldsets(self, request, obj=None): ...
Struggling to properly title this question, but please bear with me as I explain my dilemma. I am in the process of creating an app for my hockey team that involves a django backend and a mobile app using JSON communication (via django-rest-framework). On ...