On Jan 27, 10:54 am, Mirat Can Bayrak <miratcanbay...@gmail.com>
wrote:
> I am drown in documentation. I want to do simple thing. There is a 
> ShortDescription model in my app, which has string = 
> models.CharField(max_length=300), but i want to show it as <textarea> in my 
> admin panel.
>
> I tried some, here
>
> class ShortDescription(models.Model):
>     product = models.ForeignKey(Product)
>     lang = models.CharField(max_length=5,choices=LANGUAGE_OPTIONS)
>     string = models.CharField(max_length=300)
>
>     def __unicode__(self):
>         return self.string
>
> class ShortDescriptionForm(forms.ModelForm):
>     string = forms.CharField(widget=forms.Textarea())
>     class Meta:
>         model = ShortDescription
>
> but no way... can anybody tell me how can i do that? (step by step please)
>
> --
> Mirat Can Bayrak <miratcanbay...@gmail.com>

What do you mean, no way? What happens when you try this?
You're only missing one step, which is to tell the admin for
ShortDescription to use the new form:

class ShortDescriptionAdmin(admin.ModelAdmin):
    form = ShortDescriptionForm
admin.site.register(ShortDescription, ShortDescriptionAdmin)

Does that work for you?
--
DR.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to