#django

/

      • ASUChander joined the channel
      • sayan joined the channel
      • ragsagar joined the channel
      • mkoistinen joined the channel
      • velocichron joined the channel
      • mkoistin_ has quit
      • geetar joined the channel
      • trustyhank joined the channel
      • al1o has quit
      • Nizumzen has quit
      • al1o joined the channel
      • crazydiamond has quit
      • Genitrust joined the channel
      • rfj001 joined the channel
      • ls3 has quit
      • LysergicDreams has quit
      • il joined the channel
      • Left_Turn has quit
      • Audioburn has quit
      • aweeks has quit
      • brandonw_ has quit
      • aweeks joined the channel
      • aylo joined the channel
      • brandonw joined the channel
      • estebistec has quit
      • backthatzachup joined the channel
      • RileyII joined the channel
      • coderman1 joined the channel
      • coderman1
        if you want to style fields on a form, whats the django way of doing that?
      • FunkyBob
        well, you can apply a class name to their widget's attrs
      • mattmcc
        CSS?
      • FunkyBob
        or target the field by id
      • coderman1
        stackoverflow says "myfield = forms.CharField(widget=forms.TextInput(attrs={'class' : 'myfieldclass'}))"
      • FunkyBob
        well, yes, css...
      • personally, I feel putting presentation decisions in code is wrong...
      • coderman1
        but my IDE doesnt know what widget is
      • il is now known as audioburn
      • FunkyBob
        so what?
      • coderman1
        vendor_name = models.CharField(max_length=250, widget=forms.TextInput(attrs={'class':'input-large'}))
      • TypeError: __init__() got an unexpected keyword argument 'widget'
      • FunkyBob
        no
      • don't confuse Model fields with Form fields
      • coderman1
        oh shit
      • dont know why i didnt think of that!
      • Genitrust has quit
      • govg joined the channel
      • Swambo joined the channel
      • cereal
        hrmmmm...
      • i've got two formsets and i'm rendering them in their own form tags, as a result the view is complaining that the respective management form doesn't exist, thoughts ont he best way to deal with it?
      • mrafiee joined the channel
      • ASUchander1 joined the channel
      • i've thought about checking the post dict to see if the management form exists, but that seems like a bit of a hack
      • also considered using a try, but would prefer not to do that for good reasons
      • ASUchander1 joined the channel
      • naro has quit
      • coderman1
        do i want to use crispyforms?
      • ASUChander has quit
      • FunkyBob
        coderman1: floppy-forms or formulation or django-sniplayes.... from what I've seen of crispy forms, it still moves presentation into code
      • sniplates, even
      • pwnz0r has quit
      • (full disclosure: I wrote formulation and sniplates)
      • GDI has left the channel
      • heyts joined the channel
      • veb is now known as vebb
      • janbrot has quit
      • Destos joined the channel
      • cereal
        coderman1, i've used crispyforms, and it certainly does move presentation into code
      • FunkyBob, interesting, I'll have to look into those, why did you write formulation and sniplates?
      • vebb is now known as veb
      • FunkyBob
        cereal: I wrote the original sniplates a long time ago... from that I got the inspiration for formulatin
      • and then from that, in redesigning it, got the ideas for the new version of sniplates
      • it' all very inceptiony :P
      • cereal
        ah i see
      • happens to pretty much everyone imo
      • I'll seriously have to look into formulation, crispy drives me nuts hah
      • but that's all i've ever heard heh
      • so i stuck with it
      • nonny_t joined the channel
      • FunkyBob
        I'd recommend sniplates
      • cereal scratches head
      • hellwolf has quit
      • cereal
        that seems odd to me?
      • or did I read that in the wrong order?
      • ah, so you wrote sniplates, formulation then redid sniplates
      • missed that ;)
      • FunkyBob
        yep
      • cereal
        I shall read the docs!
      • FunkyBob
        :)
      • acmehandle joined the channel
      • veb is now known as vebb
      • cereal
        FunkyBob, you might consider having a form example int eh docs? I'd imagine that's what most people will need right?
      • though I see how this is more than just simply a form tool
      • that's nice
      • vebb is now known as veb
      • nonny_t has quit
      • geetar has left the channel
      • heyts has quit
      • mkoistin_ joined the channel
      • learner joined the channel
      • acmehandle
        Would like some clarification on formsets. There is formset_factory which is for forms that are not based on a model. There is modelformset_factory which like formset_factory generate many of the same kind of form but forms that are based on a model. Then there is inlineformset_factory which can tie two different forms that are connected by a foreign key.
      • Or rather, more specifically to the model formset aspect, the modelformset_factory and inlineformset_factory generate forms based on models.
      • munichlinux joined the channel
      • You cant actually pass a prexisting form to those formsets
      • mkoistinen has quit
      • And in the case of the formset_factory you would have to pass an existing form to it in order to generate a formset
      • dvl` has quit
      • cereal
        acmehandle, i'm reading what you said
      • i'm working with formsets right now actually so hopefully i can help
      • prajahyle joined the channel
      • necrite joined the channel
      • i'd imagine you might want to look into initial data?
      • FunkyBob
        acmehandle: I thought modelformset_factory was for creating formsets from a model
      • cereal
        if i remember correctly that'll pre-populate your forms if that's what you are trying to get?
      • FunkyBob
        so it creates a formset of ModelForms
      • cereal
        FunkyBob, yeah i think he said it that way
      • acmehandle
        No, I think with modelformset_factory you have to pass the actual model, you dont pass the ModelForm to a modelformset_factory
      • cereal
        correct, you pass the Model and it'll generate the ModelForm's from the model itself
      • you can specify the queryset however
      • acmehandle
        Only with regular formset_factory do you pass a form
      • bibhas joined the channel
      • proteusguy joined the channel
      • cereal
        what are you trying to do?
      • acmehandle
        Ok, wanted to be sure we were on the same page.
      • Not sure yet, I'm trying to figure out of modelformsets are what I need
      • cereal
        you may be able to specify the form class, for the modelformset factory
      • well, what are you attempting to do?
      • acmehandle
        Right, thats where I'm stuck at.
      • cereal
        lol
      • aron_kexp has quit
      • i know that feeling all too well some days :(
      • acmehandle
        some days, and some weeks.
      • I have a form and I want the user to be able to upload photos. So I dont know if I should allow the user to upload photos in the same form as say for example their user profile. Or redirect them to another page specifically for photos
      • cereal
        doesn't look like the formset_factory will let you pass in a Form class, that seems silly
      • anth0ny_ joined the channel
      • FunkyBob
        don't you mean modelformset_factory ?
      • cereal
        but you can provide almost everything you'd hopefully need with a formset, for instance one of my formsets i'm passing in the fields and widgets override
      • FunkyBob, yes
      • stickperson has quit
      • FunkyBob
        if you already have a modelform, you don't need modelformset_factory
      • acmehandle
        To clarify and correct what I was saying. modelformset_factory only accepts models
      • formset_factory only accepts forms
      • FunkyBob
        if you don't have a form, modelformset_factory will build the ModelForm _and_ Formset
      • where's the problem?
      • so...
      • countermeasure joined the channel
      • mandarbel_ joined the channel
      • munichlinux has quit
      • acmehandle
        I dont think you can customize the fields in a modelformset_factory
      • cereal
        yes you can