Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
python Django running scripts from client side
I have a Python Django project set up. I have a home.HTML file with a button on it. I want the user of the Python Django website to be able to click the button on the home.HTML page and run the Python script. A python script such as scrapy which is located on GitHub (could be any other python script on github). I want the button to trigger the function rather than typing in the console. I then want the result from the script to return in a csv file. How would this be done, can it be done ? -
How to serve phpMyAdmin to localhost/phpMyAdmin instead of localhost:8080 using nginx in docker
In my project, I am using Django and nginx, but I want to manage my cloud databases through phpmyadmin. Django is working fine but I can't do the same with phpmyadmin because it is running in apache at localhost:8080, when I want it to run in nginx at localhost/phpmyadmin. here is the docker-compose.yml version: "3.9" services: web: restart: always build: context: . env_file: - .env volumes: - ./project:/project expose: - 8000 nginx: restart: always build: ./nginx volumes: - ./static:/static ports: - 80:80 depends_on: - web phpmyadmin: image: phpmyadmin/phpmyadmin:latest restart: always environment: PMA_HOST: <host_address> PMA_USER: <user> PMA_PASSWORD: <password> PMA_PORT: 3306 UPLOAD_LIMIT: 300M ports: - 8080:80 and nginx default.conf upstream django{ server web:8000; } server{ listen 80; location / { proxy_pass http://django; } location /pma/ { proxy_pass http://localhost:8080/; proxy_buffering off; } location /static/ { alias /static/; } } I hope somebody will be able to tell me how to make nginx work as a reverse proxy for the phpMyAdmin docker container. If some important information is missing please let me know. -
Django model - can't do aggregate sum with thousand comma separator and decimal points
I have the following model: class Example(models.Model): project_id = models.IntegerField( null=False, blank=False, default=0, ) field1 = models.CharField( max_length=250, null=True, blank=True, ) field2 = models.CharField( max_length=250, null=True, blank=True, ) total = models.CharField( max_length=250, null=True, blank=True, ) Example data: project_id field1 field2 total 1 1,323 4,234.55 5,557.55 2 1,000 2 1,002 3 1.23 3 4.23 total = field1 + field2 I would like to sum all total values. This is what I've tried views.py: context['total'] = Example.objects.filter(project_id=pid).aggregate(Sum('total')) Current output: {'total': 10.23} Expected output: {'total': 6,563.78} Or, if that's not possible at least: 6563.78 so that I can format the numbers later. Since the project requires thousand comma separator and decimal points, I can not change or alter the model fields and use FloatField. Any help would be much appreciated -
how to get the text from user input then set it in to the condition in html template?
I'm doing a lab creating the web view to access the data from mysql, so I have some config below: student\views.py from django.shortcuts import render, redirect from .models import Student # Create your views here. def show(request): students = Student.objects.all() student_dict = {'student':students} return render(request, "show.html",student_dict) student\templates\show.html <!DOCTYPE html> <html lang="en"> <head> <title>Django CRUD Operations</title> <meta charset="utf-8"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script> </head> <body> <div class="container"> <table class="table table-striped"> <thead> <tr> <th>Student ID</th> <th>Roll</th> <th>Class</th> <th>First Name</th> <th>Last Name</th> </tr> </thead> <tbody> {% for stud in student %} <tr> {% if stud.fname == 'abc' %} # I would like to make an input box for user can input here <td>{{stud.id}}</td> <td>{{stud.roll}}</td> <td>{{stud.sclass}}</td> <td>{{stud.fname}}</td> <td>{{stud.lname}}</td> {% endif %} </tr> {% endfor %} </tbody> </table> </div> </body> </html> student\urls.py from django.urls import path from . import views urlpatterns = [ path('show/', views.show), ] I have connectted to database student in mysql already , and could show all or filter which i want by code , now i want to have an input box for user can input their username , then when they click on submit it will show only their info. Could you please assist for my case ? -
How to enable django admin sidebar navigation in a custom view?
I have a view inheriting from LoginRequiredMixin, TemplateView, which renders some data using the admin/base_site.html template as the base. I treat it as a part of the admin interface, so it requires an administrator login. I'd like to make this view a little bit more a part of the Django admin interface by enabling the standard sidebar navigation on the left-hand side. Note that I don't have a custom ModelAdmin definition anywhere, I simply render the template at some predefined URL. There are no models used in the interface either, it parses and displays data from database-unrelated sources. Currently, I just build the required context data manually, e.g.: data = super().get_context_data(**kwargs) data.update(**{ "is_popup": False, "site_header": None, "is_nav_sidebar_enabled": True, "has_permission": True, "title": "My title", "subtitle": None, "site_url": None, "available_apps": [] }) The sidebar is visible, but displays an error message: Adding an app to available_apps ("available_apps": ["my_app"]) doesn't help either: So my question is - how do I do that? Is there a class I can inherit from to achieve this behaviour? Or a method I can call to get all required context data for base_site.html? Or perhaps I should insert some information in my template? Perhaps I need an AdminSite … -
redirect to index page for logged in users in Django
I have a problem if I close a browser page without having logged out and re-enter with another browser tab as the session is still active (and I have the login url in the root, example: http://localhost:8000) it takes me again to the login and I would like that when a user was already logged in it would take me to the index. All are based in function base views. Thank you very much in advance. -
django.db.utils.ProgrammingError: relation "members_profile" does not exist
I am facing this error while creating a profile model of user. IMPORTANT: If I remove the Utility fields it works completely fine. So there must be some issue with it, I Tried removing some lines but nothing seems to work. my code is: class Profile(models.Model): user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) uusername = models.ForeignKey(User,to_field='username',on_delete=models.CASCADE,related_name="uusername") rolenumber = models.PositiveIntegerField(blank=True,default=0) admission_year = models.PositiveIntegerField(blank=True,default=0) current_class = models.PositiveIntegerField(_('current_class'),choices=CLASS_CHOICES,blank=True,null=True) gender = models.CharField(_('gender'),choices=GENDER_CHOICES,blank=True,null=True,max_length=50) school_branch = models.CharField(_('school_branch'),choices=JAMEA_BRANCH,blank=True,null=True,max_length=50) full_name = models.CharField(_('full_name'),max_length=100,blank=True,null=True) academic_status = models.CharField(_('academic_status'),choices=ACADEMIC_STATUS,blank=True,null=True,max_length=50) #Utility fields uniqueId = models.CharField(null=True, blank=True, max_length=100) slug = models.SlugField(max_length=500, unique=True, blank=True, null=True) date_created = models.DateTimeField(blank=True, null=True) last_updated = models.DateTimeField(blank=True, null=True) def __str__(self): return '{} {} {}'.format(self.uusername, self.full_name, self.uniqueId) def get_absolute_url(self): return reverse('profile-detail', kwargs={'slug': self.slug}) def save(self, *args, **kwargs): if self.date_created is None: self.date_created = timezone.localtime(timezone.now()) if self.uniqueId is None: self.uniqueId = str(uuid4()).split('-')[4] self.slug = slugify('{} {} {}'.format(self.uusername, self.full_name, self.uniqueId)) self.slug = slugify('{} {} {}'.format(self.uusername, self.full_name, self.uniqueId)) self.last_updated = timezone.localtime(timezone.now()) super(Profile, self).save(*args, **kwargs) def get_absolute_url(self): return reverse('profile-detail', kwargs={'slug': self.slug}) @receiver(post_save, sender=User) def create_user_profile(sender, instance, created, **kwargs): if created: Profile.objects.create(user=instance) @receiver(post_save, sender=User) def save_user_profile(sender, instance, **kwargs): instance.profile.save() Here is the error: return self.cursor.execute(sql, params) django.db.utils.ProgrammingError: relation "members_profile" does not exist LINE 1: ...e_created", "members_profile"."last_updated" FROM "members_p... I don't know how to solve this please help me! -
Pylance Intellisense not working as expected with Django
I'm trying to understand how to configure Pylance to make it work correctly in my Django project. Below is one of many examples where Pylance is not able to find what I'm looking for. Here, I obviously need models from django.db. But there are only theses 6 suggestions below... Here is what I know or tried: My interpreter is correctly selected (Python 3.10.4) Pylance seems to work perfectly with Python (not Django) related stuff. I'm using Poetry as a package manager, and no virtual env because I work in a self-contained dev container. There is only one python installed on it. In my VS Code config (using devcontainer.json) :"python.analysis.extraPaths": ["${workspaceFolder}/dj_proj/dj_apps"] -> which works to prevent missing imports. I have no false warnings about missing imports, just the inability to see the right suggestions in intellisense. I cleaned __pycache__ and .pyc files -> no effect I ensured there is a __init__.py pretty much everywhere my sys.path (PYTHONPATH) looks like this (where dj_proj is my django project and dj_apps my apps folder): ['/workspace/dj_proj/dj_apps', '/workspace/dj_proj', '/usr/local/lib/python310.zip', '/usr/local/lib/python3.10', '/usr/local/lib/python3.10/lib-dynload', '', '/usr/local/lib/python3.10/site-packages'] I'm suspecting this PYTHONPATH variable to be messy or not sorted the right way, but I'm not sure. Any idea on what … -
even after running migrations Django Programming error column does not exist
At first on my project everthing is works fine but after I added field to model everything is broken.I am working on ubuntu with postgresql.(Django project) .I deleted migrations folder and django_migrations folder but nothing is change.Everytime I get this error.Can anyone please help me?? -
sort meeting timeslot using priority base:python Django
im creating in the one to one meeeting website. and try to do for the sorting section sorting in the vendor need to meet == delligate => V sorting to the deligate need to meet == vendor => D deligate and vendor need to equally meet vendor == deligate && deligate == vendor =>M these conditions are need to done for python django section. im try to fix the section in the pandas but that is not happen. only coming in the 'NaN' values . -
the Django's mongodb support library djongo will close the db automatically
I use MongoDB as the Django's database and I use djongo for operation, it seems that it will close the connection automatically and can't restore. For example, I create a simple view to show all the records like before: book_res = Book.object.all() ... return Response(res) It will work in the first time I get to the view's url address, if i refresh the page or redirect into the same url, the system will crash and shows the error message that "cannot use mongoclient after close" that cause an ambigous error "django.db.utils.DatabseError" -
How to increase query execution time?
I get an error 504 gateway time-out when my user tries to get some data from the database, the query that is to be executed to fetch the data is very complex and takes some time to be executed, so I want to increase the query execution time in my server so user can get the data, so how can I do this from my putty the application is written in Django -
How to search on different models dynamically using Elasticsearch in Django?
Criteria: Front-End templates should be dynamic Scenario: Let's suppose there are three models(Product, Service, Merchant). If we search for the service model, all the services should be listed at the first template and other models like product and merchant can be recommend at second and third template simultaneously. All the section(templates) product, service and merchant should be made dynamic. So that whenever we search for particular model, it must be displayed at top and all other remaining models can be recommended later. Example: Let's suppose there are three models(Product, Service, Merchant). If we search "Bag" the system should return Product model at first template and then service and merchant in other templates respectively. If we search "Laptop Repair" the system should return Service model at first template and then product and merchant in other templates respectively. -
Need to add one model fields in the another model serializers but throwing error while POST the request
models.py class Product(models.Model): product_id = models.AutoField(unique=True, primary_key=True) product_name = models.CharField(max_length=255) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) class Meta: db_table = "product_master" def __str__(self): return self.product_name class Organisation(models.Model): """ Organisation model """ org_id = models.AutoField(unique=True, primary_key=True) org_name = models.CharField(max_length=100) org_code = models.CharField(max_length=20) org_mail_id = models.EmailField(max_length=100) org_phone_number = models.CharField(max_length=20) org_address = models.JSONField(max_length=500, null=True) product = models.ManyToManyField(Product, related_name='products') org_logo = models.ImageField(upload_to='org_logo/') created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) class Meta: db_table = "organisation_master" def __str__(self): return self.org_name serializers.py class Product_Serializers(serializers.ModelSerializer): class Meta: model = Product fields = ('product_id', 'product_name',) class Organisation_Serializers(serializers.ModelSerializer): product = Product_Serializers(many=True) class Meta: model = Organisation fields = ('org_id', 'org_name', 'org_address', 'org_phone_number', 'org_mail_id','org_logo','org_code','product') depth = 1 " While i tried to do POST method for the organisation model I have tried giving the input for product as "product: 5" and "product: {"product_id": 5,"product_name": "time"} in the postman form data but it is showing as { "status": "error", "code": 400, "data": { "product": [ "This field is required." ] }, "message": "success" } I need to post like this product: {"product_id": 5,"product_name": "time"}, what fields are available in the product model it should be posted on this product field. Can you please suggest me a way as i tried many ways as … -
Django deploy errors
I just launched the Django app. As an image, everything is in place, but the form and admin panel do not work. Anyone who knows please help I get this error when I run the form. Let me know if I need to share any code. -
How to send post request to properly using Http Client in Angular
I want to create a registration page that holds email, username, first-name, last-name and password. I am using Angular 13 as front-end and Django as back-end. The forms works perfect but I am getting an error on the console. here is my registration form: here is the error on the console: here is the list of services I wrote: 1. code for auth.service.ts: import { Injectable } from '@angular/core'; import { HttpClient, HttpParams } from '@angular/common/http'; import { ResearcherData } from './../models/researcher-data.interface'; import { Observable, throwError } from 'rxjs'; import { catchError, retry } from 'rxjs/operators'; import { HandleError, HttpErrorHandler } from './http-error-handler.service'; import { HttpHeaders } from '@angular/common/http'; const httpOptions = { headers: new HttpHeaders({ 'Content-Type': 'application/json', Authorization: 'my-auth-token' }) }; @Injectable({ providedIn: 'root' }) export class AuthService { private url = 'http://127.0.0.1:2000/auth/users/'; private handleError: HandleError; constructor( private http: HttpClient, httpErrorHandler: HttpErrorHandler, ) { this.handleError = httpErrorHandler.createHandleError('AuthService'); } /** register researcher to the server */ register(researcherdata: ResearcherData): Observable<ResearcherData>{ return this.http.post<ResearcherData>(this.url, researcherdata,httpOptions) .pipe( catchError(this.handleError('register', researcherdata)) )} } code for http-error-handler.service.ts import { Injectable } from '@angular/core'; import { HttpErrorResponse } from '@angular/common/http'; import { Observable, of } from 'rxjs'; import { MessageService } from './message.service'; /** Type of the handleError … -
Heroku Django - Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
I have recently deploy a new version of my web app to production in Heroku using their git commands, rather than through their UI using the GitHub connection. Ever since, I have started to get the following error: Error: 2022-04-25T06:19:06.351920+00:00 heroku[web.1]: Starting process with command `gunicorn -b 0.0.0.0:57903 app.wsgi --log-file -` 2022-04-25T06:20:06.803913+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch 2022-04-25T06:20:07.621791+00:00 heroku[web.1]: State changed from starting to crashed 2022-04-25T06:20:07.025631+00:00 heroku[web.1]: Stopping process with SIGKILL 2022-04-25T06:20:07.541144+00:00 heroku[web.1]: Process exited with status 137 Now I'm not saying this is the cause but when I initially deployed the code, my website worked for around a day or two before this appeared. I have being trying to add ports to the procfile as people are suggesting but nothing seems to be working and I have never needed to do that in the past. It neither works with or without the -b tag. Procfile: release: ./release-tasks.sh web: gunicorn -b 0.0.0.0:$PORT card_companion_v2.wsgi --log-file - worker: python manage.py process_tasks wsgi.py import os from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'app.settings.development') application = get_wsgi_application() I am using tailwind so node.js is involved, so the buildpacks I am using are: heroku/nodejs, … -
how do I add an item to the cart without the page reloading?
So I wanna add an item to the cart without the page reloading every time, So is there a way to go about this, that won't be slow? if so, how would I fix this? also not the best with javascript so if u can explain stuff a bit, I would really appreciate your help, thx! link to the rest main code: https://gist.github.com/StackingUser/34b682b6da9f918c29b85d6b09216352 template: {% load static %} <link rel="stylesheet" href="{% static 'store/css/shop.css' %}" type="text/css"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <script type="text/javascript"> var user = '{{request.user}}' function getToken(name) { let cookieValue = null; if (document.cookie && document.cookie !== '') { const cookies = document.cookie.split(';'); for (let i = 0; i < cookies.length; i++) { const cookie = cookies[i].trim(); // 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; } const csrftoken = getToken('csrftoken'); function getCookie(name) { // Split cookie string and get all individual name=value pairs in an array var cookieArr = document.cookie.split(";"); // Loop through the array elements for(var i = 0; i < cookieArr.length; i++) { var cookiePair = cookieArr[i].split("="); /* Removing whitespace at the beginning of … -
How to make Django user specific (data) in a to do app?
I am trying to separate tasks between all users that log in, but nothing I've tried has worked. All users are able to see other users' tasks, which isn't what I want. Below is the model and view function that I am using to create a task. Thanks in advance. class Tasks(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE, null=True, blank=True) title = models.CharField(max_length=200) description = models.TextField(null=True, blank=True) complete = models.BooleanField(default=False) finish = models.CharField(max_length=50) created = models.DateTimeField(auto_now_add=True) def __str__(self): return self.title class Meta: ordering = ['complete'] Task View def taskList(request): q = request.GET.get('q') if request.GET.get('q') != None else '' tasks = Tasks.objects.filter(title__contains=q,user=request.user) tasks_count = tasks.count() context = {'tasks':tasks, 'tasks_count':tasks_count} return render(request, 'base/home.html', context) Am I missing something in my models? -
Setup login session for sub domain from main domain in Django
I have a main domain example.com and a subdomain tenant.example.com. A user comes to http://example.com/login and logs In, By default, Django set a session cookie for example.com. What I want is that Django set the session cookie for tenant.example.com instead of example.com. How can I implement this? -
Errorvalue: Field 'phone' expected a number but got 'Admin@gmail.com'
When I was trying to login with email it shows error message but I need it has a comment .The code should not show "ValueError: Field 'phone' expected a number but got 'Admin@gmail.com'".and " ValueError: Field 'phone' expected a number but got 'Admin@gmail.com'." Below are the code of views.py and login.html and my checkbox is also not working. views.py def loginf(request): if request.method=='POST': phone=request.POST.get('phone') password=request.POST.get('password') user = authenticate(username=phone, password=password) try: remember = request.POST['checkbox'] if remember: settings.SESSION_EXPIRE_AT_BROWSER_CLOSE = False except: is_private = False settings.SESSION_EXPIRE_AT_BROWSER_CLOSE = True u = User.objects.filter(phone=phone,otp=password).exists() if u and user is not None: r=User.objects.filter(phone=phone,otp=password) status=r[0].status if status=="Active": role=r[0].role if role == "Employee": login(request,user) return redirect('listtask') elif role == "Consultant": userid=r[0].id login(request,user) return redirect('consultatntbilling',userid=userid) else: messages.info(request,"Account is Inactive") return render(request,'login.html') else: messages.info(request," Invalid Phone Number or Password") return render(request,'login.html') return render(request,'login.html')` login.html` Login to continue.. <div class="container"> {% for message in messages %} <div class="alert alert-warning alert-dismissible fade show" role="alert"> {{ message }} <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="close"></button> </div> {% endfor %} </div> <form method ="POST" action="{% url 'loginf' %}"> {% csrf_token %} <div class="form-group"> <label class="form-control-label">Phone Number</label> <input class="form-control" name="phone" required> </div> <div class="form-group"> <label class="form-control-label">Password</label> <input class="form-control" name="password" required> </div> <!-- <div class="form-group"> <div class="fxt-transformY-50 fxt-transition-delay-3"> <input … -
Django NoReverseMatch at / '{'pk': ''}' not found
django make post detial page NoReverseMatch at / Reverse for 'blog_detail' with keyword arguments '{'pk': ''}' not found. 1 pattern(s) tried: ['post/(?P[0-9]+)/\Z'] how can i fix it please help me templates <header class="mb-4"> {% for list in postlist %} <!-- Post title--> h1><a href="{% url 'blog_detail' pk=post.pk %}" class="fw-bolder mb-1">{{list.title}</a</h1> urls from . import views urlpatterns = [ path('', views.index, name='index'), path('post/<int:pk>/', views.blog_detail, name='blog_detail'), ] views from .models import Post from django.shortcuts import render, get_object_or_404 def index(request): postlist = Post.objects.all() return render(request, 'main/blog_post_list.html', {'postlist':postlist}) def blog_detail(request, pk): post = get_object_or_404(Post, pk=pk) return render(request, 'main/blog_detail.html', {'post': post}) -
Django ELasticBeanstalk error Deploy requirements.txt - EB
So, I was using SQlite but, i switched to MySQL, then i did the command pip install mysqlclient and i connected to the database, did python manage.py makemigrations and python manage.py migratre I only got this message from the log but I guess it's not important: ?: (mysql.W002) MySQL Strict Mode is not set for database connection 'default' HINT: MySQL's Strict Mode fixes many data integrity problems in MySQL, such as data truncation upon insertion, by escalating warnings into errors. It is strongly recommended you activate it. See: https://docs.djangoproject.com/en/4.0/ref/databases/#mysql-sql-mode then i excluded my requirements.txt then i did pip freeze > requirements.txt, did the deploy and did eb logs to get the error below Collecting mysqlclient==2.1.0 Using cached mysqlclient-2.1.0.tar.gz (87 kB) Preparing metadata (setup.py): started Preparing metadata (setup.py): finished with status 'error' 2022/04/25 05:42:23.880429 [INFO] error: subprocess-exited-with-error × python setup.py egg_info did not run successfully. │ exit code: 1 \u2570─> [16 lines of output] /bin/sh: mysql_config: command not found /bin/sh: mariadb_config: command not found /bin/sh: mysql_config: command not found Traceback (most recent call last): File "<string>", line 2, in <module> File "<pip-setuptools-caller>", line 34, in <module> File "/tmp/pip-install-52csz_by/mysqlclient_d55944e3cacc47d8998c991cac209734/setup.py", line 15, in <module> metadata, options = get_config() File "/tmp/pip-install-52csz_by/mysqlclient_d55944e3cacc47d8998c991cac209734/setup_posix.py", line 70, in … -
SystemCheckError: System check identified some issuess:
When I added this profile model then only I am getting this error. I really don't know what to do here. please help me out this. models.py: class Profile(User): user = models.OneToOneField(User, on_delete=models.CASCADE) address = models.TextField(max_length=200,null=False) contact_number = models.PositiveIntegerField(null=False) ut=(('Admin','Admin'),('Operator','Operator'),('Ticket generator User','Ticket generator User'),('Inspector','Inspector'),('User 80','User 80'),('Final Inspection','Final Inspection'),('Maintenance','Maintenance'),('Ticket Admin','Ticket Admin'),) user_type = models.CharField(max_length=200, null=False, choices=ut) Erros: raise SystemCheckError(msg) django.core.management.base.SystemCheckError: SystemCheckError: System check identified some issues: ERRORS: Master.Profile.user: (fields.E304) Reverse accessor for 'Master.Profile.user' clashes with reverse accessor for 'Master.Profile.user_ptr'. HINT: Add or change a related_name argument to the definition for 'Master.Profile.user' or 'Master.Profile.user_ptr'. Master.Profile.user: (fields.E305) Reverse query name for 'Master.Profile.user' clashes with reverse query name for 'Master.Profile.user_ptr'. HINT: Add or change a related_name argument to the definition for 'Master.Profile.user' or 'Master.Profile.user_ptr'. Master.Profile.user_ptr: (fields.E304) Reverse accessor for 'Master.Profile.user_ptr' clashes with reverse accessor for 'Master.Profile.user'. HINT: Add or change a related_name argument to the definition for 'Master.Profile.user_ptr' or 'Master.Profile.user'. Master.Profile.user_ptr: (fields.E305) Reverse query name for 'Master.Profile.user_ptr' clashes with reverse query name for 'Master.Profile.user'. HINT: Add or change a related_name argument to the definition for 'Master.Profile.user_ptr' or 'Master.Profile.user'. System check identified 4 issues (0 silenced). -
Any python/django libraries that convert datetime and timedeltas to phrases like "tonight at 8pm" or "tomorrow evening"?
I'm looking for a python or django library to give me humanized timedates to read like "tomorrow evening at 8pm" or "tonight at 8pm" or "next Monday at 8pm". I've seen django.contrib.humanize and arrow but neither give that level of humanization. Does such a library exist? (Obviously not rocket science to write it myself, but I figure I'm not the first person to want such a thing...)