Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
JBoss error: org.jboss.as.controller.management-operation] (Controller Boot Thread) keycloak
i am trying to integrate postgres db with keycloak in docker. i updated standalone.xml with postgres drive. still getiing error "[org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([" . anyone have idea what it failing. --------------dockerfile------- FROM jboss/keycloak:latest ENV KEYCLOAK_ADMIN_USER admin ENV KEYCLOAK_ADMIN_PASSWORD admin COPY standalone.xml /opt/jboss/keycloak/standalone/configuration/standalone.xml COPY init.sh USER root ENTRYPOINT [ "bash", "./init.sh" ] -------------------------------init.sh----------- /opt/jboss/keycloak/bin/standalone.sh -b 0.0.0.0 -Djboss.socket.binding.port-offset=1010 -----------------------------docker-compose----------- version: '2' services: app: build: ./app ports: - "8000:8000" volumes: - ./app:/app command: > sh -c "python manage.py migrate && python manage.py runserver 0.0.0.0:8000" environment: - DB_HOST=postgres - DB_NAME=idm_keycloak_demo - DB_USER=postgres - DB_PASS=admin depends_on: - postgres keycloak: restart: always build: ./keycloak environment: - KC_PG_HOST=postgres - POSTGRES_DATABASE=idm_keycloak_demo - KC_PG_USER=postgres - KC_PG_PASSWORD=admin depends_on: - postgres postgres: image: postgres:10-alpine ports: - "5432:5432" environment: POSTGRES_USER: 'postgres' POSTGRES_PASSWORD: 'admin' POSTGRES_DB: 'idm_keycloak_demo' -----------standalone.xml------------ jdbc:postgresql://localhost:5432/idm_keycloak_demo postgresql 20 postgres admin org.postgresql.Driver -
Writing To Another Related Table Django
I have a table that logs points a student accumulates throughout the day, during the coarse of that day students can earn recess. I have two tables one that stores points and the other that stores if a child earned recess which are just straight Boolean fields. What i am trying to accomplish. # Checks To See If a Student Gets Recess Bonus today_date = datetime.datetime.now().date() morning_recess = "" lunch_recess = "" afternoon_recess = "" if grand_total >= 20 and K8Points.objects.filter(time_frame=1).filter(created_at__date = today_date ).filter(created_at__hour__lte = 10) and K8Points.objects.filter(time_frame=2).filter(created_at__date = today_date ).filter(created_at__hour__lte = 10) and K8Points.objects.filter(time_frame=3).filter(created_at__date = today_date).filter(created_at__hour__lte = 10): morning_recess = "Bonus Won" <--- code to write to other table should be here! morning_recess is just a dictionary that is showed on my html, what should happen after bonus one is create a record in the other table which logs all the recess for all the students who won. How do i go about writing to another table ? Table: Recess Name: Date : Recess: John Smith 02-04-2020 Yes -
Display Forms with specific Cell-Value dependent from Table-Cell-Value
I've got a new problem ^^# I want to Display Forms with specific Table-Cell-Value dependent from Table-Cell-Value. That means: TableMain got : id:2 KN:1 Name:Olaf Table1 got : id:234 KN:1 Key:123-klj-234-ilk Table2 got : id:253 KN:3 Key:ölk-125-kli-1k2 if Table1.KN == TableMain: show(form table1 where Table1.KN==TableMain.KN) if Table2.KN == TableMain: show(form table2 where Table2.KN==TableMain.KN) I tried some things but it did not work as expected. I hope you can help me :D views.py @login_required() def Info_anlegen(request, id=None): item = get_object_or_404(Kunden, id=id) if WindowsPro.KN == Kunden.KN: winhomeform_form = InfoWinForm(request.POST or None, instance=item) if WindowsHome.KN == Kunden.KN: winhomeform_form = InfoWinForm(request.POST or None, instance=item) kontaktform_form = InfoForm(request.POST or None, instance=item) if kontaktform_form.is_valid(): return redirect('/Verwaltung/KontaktAnlegen') else: form = acroniform(instance=item) return render(request, 'blog/infokontakt.html', {'kontaktform_form': kontaktform_form, 'winhomeform_form': winhomeform_form}) infokontakt.html {% extends 'blog/base.html' %} {% load bootstrap4 %} {% block supertitle %} InfoPage {% endblock %} {% block Content %} {% load static %} <html> <div class="p-2 mb-1 bg-white text-black"> <head> <div class="d-flex justify-content-center align-items-center container "> <img src="{% static 'blog/Gubler.jpeg' %}" alt="Gubler" height="300" width="700"> </div> </head> <br> <body> <form class="form-row" action="" method="post"> <div style="margin-left: 2.5em;"> <font color="black"> <div class="col-sm-10 col-form-label"> {% csrf_token %} {% bootstrap_form kontaktform_form %} </div> </font> </div> </form> <form class="form-row" action="" method="post"> <div style="margin-left: … -
Cannot view users in django admin
I cannot view users in django admin. All I see is groups under the header authentication. I have a functional app where users can create profiles. I assumed I would be able to see the profiles that have been created in admin in order to authenticate users and change their roles -
Django Admin actions, queryset group by values in list of many to many relationship
I have an action that exports the data to a .csv file. If the relationship is a foreign key, it works 100% but when I have a many to many relationship, the result replicates the data for each connection: models.py class Provider(models.Model): country = models.CharField('Country', max_length=100) state = models.CharField('State/Province', max_length=100) ... specialty_tags = models.ManyToManyField(TagSpecialty, blank=True, verbose_name='Tags') ... admin.py class ProviderAdmin(admin.ModelAdmin): def export_to_csv(self, request, queryset): response = HttpResponse(content_type='text/csv; charset=windows-1252') response['Content-Disposition'] = 'attachment; filename="prestadores.csv"' writer = csv.writer(response, delimiter=';') writer.writerow(['Provider Name', 'Provider Last Name', 'Email', 'OAB', 'OAB Active?', 'Main Specialty', 'Tags Specialty', 'Time Experience', 'Adress']) providers = queryset.values_list('user__first_name', 'user__last_name', 'user__email', 'oab_number', 'main_specialty__title', 'specialty_tags__tag', 'time_experience', 'city', 'state', 'country') for provider in providers: writer.writerow(provider) return response The result is based on each specialty_tag that the provider has: ['Andy', 'Smith', 'andysmith@xyz.com', 123123, 'Creative', 'Tag_1', 11, 'City X', 'State Y', 'Country Z'] ['Andy', 'Smith', 'andysmith@xyz.com', 123123, 'Creative', 'Tag_2', 11, 'City X', 'State Y', 'Country Z'] ['Andy', 'Smith', 'andysmith@xyz.com', 123123, 'Creative', 'Tag_3', 11, 'City X', 'State Y', 'Country Z'] ['Andy', 'Smith', 'andysmith@xyz.com', 123123, 'Creative', 'Tag_7', 11, 'City X', 'State Y', 'Country Z'] ['John', 'Doe', 'johndoe@xyz.com', 321321, 'Futuristic', 'Tag_2', 9, 'City A', 'State B', 'Country C'] ['John', 'Doe', 'johndoe@xyz.com', 321321, 'Futuristic', 'Tag_9', 9, 'City A', 'State B', 'Country C'] … -
How is it possible to duplicate HTTP headers?
I am running Django with the help of Gunicorn behind Nginx. I was adding some headers to the response using Nginx but then I decided to write middleware in Django which will do the same. I was adding some values to the header Access-Control-Allow-Headers. I added the middleware but forgot to remove the Nginx conf which was adding the headers. So, both the layers ended up adding headers. I later checked out the response in the browser which actually surprised me. Here is the screenshot of the response, So that brings me to the question, how is this possible? Is Django's response a different object and Nginx's response different? What exactly is the structure of the response object? -
Installable plugins like in Wordpress written in Django
I am in the middle of a hobby project, and I am about to make some functions, that in the theory wouldn't be suitable for all, like a webshop add-on. It's a project to learn and have fun, but I went in some doubts, why I reach out. So let's say the standard core code is a blog, just like Wordpress. Let's then say I wanna make some plugins, that I want to be installable, but not integrated by default, so it's not filling out urls.py, without being used, as an example. How would I do this smartest? -
How to generate model classes in python from sqlite3 file
I want to generate the model for my application from a .sqlite3 file. Is there a quick and painless way to scaffold the file and generate automatically the classes from the tables? -
django cant access mysql docker compose
this is my docker-compose file version: '3' services: djangoSql: restart: always network_mode: bridge container_name: djangoSql image: mysql volumes: - .:/code environment: MYSQL_DATABASE: test1 MYSQL_ROOT_PASSWORD: 1234 ports: - 6044:3306 healthcheck: test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"] interval: 2s timeout: 20s retries: 10 web: build: . network_mode: bridge volumes: - .:/code ports: - "8000:8000" image: django environment: WAIT_HOSTS: djangoSql:3306 WAIT_HOSTS_TIMEOUT: 300 WAIT_SLEEP_INTERVAL: 30 WAIT_HOST_CONNECT_TIMEOUT: 30 depends_on: - djangoSql links: - djangoSql:mysql this is my error django.db.utils.OperationalError: (1045, 'Plugin caching_sha2_password could not be loaded: /usr//usr/lib/x86_64-linux-gnu/mariadb19/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory') the url has two usr i dont know why -
Django query does not update when database changes
I have a weird problem, I think it comes from the cache between django and postgres but not so sure. I have multiple tables in database but the problem only happens with one of them. Let's say the SpeakingSession table. Everytime I make a change like add a new instance, edit an instance, the call api request does not return the change; the data is only updated when I restart the apache2 server. For example: I have 7 SpeakingSession records, then I add a new one. But the print command below returns 7. class SpeakingSessionViewSet(viewsets.ModelViewSet): queryset = SpeakingSession.objects.all() def list(self, request): print(self.queryset.count()) return super(SpeakingSessionViewSet, self).list(request) So I restart the apache2 server, then it returns 8. Any idea how to fix this problem? Thank you very much! This is my model and my serializer: class SpeakingSession(models.Model): sessionDefinition = models.ForeignKey('SessionDefinition', on_delete=models.CASCADE) startTime = models.TimeField() endTime = models.TimeField() participants = models.ManyToManyField('Profile', default=None, blank=True) class SpeakingSessionSerializer(serializers.ModelSerializer): class Meta: model = SpeakingSession fields = ('id', 'sessionDefinition', 'startTime', 'endTime', 'participants') -
pdfkit django in digitalocean
pdfkit works in the local machine everything works successfully displays as pdf, but in digitalocean sends to the server error 500, why? views.py from django.shortcuts import render, redirect, get_object_or_404 from django.http import HttpResponse from django.template.loader import get_template import pdfkit from .models import Buses def pdf(request, id): bus = Buses.objects.get(id=id) template = get_template('buses/pdf.html') html = template.render({'bus': bus}) options = { 'page-size': 'Letter', 'encoding': "UTF-8", } pdf = pdfkit.from_string(html, False, options) response = HttpResponse(pdf, content_type='application/pdf') response['Content-Disposition'] = 'attachment; filename="{}_{}.pdf"'.format(bus.company, bus.name) return response -
Django model field to image in static folder
I am trying to make a Django model of a game with fields for a name and also a cover image that is located in the static folder of the app. def game_covers_path(): return os.path.join(settings.STATIC_URL, 'some_app/games/') class Game(models.Model): name = models.CharField(max_length=100, primary_key=True) cover = models.FilePathField(path=game_covers_path, null=True) def __str__(self): return self.name My folder structure is as follows: . ├── db.sqlite3 ├── my_app │ ├── __init__.py │ ├── asgi.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── manage.py └── some_app ├── __init__.py ├── admin.py ├── apps.py ├── migrations ├── models.py ├── static │ └── some_app │ ├── games │ │ ├── Counterstrike:\ Global\ Offensive.jpg ├── templates ├── tests.py ├── urls.py └── views.py But when I open the admin page I get the following error: FileNotFoundError at /admin/some_app/game/add/ [Errno 2] No such file or directory: '/static/some_app/games/' How can I correctly reference images in the static folder of an app in the database? Also does the FilePathField check if the a file exists before saving a model? Because I tried adding random values and it saved it, but in the documentation its written that you can only choose a file that already exists... -
django - how to receive a dictionary in api_view?
I have followed this article and made a sample api program. I now want to make the app receive dicts(json format; key&value pairs) and process them. I couldn't make it to work. I have made an app and here is the code in views.py of the app of my project. from django.shortcuts import render from django.http import Http404 from rest_framework.views import APIView from rest_framework.decorators import api_view from rest_framework.response import Response from rest_framework import status from django.http import JsonResponse from django.core import serializers from django.conf import settings import json # Create your views here. @api_view(["POST"]) def IdealWeight(heightdata): try: height=json.loads(heightdata.body) weight=str(height*10) return JsonResponse("Ideal weight should be:"+weight+" kg",safe=False) except ValueError as e: return Response(e.args[0],status.HTTP_400_BAD_REQUEST) this is made to take a single value and return the value multiplied by 10; and this works with no problems. here is what i tried to use a json format call(a dict): in try, i made changes like: a_dict = json.loads(heightdata.body) weight = a_dict['a']+a_dict['b] it doesn't work for: {'a':1,'b':2} what changes do i make to use a dict and return a list. -
How to add dynamic ip for axios
I am building an app using react & django rest framework.I can access all of data via axios url (127.0.0.1:8000). But when i deploy it to azure for production then the axios ip needs to change by azure container ip for requesting to the url. What is the best way to do this for production? -
Could I use the gmail API to send mail instead of djangos send_mail() function?
I've been trying to find out how to keep track of how many emails I'm allowed to send in any given day through the gmail SMTP server. I've read that through gmail SMTP you can send 150-200 emails a day but there is no way to keep track unless maybe you make a model or a few functions to attempt to keep track and manage the amount of emails that are sent (No idea if the functions would work instead of having to use a model). I looked into their API and noticed they don't have a convenient way to keep track of how many emails you've sent in a day there either. So I was wondering if I could just write a few functions to interact with the API and send it through there rather than through the SMTP server. If I could do that then I wouldn't have to worry about keeping track of how many emails are sent. I'm only sending a max of 400 emails total and I don't think I would hit the daily limit but it's good to prepare for the worst and hope for the best. I don't need any help with the … -
I need to filter, based on a count, and return values in Python
How do I filter this for only the courses where course_enrollment = 0, where courses = Course.objects.values('subject','course_title','grade_level_standards','day','roster_cap','zoom_link','syllabus_link','sped','ell','creation_date','course_teacher__first_name','course_teacher__last_name').annotate(class_time=Concat('hour', V(':') ,'minutes',V(' '),'am_pm')) -
What is the simplest way to include a hidden field when using Django's generic editing views
I would like to pass a hidden form field but still take advantage of Django's Createview and not have to build a custom form. Something like: class ObjectCreateView(CreateView): model = Object fields = ['title','content','rating'] Where I'd like rating to be hidden. I thought something like: fields['rating'].widget = forms.HiddenInput() might work, but of course it doesn't. Any ideas? -
aws "eb create" fails - CalledProcessError: Command '/opt/python/run/venv/bin
I want to deploy this wagtail app on aws elasic beanstalk. I tried to follow this tutorial (tutorial from aws docs gave similiar output). After running eb create, I get errors, see below. I would appreciate any help/letting me know how can I fix that issue, fell free to ask about more details. Thank you. Tracebacks/outputs are below. Full CLI output of command: $ eb create Enter Environment Name (default is KetoWatahapl-dev): Enter DNS CNAME prefix (default is KetoWatahapl-dev2): Select a load balancer type 1) classic 2) application 3) network (default is 2): Would you like to enable Spot Fleet requests for this environment? (y/N): Creating application version archive "app-59f08-200204_165232". Uploading: [##################################################] 100% Done... An environment with that name already exists. Enter Environment Name (default is KetoWatahapl-dev2): Environment details for: KetoWatahapl-dev2 Application name: KetoWataha.pl Region: eu-west-2 Deployed Version: app-59f08-200204_165232 Environment ID: e-d2bhkaxyjb Platform: arn:aws:elasticbeanstalk:eu-west-2::platform/Python 3.6 running on 64bit Amazon Linux/2.9.5 Tier: WebServer-Standard-1.0 CNAME: KetoWatahapl-dev2.eu-west-2.elasticbeanstalk.com Updated: 2020-02-04 16:53:59.028000+00:00 Printing Status: 2020-02-04 16:53:57 INFO createEnvironment is starting. 2020-02-04 16:53:59 INFO Using elasticbeanstalk-eu-west-2-937659118370 as Amazon S3 storage bucket for environment data. 2020-02-04 16:54:19 INFO Created target group named: arn:aws:elasticloadbalancing:eu-west-2:937659118370:targetgroup/awseb-AWSEB-11WD0ELT384UU/3b39ac8f6d0588e2 2020-02-04 16:54:19 INFO Created security group named: sg-0f6f6ff7efea6a00f 2020-02-04 16:54:35 INFO Created security group … -
problem with database setting using Django.Getting an error "supply engine value"
I'm new to Django and I downloaded a entire project to play with it and get familiar with the architecture. However, I tried to configure the settings.py file and now I want to create a superuser using the command: python manage.py createsuperuser Unfortunately the superuser cannot be created because of an improper configuration of the Database in the settings.py file. Indeed, I'm getting a "Supply engine value" error. Here is the settings.py file: import os import datetime import raven # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'XXXXXX' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = False ALLOWED_HOSTS = ['.vipsace.org', 'localhost'] # Application definition INSTALLED_APPS = [ 'website', 'portalapp', 'library', 'cloudinary', 'raven.contrib.django.raven_compat', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'social_django', 'admin_email_sender', 'multiselectfield', ] # 'django_imgur', # 'easy_thumbnails', # 'filer', # 'mptt', # 's3direct', MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'raven.contrib.django.raven_compat.middleware.Sentry404CatchMiddleware', 'raven.contrib.django.raven_compat.middleware.SentryResponseErrorIdMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'social_django.middleware.SocialAuthExceptionMiddleware', ] ROOT_URLCONF = 'ace.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', … -
delete disabled attribute using javascript in Django
I wanted to make the disabled attribute false, but it doesn't work. here is my code. here ins my base.html {% load static %} <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <link rel="stylesheet" type="text/css" href="{% static 'css/duty.css' %}"> <script src="{% static 'js/duty.js' %}"></script> <title></title> </head> <body> {% block content %} {% endblock %} </body> </html> here is my duty.html {% extends 'base.html' %} {% block content %} <h1>duties and details for TA</h1> <p>#student:{{ course.capacity }}</p> <form> <table border="2" bordercolor="black" width="800" height="500" cellspacing="0" cellpadding="5"> <tr> <th>classification</th> <th>times</th> <th>teaching activity</th> <th>Approx. hours/student</th> </tr> <tr> <td rowspan="3">Lab</td> <td rowspan="3"><label><input class="duty" type="text" disabled="disabled" value="{{ taDuty.labNumber }}"></label> </td> <td>preparation</td> <td><label><input class="duty" type="text" disabled="disabled" value="{{ taDuty.preparationHour }}"></label></td> </tr> </table> <button onclick="modification()">modify</button> <button type="submit">save</button> </form> {% endblock %} here is my duty.js function modification() { let node = document.getElementsByClassName('duty'); for (let i = 0; i < node.length; i++) { node[i].disabled = false; } } my javascript function can be called. I tried to add alert() and it works, but I the disabled attributed can't be set false. I don't know why. Thank you for any help! -
Django transaction dont rollback when exception is occurred
I have following view: def directions_import_view(request): """ Import directions from family ambulance """ form = ImportDirectionsForm() if request.method == "POST": form = ImportDirectionsForm(request.POST, request.FILES) if form.is_valid(): sid = transaction.savepoint() try: # parse patients parsed_patients = parse_foreign_patients_by_doc(request.FILES['file']) # save patient and direction to db for foreign_patient in parsed_patients: created_patient = foreign_patient.save_patient_to_local_db() analysis_name = LabAnalysisTypeModelHelper.get_name_by_type( form.cleaned_data.get('to_analysis')) direction = Direction( serial_no=created_patient.number_card, who_send='ЦПМСД №1', who_is_doctor=foreign_patient.doctor, analysis_type=form.cleaned_data.get('to_analysis'), analysis_name=analysis_name, date=form.cleaned_data.get('date'), patient=created_patient ) direction.save() messages.add_message(request, messages.INFO, 'Створено ' + str(len( parsed_patients)) + ' направлень на ' + analysis_name) return redirect(reverse('direction_list')) except Exception as e: print('exception is occured') transaction.rollback() transaction.savepoint_rollback(sid) return render(request, template_name='error.html', context={'error_messages': [str(e)]}) return render(request, 'directions/import_directions.html', {'form': form}) parsed_patients = parse_foreign_patients_by_doc(request.FILES['file']) have cycle in it and its parsing docx table rows, if table cell for patient name is wrong formatted it throwing an exception. I have docx with 20 table rows, 15 of them ok, but other is not. So its throwing exception. When exception occurred, view is handling it, but transaction dont rollback, 15 of 20 patients persists to the database. P.S. I`m using sqlite. -
In Django, what is a function that an output safe YAML data?
I'm using Python 3.7, Django 2.0. I'm trying to write a script that will output YAML data. Normally I just use "print" print(" street:",street) but this fails to be valid YAML data if the scalar contains characters (e.g. ":") that are used by the YAML parser. Is there any existing Django function that can output a safe scalar for digestion by a YAML script? -
Django-CMS: Is there any user permissions arrangement to ONLY allow logged in users to switch between viewing Published / Live page content?
I want to create a User Group which can view the unpublished version of a page, but not make any edits to the page content or page settings. I have partly accomplished this by creating a group with the following permissions: cms | page | Can view page cms | page | Can change page cms | page | Can edit static placeholders and setting the page-level permissions so that this group 'CAN EDIT' only. I needed to include the 'Can change page' Group permission and the page level 'CAN EDIT' permission as excluding either of them prevented the user from being able to toggle the View Published / Edit button in the toolbar. I needed to include the 'Can edit static placeholders' to view the unpublished static footer. With this permissions arrangement, this user group cannot make any changes using the front end editing functionality, but they can still use the admin interface to: change the page settings, such as the page title and slug set publishing dates Revert to live version Is there any other permission arrangement that can allow the user to toggle between the live and published page version, but prevents them from making any changes … -
From Django friendship model can we get the posts only from the users that a user follows
From Django friendship model can we get the posts only from the users that a user follows. Similiarly when a user block any other user will their post show? -
Is Django 3.0 compatible with Jinja2 when rendering forms?
I am using Jinja2 (via django-jinja 2.3.1) in my Django 3.0 project. It renders the templates fine, however when I want to display a {{ form }} such as in a LoginView I get the following error: expected token 'end of print statement', got ':' I traced this back to the input widget in django/forms/templates/django/forms/widgets/input.html, which renders as follows: <input type="{{ widget.type }}" name="{{ widget.name }}" {% if widget.value != None %} value="{{ widget.value|stringformat:'s' }}" {% endif %}{% include "django/forms/widgets/attrs.html" %}> It would appear Jinja doesn't accept |stringformat:'s', is this correct? Does this mean it is not compatible with Django forms? Perhaps I am missing something?