Re: Change render of RadioSelect
Karen, That patch is actually kind of beautiful. Just in case someone else is looking at this as of the current codebase the custom renderer would like like this: class MyRenderer(RadioFieldRenderer): def render(self): return mark_safe(u'\n%s\n' % u'\n'.join([u'%s' % w for w in self])) class SearchForm(forms.Form): shape = forms.ChoiceField(widget=forms.RadioSelect(renderer=MyRenderer)) I'd still rather have access to each of the items within the template though. I'm trying to match up each of the radio buttons with an image, and it'd be easier to handle within the template. Thanks, Mike. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Change render of RadioSelect
Hello, I'm trying to manipulate the rendering for RadioSelect so that the form element shows up within my form differently than a . So far I've come across two options... Use straight form tags in my view, or to rework RadioFieldRenderer and RadioInput from widgets.py locally so that I can have a custom renderer. And then use that custom renderer as the renderer for RadioSelect I was wondering if there was a way to bipass these options and just get at the independant radio buttons that make up the RadioSelect. Meaning to be able to get all the 2-tuple key-value pairs that makeup the RadioSelect widget. Thanks, Mike. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Adding ManyToManyField to Django models
Michael, Your opinion on this makes sense and in the end I will probably just go with the wrapper approach, since it probably won't make that much of a difference anyways. My biggest qualm is that I'm trying to put together a strong foundation for the projects I'm working on and feel like this is not the best, but yes I understand why it's like this. The other option you brought up about pulling the auth code will probably get hairy (as you already pointed out). The ModelInheritance stuff does look interesting! Thanks for the input. Discussing stuff like this always helps define the scope of the tools and how to use them... I'm sure I would've wanted to do something similar at some point in the future with my own models and it always helps to know what the boundaries are (at least for now). Mike. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Adding ManyToManyField to Django models
One thing I dislike about the approach that's being pushed by the community, which is to have a one-to-one relationship between auth.User and your own 'Profile' model (or whatever you want to call it) adding all the functionality and relationships to the user-created Model is a bit much. I mean yes it's convenient to use auth.User's prebuilt functionality, but if you're building for the future and want to start off in the right place, this method kind of starts your code in an awkward place. The data model with this approach just feels wrong... The right way to do it is to have two different tables link to eachother and have the database make the bindings for you. I know this simplifies the code a lot and that the DB will probably do a good job with this lookup, but still seems a little awkward to me... --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Adding ManyToManyField to Django models
Evert, the situation is that I was trying to use the auth.User as my model and wanted to have it point to itself. Thereby not having my own model at all. I was curious as well about being able to subclass a prebuilt model, but from the reactions I've gotten towards this, it doesn't seem to be an option... --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Adding ManyToManyField to Django models
I got some help on IRC and here's the conclusion. There is no way to add that mapping from auth.User to itself without hacking the django code, so what needs to happen is that I add a wrapper Model such as 'Profile' and add the ManyToManyField to 'Profile'. Thereby the mappings will happen within the 'Profile' models. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Adding ManyToManyField to Django models
I was wondering if it's possible to add a ManyToManyField onto a prebuilt Django model such as User... I know that it would look like this if I were to have created the model myself: class User(models.Model): watch = models.ManyToManyField('self', null=True, blank=True) I'm unsure how to add features to prebuilt models and wasn't even sure if that was possible. Thanks, Mike. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---