If you are cleaning the input data (to remove the spaces) then you have this
functionality. Why do you need a further description? Sorry if I'm being
obtuse.
-Tim
On Wed, Feb 24, 2010 at 12:11 PM, jimgardener wrote:
>
>
> On Feb 24, 10:51 pm, Timothy Kinney wrote:
> > You can define a variable
On Feb 24, 10:51 pm, Timothy Kinney wrote:
> You can define a variable called error_message which is None when you pass
> it into the template initially. Then you can fill it with the desired
> message and do something like this:
> {% if error_message %}
> # display some information
Well,ac
You can define a variable called error_message which is None when you pass
it into the template initially. Then you can fill it with the desired
message and do something like this:
{% if error_message %}
# display some information
-Tim
On Wed, Feb 24, 2010 at 11:16 AM, jimgardener wrote:
>
>
On Feb 24, 9:55 pm, Timothy Kinney wrote:
>Just add
> the option *unique=True* when you define the field in the model and the
> database will not allow two entries with the same value for that field.
I have defined the name field to be unique in the model.
name=models.CharField(unique=True
As far as requiring a unique value you can set this in your model. Just add
the option *unique=True* when you define the field in the model and the
database will not allow two entries with the same value for that field. On
the other hand, if you have something like first names and last names you
mi
There's no need to pass 'instance' if you're instantiating your ModelForm with
request.POST. You only need to pass the instance if you already have a specific
model instance programmatically and want to get a ModelForm for it.
You can replace if request.method=='POST': with if request.POST:
Add
hi,
I am new to this framework and was trying out some code..I created a
MySubject model with name and description fields.I am using name as a
unique field and description can be an empty string.I provided add and
edit views as well as a ModelForm.I wanted to deal with the following
usecases.
In
7 matches
Mail list logo