I have a model form that contains a DecimalField() with max_digits set to 5. How do I display this field this way:
<input type"text" size="5" maxlength="5" />
I have a problem with needing to provide multiple model backed forms on the same page. I understand how to do this with single forms, i.e. just create both the forms call them something different then use the appropriate names in the template.
Now how exactly do you expand that solution to work with modelformsets? The wrinkle, of course, is that…
Hi,
I'd like to display a number of forms via a ModelFormSet where each one of the forms displays in turn InlineFormSets for all objects connected to the object.
Now I'm not really sure how to provide the instances for each ModelFormSet. I thought about subclassing BaseModelFormSet but I have no clue on where to start and would like to know…
If I have two forms:
class ContactForm(forms.Form):
name = forms.CharField()
message = forms.CharField(widget=forms.Textarea)
class SocialForm(forms.Form):
name = forms.CharField()
message = forms.CharField(widget=forms.Textarea)
and wanted to use a class based view, and send both forms to the template, is that even…
If my model for Items is:
class Item(models.Model):
name = models.CharField(max_length=500)
startDate = models.DateField("Start Date", unique="true")
endDate = models.DateField("End Date")
Each Item needs to have a unique date range. for example, if i create an Item that has a date range of June 1st to June 8th,…
Given the following models:
class Store(models.Model):
name = models.CharField(max_length=150)
class ItemGroup(models.Model):
group = models.CharField(max_length=100)
code = models.CharField(max_length=20)
class ItemType(models.Model):
store = models.ForeignKey(Store, on_delete=models.CASCADE,…
Hi,
I got a model with 2 fields: latitude and longitude. Right now they're 2 CharFields, but I want to make a custom widget to set it in admin - was thinking about displaying Google Maps, then getting the coordinates of the marker.
But can I have 1 widget (a single map) to set 2 different fields?
I'm trying to write an action that allows the user to select the queryset and copy it to a new table. So:
John, Mark, James, Tyler and Joe are in a table 1( called round 1)
The user selects the action that say to "move to next round"
and those same instances that were chosen are now also in the table for…
I know the short answer because I tried it. Is there any way to accomplish this though (even if only on account of a hack)?
class Ticket(models.Model):
account = modelfields.AccountField()
uuid = models.CharField(max_length=36, unique=True)
created = models.DateTimeField(auto_now_add=True)
…
I am using modelChoiceField to display country and state into address form
class StateSelectionwidget(forms.Select):
""" custom widget to state selection"""
class Media:
js = ('media/javascript/public/jquery-1.5.2.min.js', 'media/javascript/public/countrystateselection.js', )
class…
I'm using Django 1.1.1 stable. When DEBUG is set to True Django flatpages works correctly; when DEBUG is False every flatpage I try to access raises a custom 404 error (my error template is obviously working correctly).
Searching around on the internet suggests creating 404 and 500 templates which I…
Like in this question, except I want to be able to have querysets that return a mixed body of objects:
>>> Product.objects.all()
[<SimpleProduct: ...>, <OtherProduct: ...>, <BlueProduct: ...>, ...]
I figured out that I can't just set Product.Meta.abstract to true or…
Hi,
I am using the built in comment system with Django but it has started to be spammed. Can anyone recommend anything I can use to stop this such as captcha for django etc. I'm looking for something that I can use along with the comment system rather than replacing it.
Thanks
Hello
I am trying to use django-socialauth (http://github.com/uswaretech/Django-Socialauth) for authenticating users for my django project.
This is firs time working with openid and i've had to figure out how exactly this open id works. I have more or less understood it, by now, but there are…
Hello
I am trying to use django-socialauth (http://github.com/uswaretech/Django-Socialauth) for authenticating users for my django project.
This is firs time working with openid and i've had to figure out how exactly this open id works. I have more or less understood it, by now, but there are…
I've implemented a django middleware for getting pages from the database (something similar to the flatpage subframework)
Unfortunately it seems that it is not possible to test it with the django testing framework.
Any suggestion?
Thanks in advance
Update: maybe a mistake in my test but I…
Is it possible to combine a Django Haystack search with "built-in" QuerySet filter operations, specifically filtering with Q() instances and lookup types not supported by SearchQuerySet? In either order:
haystack-searched -> queryset-filtered
or
queryset-filtered ->…
I have a form like:
#forms.py
from django import forms
class MyForm(forms.Form):
title = forms.CharField()
file = forms.FileField()
#tests.py
from django.test import TestCase
from forms import MyForm
class FormTestCase(TestCase)
def test_form(self):
…
Does django-reversion work well with south migrations?
Are django-reversion and south compatible?
Current versions:
- reversion - 1.2.1
- south - 0.7.1
I'm setting up a website using django-cms and when I open up the add page view in the admin, I get this error:
TemplateSyntaxError at /admin/cms/page/add/
Invalid block tag: 'csrf_token'
What could be the problem? I'm using Django 1.1. BTW.
Hello ,
I am doing internationalisation in django admin.I am able to convert all my text to the specific langauge.But i m not able to change the 'app' name
suppose
django-admin.py startapp test
this will create a app called test inside my project.Inside this app…
Hi, I've set django filebrowser's debug to True and wrote the extension restrictions in the model.
pdf = FileBrowseField("PDF", max_length=200, directory="documents/", extensions=['.pdf', '.doc', '.txt'], format='Document', blank=True, null=True)
In django admin it…
I have a Django site in which the site admin inputs their Twitter Username/Password in order to use the Twitter API. The Model is set up like this:
class TwitterUser(models.Model):
screen_name = models.CharField(max_length=100)
password =…
Django has the sites framework to support multiple web site hosting from a single Django installation.
EDIT (below is an incorrect assumption of the system)
I understand that middleware sets the settings.SITE_ID value based on a…