Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Unable to instal django-heroku on mac
I am trying to host my Django app on Heroku. The app works fine on my computer as long as a I don't use django-heroku (cause I can't install it), and it works fine on Heroku as long as it does have django-heroku. This is not a pressing issue, but it is sort of annoying to have to remove django-heroku to make edits on my computer, and then have to re-insert it before pushing to heroku. The ideal solution would be to get django-heroku installed on my computer. Specifications: Mac running macOS Conda environment, python 3.7 and 3.8 Here is what I have found so far: pip 20.0.2 from /Users/lucas/opt/anaconda3/lib/python3.7/site-packages/pip (python 3.7): Cannot install django-heroku (See error below) pip 20.1.1 from /Users/lucas/Library/Python/3.7/lib/python/site-packages/pip (python 3.7): Can install django-heroku, however: Gives me this warning: (still installs without any problems) WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip. Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue. To avoid this problem you can invoke Python with '-m pip' instead of running pip directly. running the script with all pythons in the environment say no module called django_heroku The first version of … -
Nearby stores ,without using Geo packages, Django Rest
I need to list stores nearby an address Here is my code : class Shop(TimeStamp): city = models.CharField(max_length=15, choices=CITIES, blank=True) lat = models.DecimalField(decimal_places=6, max_digits=10, verbose_name='latitude', default=None) long = models.DecimalField(decimal_places=6, max_digits=10, verbose_name='longitude', default=None) #this is the function I used for calculating distance I used haversine distance(origin, destination). def distance_shop(self, location): return distance((self.lat, self.long), location) in my apiView using post method receiving an address lat and long I did this : class NearbyShops(APIView): permission_classes = [IsAuthenticated] serializer_class = NearbyShopsSerializer def post(self, request): data = request.data serializer = NearbyShopsSerializer(data=data) if serializer.is_valid(raise_exception=True): try: address = DeliveryAddress.objects.get(client=request.user, lat=serializer.data.get('address_lat'), long=serializer.data.get('address_long')) except DeliveryAddress().DoesNotExist: return Response({"error": "This address doesn't exist"}, status=status.HTTP_404_NOT_FOUND) try: shops = Shop.objects.filter(city=address.city) except Shop().DoesNotExist: return Response({"error": "No shops in this city address"}, status=status.HTTP_417_EXPECTATION_FAILED) list = {} for shop in shops: location = (address.lat, address.long) dis = shop.distance_shop(location) shops = shops.annotate(distance=dis).order_by('distance') closest = Shop.objects.filter(distance__lt=10.0) for close in closest: list['name'] = close.name list['long'] = close.long list['lat'] = close.lat return Response({'shops': list}, status=status.HTTP_200_OK) I don't know why , but I get in return this error : QuerySet.annotate() received non-expression(s): 4783.728105194982 -
Django: How to create a queryset from a model relationship?
I have been struggling with grasping relations for some time and would be very grateful if someone can help me out on this issue. I have a relation that connects the User model to a ProcessInfo model via one to many and then I have a relation that connects the ProcessInfo to the ProcessAssumptions as One to one Is there a way to use the User id to get all ProcessAssumptions related to all processes from that user. I would like to retrive a querryset of all ProcessAssumptions related to a user id Here is the model relation : class ProcessInfo(models.Model): process_name = models.CharField(max_length=120, null=True) user_rel = models.ForeignKey(User, null=True, on_delete=models.SET_NULL) class ProcessAssumptions(models.Model): completion_time = models.FloatField(default='0') process_rel_process = models.OneToOneField(ProcessInfo, primary_key = True, on_delete=models.CASCADE) -
How do i show timestamp when message is submitted in Django Channels
I am able to implement chat message in Django using Channels, but when message is submitted the timestamp is not displayed, only the message text. How do i display both message and timestamp together so that user can identify at what time the message is being sent. I have asked a similar question yesterday, this is the link: How can i append two classes in JQuery -
Django admin 404 error when creating or editing a model instance
I'm currently debugging a weird problem with a Django site where one specific model is triggering a 404 error when creating a new instance or editing an existing one in the admin interface. This is only occuring on the live site and only when saving this model. All other models behave as expected, and when I run it locally, everything works as expected. Here's my model: class Content(models.Model): """Base Content class.""" title = models.CharField(max_length=200) body = RichTextUploadingField(max_length=30000, blank=True, null=True, config_name='admin') date_created = models.DateTimeField(auto_now_add=True) date_updated = models.DateTimeField(auto_now=True) author = models.ForeignKey(to=User, on_delete=models.CASCADE) slug = models.SlugField(max_length=100, null=True, default=None) class Meta: abstract = True class ContentPage(Content): """Represents a page of generic text content.""" title = models.CharField(max_length=200, unique=True) has_url = models.BooleanField(default=False, help_text='Sets the page to accessible via a URL.') banner = models.ImageField(upload_to='myfiles/banners/', blank=True, null=True) def save(self, *args, **kwargs): """Create the slug from the title.""" self.slug = slugify(self.title[:100]) super(ContentPage, self).save(*args, **kwargs) The ContentPage class is the one triggering the problem in the admin interface. My other class that inherits from Content works fine. I have stripped back my admin setup to the following and it is still occuring: class CustomAdminSite(AdminSite): def get_urls(self): """Define custom admin URLs.""" urls = super(CustomAdminSite, self).get_urls() # Append some new views here... … -
How to prevent '+' from getting converted to space in Django request.POST method?
I'm trying to read an email-id value using request.POST.get(). If the post data contains email-id with a '+' symbol, like "example+something@gmail.com", it gets read as "example something@gmail.com". I know this is happening because the + symbol is getting decoded as space, but how do I prevent this from happening in this scenario? -
How to set `enabled=false` in Django Elasticsearch DSL?
I am using Django ElasticSearch DSL, and I couldn't figure out how to disable indexing for one field (basically add enabled=false to a field). -
NoReverseMatch at /account/
im having a hard time to debug this error... The error is this: Environment: Request Method: GET Request URL: http://127.0.0.1:8000/account/ Django Version: 2.0.3 Python Version: 3.6.9 Installed Applications: ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'crispy_forms', 'talk', 'users'] Installed Middleware: ['django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware'] Template error: In template /home/hun/Documents/TalkingBuddy/TalkingBuddy/talk/templates/talk/base.html, error at line 0 Reverse for 'index' not found. 'index' is not a valid view function or pattern name. 1 : <!DOCTYPE html> 2 : <html> 3 : <head> 4 : {% block head %} {% endblock %} 5 : <link href="https://fonts.googleapis.com/css?family=Poppins:300&display=swap" rel="stylesheet"/> 6 : </head> 7 : <body> 8 : {% block body %} 9 : {% endblock %} 10 : </body> Traceback: File "/home/hun/.local/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner 35. response = get_response(request) File "/home/hun/.local/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response 128. response = self.process_exception_by_middleware(e, request) File "/home/hun/.local/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response 126. response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/home/hun/Documents/TalkingBuddy/TalkingBuddy/users/views.py" in account 19. return render_to_response('users/account.html') File "/home/hun/.local/lib/python3.6/site-packages/django/shortcuts.py" in render_to_response 27. content = loader.render_to_string(template_name, context, using=using) File "/home/hun/.local/lib/python3.6/site-packages/django/template/loader.py" in render_to_string 62. return template.render(context, request) File "/home/hun/.local/lib/python3.6/site-packages/django/template/backends/django.py" in render 61. return self.template.render(context) File "/home/hun/.local/lib/python3.6/site-packages/django/template/base.py" in render 175. return self._render(context) File "/home/hun/.local/lib/python3.6/site-packages/django/template/base.py" in _render 167. return self.nodelist.render(context) File "/home/hun/.local/lib/python3.6/site-packages/django/template/base.py" in render 943. bit = node.render_annotated(context) File "/home/hun/.local/lib/python3.6/site-packages/django/template/base.py" in render_annotated … -
Set a variable in django settings conditional to if dockerized
I am building a Django site that may be deployed at several sites, some dockerized, some not. In the Django settings.py file there is a setting that may change depending on the host (IP address) variable and more particularly if run from within a Docker Container. Particularly, Docker use this special DNS name (host.docker.internal) to refer to the host computer localhost from within a docker container, where using localhost only in a container refer to the docker instance localhost instead. For example the following case would be use by Django to connect to a SQL instance. Django is dockerized and the database is on the host server : 'HOST': 'host.docker.internal' where in another case, Django is not run in a docker container, just on the host, so it can directly access the database locally: 'HOST': 'localhost' Question: Would there be a way to make a conditional statement before such an environment variable would be required, such as: if in_docker: HOST = 'host.docker.internal' else: HOST = 'localhost' -
Django Rest Framework - how to create viewset with aggregated data coming from different tables?
Good morning, I have an API made with Django-Rest, which will then expose results in a website. To avoid having multiple API calls from the website, I want the API to calculate some aggregated results and then expose them in a viewset. Django 2.2, Postgres as database models.py: class Result(models.Model): branch = models.CharField(max_length=100, blank=False) url_id = models.ForeignKey('repository', on_delete=models.CASCADE) commit = models.CharField(max_length=100, blank=False) device = models.ForeignKey('device', on_delete=models.CASCADE) add_time = models.DateTimeField(auto_now_add=True) ... There can be multiple instances of all of those fields (apart from add_time). Now, I would like to use this model to extract the following data: number of results for each branch number of devices that gave a result for each branch latest result for each branch url string for each branch (contained in Repository but not primary key) latest commit for each branch I created a BranchViewSet using as model Result but I am not sure how to proceed from here. I would like the viewset to output a JSON with ALL the distinct branches and all respective results, not to pass the branch as parameter in a request. Furthermore, those parameters should not be contained in the DB since they are aggregated. I understand I need to edit … -
how to remove bracket and name when modelchoicefield is used in Django?
Here is my code: staff_id=forms.ModelChoiceField(label="Staff",widget=forms.Select(attrs={"class":"form- control"}),queryset=Staff.objects.all().values('name')) Here is my output: I am getting this name and brackets in this pop down menu, how can i remove these? -
How to correctly post with jQuery / Ajax in Django model
I am trying to POST data using jQuery/Ajax to my Django related models. Despite going through a number of questions on the subject I am somehow not able to complete the job of posting data in the tables. If I use normal form submit the data gets saved in both the tables, however while using ajax I keep getting 400 (Bad Request). My view to process the ajax request is: def ajxCreateRtp(request): if request.is_ajax and request.method == "POST": form = RtpCreateForm(request.POST) if form.is_valid(): instance = form.save(commit=False) formset = CreateRtpFormset() if formset.is_valid(): formset_instance = formset.save() instance = form.save() ser_instance = serializers.serialize('json', [ instance, formset_instance, ]) return JsonResponse({"instance": ser_instance}, status=200) else: return JsonResponse({"error": form.errors}, status=400) return JsonResponse({"error": ""}, status=400) The error in the console reads like: POST http://127.0.0.1:8000/.../.../.../rtp/ajax/add/ 400 (Bad Request) send @ jquery-3.4.1.js:9837 ajax @ jquery-3.4.1.js:9434 (anonymous) @ (index):1011 dispatch @ jquery-3.4.1.js:5237 elemData.handle @ jquery-3.4.1.js:5044 Note: If I remove the .formset parts from the view ajxCreateRtp, the entered data in the header form gets saved to the parent model. The jQuery/Ajax script in the template is: $(function() { $('#rtpForm').submit(function(e) { e.preventDefault(); var data = $(this).serialize(); // console.log(data); $.ajax({ type: 'POST', url: "{% url 'ajax_add_rtp' %}", data: data, success: function(response) { console.log('Data … -
how to use custom register mutation with django-graphql-auth
django-graphql-auth is an awesome package, but the documentation doesn't say much about models association to a custom user model. I am looking for a away to make use of this package with a custom Register Mutation for both user types Applicant and Employer class User(AbstractUser): email = models.EmailField(blank=False, max_length=255, verbose_name="email address") is_applicant = models.BooleanField(default=False) is_employer = models.BooleanField(default=False) USERNAME_FIELD = "username" EMAIL_FIELD = "email" class Applicant(models.Model): user = models.OneToOneField( User, on_delete=models.CASCADE, primary_key=True, ) fullname = models.CharField(max_length=255, null=True) class Employer(models.Model): user = models.OneToOneField( User, on_delete=models.CASCADE, primary_key=True, ) company_name = models.CharField(max_length=225, null=True) Mutation goal to achieve: mutation { registerApplicant( input: { email: "new_applicant@email.com", username: "new_applicant", password1: "createsuperpassword", password2: "createsuperpassword", isApplicant: true, applicant { fullname: "New Applicant" } } ) { success, errors, token, refreshToken } } mutation { registerEmployer( input: { email: "new_employer@email.com", username: "new_employer", password1: "createsuperpassword", password2: "createsuperpassword", isEmployer: true, employer { fullname: "New Employer" } } ) { success, errors, token, refreshToken } } -
Reverse for 'edit_order' with arguments '(17,)' not found. 1 pattern(s) tried: ['order/<int:pk>/$']
I tired my best to solve this error but I couldnt solve this error. details errro is given: NoReverseMatch at /order/ Reverse for 'edit_order' with arguments '(17,)' not found. 1 pattern(s) tried: ['order/int:pk/$'] Request Method: POST Request URL: http://127.0.0.1:8000/order/ Django Version: 1.11.29 Exception Type: NoReverseMatch Exception Value: Reverse for 'edit_order' with arguments '(17,)' not found. 1 pattern(s) tried: ['order/int:pk/$'] Exception Location: C:\Python27\lib\site-packages\django\urls\resolvers.py in _reverse_with_prefix, line 497 Python Executable: C:\Python27\python.exe Python Version: 2.7.16 Python Path: ['C:\Users\dipesh\Desktop\nandiasgraden-project\nandiasgarden', 'C:\WINDOWS\SYSTEM32\python27.zip', 'C:\Python27\DLLs', 'C:\Python27\lib', 'C:\Python27\lib\plat-win', 'C:\Python27\lib\lib-tk', 'C:\Python27', 'C:\Python27\lib\site-packages'] Server time: Wed, 8 Jul 2020 12:02:12 +0000 Url.py from django.contrib import admin from django.conf.urls import url from pizza import views urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^$', views.home, name='home'), url(r'^order/', views.order, name='order'), url(r'^pizzas/', views.pizzas, name='pizzas'), url(r'^order/<int:pk>/$', views.edit_order, name='edit_order'), ] View.py from django.shortcuts import render from .forms import PizzaForm, MultiplePizzaForm from django.forms import formset_factory from .models import Pizza def home(request): return render(request, 'pizza/home.html') def order(request): multiple_form = MultiplePizzaForm() if request.method == 'POST': filled_form = PizzaForm(request.POST) if filled_form.is_valid(): created_pizza = filled_form.save() created_pizza_pk = created_pizza.id note = 'Thanks for ordering! Your %s %s and %s pizza is on its way!' %(filled_form.cleaned_data['size'], filled_form.cleaned_data['topping1'], filled_form.cleaned_data['topping2'],) new_form = PizzaForm() return render(request, 'pizza/order.html', {'created_pizza_pk':created_pizza_pk, 'pizzaform':new_form, 'note':note, 'multiple_form':multiple_form, }) else: form = PizzaForm() return render(request, 'pizza/order.html', … -
Possible SECURITY ATTACK detected. It looks like somebody is sending POST or Host: commands to Redis
Possible SECURITY ATTACK detected. It looks like somebody is sending POST or Host: commands to Redis. This is likely due to an attacker attempting to use Cross Protocol Scripting to compromise your Redis instance. Connection aborted When trying to connect through django based web application I get the following error: (index):311 WebSocket connection to 'ws://104.198.134.132:8000/ws/chat/sddd/' failed: Error during WebSocket handshake: net::ERR_INVALID_HTTP_RESPONSE Upon seeing this I tried looking up at the redis logs and they are as follows: 8032:M 08 Jul 11:54:25.941 # Possible SECURITY ATTACK detected. It looks like somebody is sending POST or Host: commands to Redis. This is likely due to an attacker attempting to use Cross Protocol Scripting to compromise your Redis instance. Connection aborted. Upon further investigating the error I found that redis only allows local connections, so I tried editing redis config file as follows: ################################# NETWORK ##################################### # By default, if no "bind" configuration directive is specified, Redis listens # for connections from all the network interfaces available on the server. # It is possible to listen to just one or multiple selected interfaces using # the "bind" configuration directive, followed by one or more IP addresses. # # Examples: # # bind 192.168.1.100 … -
What is purpose db.sqlite3-journal file in Django project?
Today i created a new model. When I migrate all the new migrations suddenly db.sqlite3-journal a new file is created in my Django project. I have done migrations so many time that time this file not created but today suddenly this file created after doing migrate but why? file image What is purpose of this file? can I delete this file if it has no meaning in my project? -
DJango: how to show more API versions in swagger
I'm working to use versioning in my application. How can I see all the endpoints in my swagger? (of version v1, v2,..). At this point I can only see the endpoints of the default version, mentioned in the settings: REST_FRAMEWORK = { "DEFAULT_VERSIONING_CLASS": "rest_framework.versioning.NamespaceVersioning", "DEFAULT_VERSION": "v1", } Snippet of my project urls.py: urlpatterns = [ re_path(r"^v1/sites/", include((site_urls, "sites"), namespace="v1")), re_path( r"^v1/admin-dashboard/", include((admin_dashboard_urls, "admin-dashboard"), namespace="v1"), ), ] -
How to handle multiple file uploads in Django rest framework?
I've been banging my head on how to handle multiple file uploads in drf , my vue.js front-end is sending the files but i don't know how to hanfle them in my back-end . views.py class FileViewSet(viewsets.ModelViewSet): parser_classes = (FormParser,MultiPartParser) queryset = File.objects.all() serializer_class = FileSerializer serializers.py class FileSerializer(serializers.ModelSerializer): class Meta: model = File fields = ('id', 'file','uploaded_at') models.py class File(models.Model): file = models.FileField(upload_to='files/') uploaded_at = models.DateTimeField(auto_now_add=True) def delete(self, *args, **kargs): self.file.delete() super().delete(*args, **kargs) Any idea? -
Keep Django user through template rendering
I have template upload_file.html <form method="post" enctype="multipart/form-data">{% csrf_token %} <input type="file" name="files" multiple /> <input type="submit" name="submit" value="Upload" /> </form> And a view: @api_view(('GET', 'POST')) def upload_file(request): print(request.COOKIES) print(request.user) if request.method == 'POST' and request.FILES: # some logic here return HttpResponse('ok', status=200) return render(request, 'upload_file.html') So I logged into system and sending GET request to this view, I see request.COOKIES are set with session, user is me. After I submit files - I see that POST request is sent to my view, request.COOKIES are set with session, but user is some AnonymousUser. How can I preserve my user through this two requests? Django 2.2 -
Django : How to render an HTML file from outside templates folder
I would like to know if there is a way in Django te render HTML files from outside the template directory. In my case, I have a app/docs folder which contains my static documentation HTML files. I tried everything I found so far but I always end up with a TemplateDoesNotExist exception. Tree: project |__app_name |__templates | |__app_name | |__templates | |__docs |__templates_to_render Any help is appreciated. -
Django RF, comparing validation raising methods .(return Response vs raise ValidationError)
When I do validation in Django query set, the below code execute successfully and returns validation error if query fails to meet certain parameters if second_condition: raise ValidationError("1 error") else: serializer.save() Meanwhile the below code fails to give response 1 error as expected. if second_condition: return Response("1 error") else: serializer.save() Why is so ? note : avoid indentation format -
Django custom queryset returns nothing
I am trying to write a year level filter for my student profile list, however, the query returns an empty []. This is my Attendance model, manager and custom queryset: class AttendanceQuerySet(models.QuerySet): def get_yearlevel(self, yearlevel): return self.filter(BCEID__YearLevel = yearlevel) class AttendanceManager(models.Manager): def get_queryset(self): return AttendanceQuerySet(self.model, using=self._db) def get_yearlevel(self, yearlevel): return self.get_queryset().get_yearlevel(yearlevel) class Attendance(models.Model): BCEID = models.OneToOneField(StudentProfile,primary_key=True,on_delete=models.CASCADE) AttendanceRate = models.CharField(max_length=10) objects = AttendanceManager() def __unicode__(self): return self.BCEID StudentProfile model: class StudentProfile(models.Model): RelatedPersonName = models.CharField(max_length=10) RelatedPersonFirstName = models.CharField(max_length=30) RelatedPersonFamName = models.CharField(max_length=30) StudentLegalName = models.CharField(max_length=30) StudentFamName = models.CharField(max_length=30) Email = models.CharField(max_length=130) Street1 = models.TextField(max_length=30) Suburb = models.CharField(max_length=30) State = models.CharField(max_length=5) PostCode = models.CharField(max_length=6) StudentLegalName = models.CharField(max_length=30) StudentFamName = models.CharField(max_length=30) StudentNo = models.CharField(primary_key=True,max_length=10) Class = models.CharField(max_length=6) YearLevel = models.CharField(max_length=10) objects = StudentProfileManager() def __unicode__(self): return self.StudentNo and AttendanceListView (views.py) class AttendanceListView(ListView): model = Attendance queryset = Attendance.objects.get_yearlevel("Year 8") I manually queried the database to check if there were errors in my code, and got the same result: an empty array []. SQL: SELECT "student_attendance"."BCEID_id", "student_attendance"."AttendanceRate" FROM "student_attendance" INNER JOIN "student_studentprofile" ON ("student_attendance"."BCEID_id" = "student_studentprofile"."StudentNo") WHERE "student_studentprofile"."YearLevel" = 'Year 8' Please let me know what I am doing wrong here. -
How to inspect the SQL generated by Django for a multi-tenant application to ensure the tenant is filtered?
I have a multi-tenant Django application with a single database. Where data belongs to a single tenant, the table has a tenant_id column. At the moment we are manually adding the tenant filter through manager methods for each model, but it is easy to forget adding the filter. For the relevant tables, is there some way that I can inspect the SQL to ensure that it contains the tenant filter when using the Django ORM? I want to add this as an extra precaution to ensure that no data leaks between tenants. Is this possible? We're using a postgres DB -
Django Deployment: Error 403 Forbidden You don't have permission to access / on this server
I'm currently deploying my Django app into a CentOS 7 Server (CentOS Linux release 7.8.2003) based on Django documentation here. But I encounter this problem (Error 403) stated in the error log below. Things to take note: Yes, I was able to run the server through a virtual environment port 8000. The database I'm using is mysql (guide). Does this have any relation with the access permission set for apache? As for now, I have set the permission for apache as below: sudo chown :apache colus_cafe/ sudo chown -R :apache colus_cafe/colus_cafe/media Python version 3.6.8 & WSGI python36-mod_wsgi.x86_64 (guide). What have I tried: Will be updated based on given answer remove and reinstall virtual environment. /etc/httpd/conf.d/django.conf: Alias /static /home/colus/colus_cafe/colus_cafe/static <Directory /home/colus/colus_cafe/colus_cafe/static> Require all granted </Directory> Alias /media /home/colus/colus_cafe/colus_cafe/media <Directory /home/colus/colus_cafe/colus_cafe/media> Require all granted </Directory> <Directory /home/colus/colus_cafe/colus_cafe> <Files wsgi.py> Require all granted </Files> </Directory> WSGIScriptAlias / /home/colus/colus_cafe/colus_cafe/wsgi.py WSGIDaemonProcess colus_cafe_app python-home=/home/colus/colus_cafe/env python-path=/home/colus/colus_cafe WSGIProcessGroup colus_cafe_app /etc/httpd/logs/error_log Current thread 0x00007fee066d6880 (most recent call first): [Wed Jul 08 07:11:09.691137 2020] [mpm_prefork:notice] [pid 10044] AH00170: caught SIGWINCH, shutting down gracefully [Wed Jul 08 07:11:10.768060 2020] [core:notice] [pid 10231] SELinux policy enabled; httpd running as context system_$ [Wed Jul 08 07:11:10.769024 2020] [suexec:notice] [pid 10231] AH01232: suEXEC mechanism … -
tempus_dominus django, how to set empty value
I have set the following models: class Ricavi(models.Model): data_pagamento_acconto=models.DateField('Data pagamento acconto', default="", null=True, blank=True) But If I set tempus_dominus widget in the following manner: class RicaviForm(forms.ModelForm): data_pagamento_acconto=forms.DateTimeField(widget=DatePicker(attrs={ 'append': 'fa fa-calendar', 'icon_toggle': True, })) My form does not accept blank value. How could overcome this issue?