Thanks! I think that's exactly what I need, but I still can't quite make
it work. If you'll bear with me, here's my model:
class MyProfile(models.Model):
user = models.OneToOneField("auth.User")
updated = models.DateField(auto_now=True)
postalcode = models.CharField(max_length=50)
skills = models.ManyToManyField(Skill)
and my form:
class MyProfileForm(ProfileForm):
class Meta(ProfileForm.Meta):
widgets = {
'skills': forms.TextInput(),
}
The "widgets" setting doesn't seem to affect my form at all; I'm still
getting a multi-select. I know that this form class is being used, because
if I have an error, it causes the page not to work :)
Thanks again for your help.
On Thursday, October 2, 2014 4:22:32 PM UTC-4, Josh Cartmell wrote:
>
> I would use the ACCOUNT_PROFILE_FORM_CLASS to specify your own profile
> form,
> https://bitbucket.org/stephenmcd/mezzanine/src/ac4822d66090cef9b29e4477d9192a63431d4f28/mezzanine/accounts/defaults.py?at=default#cl-41
>
> Inherit from the default form and you can override the widget for the m2m
> and specify the widget. Look at the first example here:
>
> https://docs.djangoproject.com/en/dev/topics/forms/modelforms/#overriding-the-default-fields
>
> On Thu, Oct 2, 2014 at 11:12 AM, Joel Gwynn <[email protected]
> <javascript:>> wrote:
>
>> Thanks, Josh. I think I understand. The Django documentation assumes
>> that I'll be creating my own ModelForm class, but I'd imagine that in
>> Mezzanine I'd want to use the existing mezzanine.accounts.ProfileForm
>> class. So how do I tell the ProfileForm class to use my widget for my
>> MyProfile class field?
>>
>> On Thursday, October 2, 2014 10:29:50 AM UTC-4, Josh Cartmell wrote:
>>>
>>> Hey Joel, there is nothing specific in Mezzanine that will help you
>>> accomplish that. What you will need to do is create a custom widget for
>>> the field (or find one somewhere that does what you want). Here is the
>>> Django documentation on widgets:
>>>
>>> https://docs.djangoproject.com/en/1.7/ref/forms/widgets
>>>
>>> On Wed, Oct 1, 2014 at 1:15 PM, Joel Gwynn <[email protected]> wrote:
>>>
>>>> On Wednesday, October 1, 2014 12:05:54 PM UTC-4, Joel Gwynn wrote:
>>>>>
>>>>> I'm just starting out with Mezzanine, and I'd like to know what's the
>>>>> mezzanine way to add an auto-complete input to the user profile page.
>>>>> I've
>>>>> extended the user profile with a OneToOneField, and I'd like to add an
>>>>> auto-suggest input on the user's profile management page.
>>>>>
>>>>>
>>>> Sorry, I should have said, it's a ManyToManyField, and I want to
>>>> replace the multi-select with an auto-complete text field.
>>>>
>>>>
>>>>> TIA,
>>>>> Joel
>>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Mezzanine Users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>> --
>> You received this message because you are subscribed to the Google Groups
>> "Mezzanine Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
You received this message because you are subscribed to the Google Groups
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.