2008-3-24
| 23:27 | axiak | and proofs :) |
| 23:28 | axiak | wmealin1: maybe when you finish writing a completely generalized solution, you can prove godel wrong :P |
| 23:28 | truebosko | How would one exactly pass data to a form? I'm trying to fetch the data from my model, and then do: registration_form = RegistrationFormBigfootProfile(profile) but it's a no go. Any hints? |
| 23:28 | Zal | Yuchant reload? No. |
| 23:29 | Zal | truebosko what is RegistrationFormBigfootProfile? |
| 23:29 | ales | truebosko: you have to override form's __init__ |
| 23:30 | truebosko | Zal - It's my registration form with profile fields .. I guess if I want to make one where the user can EDIT the fields I need to make a new one? |
| 23:30 | __machine | where is the code that converts form data into python data types? |
| 23:30 | Zal | truebosko instance=profile |
| 23:31 | truebosko | Zal - What do you mean? |
| 23:32 | Zal | truebosko RegistrationFormBigfootProfile(instance=profile) |
| 23:32 | truebosko | Hmm |
| 23:33 | truebosko | I get unexpected keyword argument `instance` with that .. I assume |
| 23:33 | truebosko | I need to modify my class somehow |
| 23:33 | Zal | I guess it's not a newform |
| 23:33 | Zal | er, I mean a ModelForm |
| 23:34 | truebosko | Let me dpaste it |
| 23:34 | truebosko | I created it with some help, so Im not too keen on the inner workings of it but I had other things to worry about in my project at the time ;p |
| 23:35 | truebosko | |
| 23:35 | truebosko | I used django-registration |
| 23:35 | truebosko | And the guy who helped me wrote that save method up for me |
| 23:35 | Zal | I don't know anything about django-registration |
| 23:36 | truebosko | Ah |
| 23:36 | avn | hi guys, how to mix ModelForm and django.contrib.formtools.preview? |
| 23:36 | truebosko | I dont think it matters if I use django-registration in this case or not but yah, just wanted to point it out |
| 23:37 | mattmcc | avn: Doesn't it just work? A ModelForm is still a newforms Form. |
| 23:38 | avn | mattmcc: I want to fill one field to name of currently logged user. |
| 23:39 | Zal | truebosko well, that's where the form is coming from, so if it's not a newform, I don't know what it is. |
| 23:39 | avn | I try to hook .save() but Preview.done() pass only cleaned_data not form itself |
| 23:40 | truebosko | Zal - I see, ok |
| 23:41 | avn | mattmcc: and I don't know -- how to pass form with "loaded" data to Preview |
| 23:46 | KarlsBerg_ | Holas |
| 23:48 | __machine | what's the nicest way for me to get all CharFields stripping their values before validating them? I could make a StrippedCharField form field, but i use ModelForm a lot and that will still default to forms.CharField, won't it? or can i specify in my model or elsewhere which form field to use for those fields? |
| 23:50 | Zal | |
| 23:50 | __machine | right, so I need to specify the field in each ModelForm |
| 23:52 | jSnow | anyone got a link on how to do more complicated things in html templates |
| 23:53 | jSnow | i want to do if statements |
| 23:53 | jSnow | i already use for loops |
| 23:53 | mattmcc | Did you read the template docs? |
| 23:53 | WickedMetalHead | djangoproject.com under docs |
| 23:53 | jSnow | will go look |
| 23:53 | __machine | most of my model forms do not require any customising (except for this), so i have a helper method which creates a ModelForm for a given model... i would not be able to use that anymore as 'd need to declare each ModelForm... or write some code to loop- through the model fields looking for CharField to override? |
| 23:54 | Zal | __machine the latter sounds like a workable option |
| 23:56 | s3phiroth | on newforms, isn't there a field for passwords ? |
| 23:57 | s3phiroth | errr |
| 23:57 | s3phiroth | forget that |
| 23:57 | s3phiroth | and i actually meant a widget :) |
| 23:57 | s3phiroth | but ctrl+f is my friend |
| 23:58 | __machine | would that be something like... class Form(forms.ModelForm): for f in m._meta.fields: if f.get_internal_type() == 'CharField': setattr(self, f.name, StrippedCharField()) ? |
| 23:58 | Zal | __machine I think you'll have to adjust self.fields, not self |
| 23:59 | Zal | I never heard of get_internal_type. Does it really return a string? |
| 23:59 | Zal | (I've always just used isinstance) |
Page 33 of 33
← Previous
(3,252 total)