My models:
class Entry(models.Model):
title = models.CharField(_('Title'), max_length=200)
content = models.TextField(_('Content'))
created_at = models.DateTimeField(auto_now_add=True)
My models is used for multi-user. So, how to set a value to handle minimum time between posts? Please give me some codes. Thanks so much!
...
I can see how to add an error message to a field when using forms, but what about model form?
This is my test model
class Author(models.Model):
first_name = models.CharField(max_length=125)
last_name = models.CharField(max_length=125)
created = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_...
I'm trying to redirect users to custom url "/gallery/(username)/" after successfully logging in. It currently redirects to the default "/account/profile/" While I know what I can override the redirect url in my settings.py, my url is dynamic thus it will not work.
Documentation states that I need to use the "next" parameter and contex...
Hi,
Using the django admin application for a date it displays Today | CalendarSymbol. I am using a datefield in my form and I thought it would do this for me how would i go about doing this? As i would normally use the jquery datepicker plugin is this the way to go?
Thanks in Advance,
Dean
...
How do i pre-populate the exclude fields in a ModelFormSet. AuthorFormSet below doesn't take an instance argument here, only queryset. So how do i force the empty forms coming in not to have a NULL/None user attribute. I want to be able to set that user field to request.user
models.py
class Author(models.Model):
user = models.Forei...
I've got some <selects> that I need to populate with some choices that depend on the currently logged in user. I don't think this is possible (or easy) to do from inside the form class, so can I just leave the choices blank and set them in the view instead? Or what approach should I take?
...
My form has a bunch of address fields (street, city, country, province, postal code) that need to be filled out over and over again. To make it easier for the user, I've added a "copy from" selector where they can choose an address they've previously used. When they do this, the form fields are filled in automatically and then disabled. ...
This is my code to get recipe data
objRecipe = models.Recipe.objects.get(id=recipe_id)
recipe = models.RecipeForm(instance=objRecipe)
objRecipeSteps = models.RecipeStep.objects.filter(recipe__id = objRecipe.id)
recipeSteps = models.RecipeStepFormSet(queryset=objRecipeSteps)
I am able to display data from "recipe" but not from "recipe...
Hi guys, how i'll exclude a field in django admin if the users are not super admin?
thanks
...
I've got a form like this:
class SomeForm(forms.Form):
first = forms.IntegerField(max_value= DontWantToSetYet)
second = forms.IntegerField(max_value= DontWantToSetYet)
third = forms.IntegerField(max_value= DontWantToSetYet)
How can I set the max_values at runtime? I.E
if request.method == 'POST':
form = SomeForm(request.POST, ...
Hi guys, i would like to know how force user to fill forms before do something else.
I have a private area, i need the user's fill the forms, there's 4 forms, (is a job's board).
a) i want fill the forms with wizardforms, but how force to do it?
Sorry with my english
Thanks
...
I have successfully uploaded an image using the following code:
views.py
from django.conf.urls.defaults import *
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render_to_response
from django import template
from django.template import RequestContext
from mysite.uploadr.forms import UploadFileFo...
Hi,
I can't see why in my application i am getting this error. As all primary keys are text fields are integers. Here is my code:
forms.py
class EventAttendForm(forms.Form):
talk = forms.ModelChoiceField(queryset=Talk.objects.all())
membersAttended = forms.ModelMultipleChoiceField(queryset=Member.objects.all())
models.py
...
Hi guy's, im trying to use django formWizard, all is fine, but im getting an error in the last step after submit
Traceback (most recent call last):
File "/home/vacantes/webapps/django/lib/python2.6/django/core/handlers/base.py", line 100, in get_response
response = callback(request, *callback_args, **callback_kwargs)
File "/h...
Hello everyone.
I have this code that works. My class is a db.Model one2many with a teacher, experience, and so on...
What I want is to call the class teacher with forms, but also intend to include other classes, like a form from experience class and a form from category.
These classes are as foreign Key teacher.
I wonder how to derive...
If there were field.errors in django, how to to add css class to {{ field }}, example at bottom
{% for field in form %}
{{ field }}
{% if field.errors %}{{ field.errors }}{% endif %}
{% endfor %}
Aiming for {{ field }} input type that would have "class=error" when ever there was an error
<input class="error">
...
I have a many to many relationship model which actually shows as a multi select list on forms. In one particular place I want to show it as dropdown single selection - any idea how to do this?
...
How do I wrap a Django Form Wizard in a view? I need to do this so I can access request.
Does anyone have some example code for this?
...
Hi guys,
Is there any analog of django's forms in Ruby on Rails?
Thanks,
Alexey Zakharov
...
I have an Article form that can have 0-5 images attached so I am using a normal form for article and a formset for the images. Is there way to make it optional to fill out any information for the forms in the image formset? When I leave them I get validation errors that I have not field out required fields.
...