Hi there:
I have this model for example
class Categories(models.Model):
name = models.CharField(max_length=30)
which holds this data on the DB
+----+--------------+
| id | name |
+----+--------------+
| 1 | Musica |
| 2 | Programacion |
| 3 | Libros |
| 4 | Politica |
| 5 | Humor |
| 6 | Basura |
| 7 | Varios |
How come now, everytime I create a form with either this
class PostForm(ModelForm):
post = forms.CharField(widget=forms.Textarea({'rows': '20', 'cols':
'75'}))
class Meta:
model = Post
exclude = 'id'
or this
class CategoriesForm(forms.Form):
categories = forms.ModelChoiceField(queryset=Categories.objects.all())
It shows this HTML output on the select field?
<tr><th><label for="id_categories">Categories:</label></th>
<td><select name="categories" id="id_categories">
<option value="" selected="selected">---------</option>
<option value="1">Categories object</option>
<option value="2">Categories object</option>
<option value="3">Categories object</option>
<option value="4">Categories object</option>
<option value="5">Categories object</option>
<option value="6">Categories object</option>
<option value="7">Categories object</option>
</select></td></tr>
What is going on here? Am I missing something now? I've been doing this for
a long time and I guess I forgot something
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---