#django

/

      • atula joined the channel
      • PKKid
        caruso_g, I used SASS and LESS before. I like LESS better for nothing other than personal preference
      • bennylope
        dmclain, the as_view method sets all keyword arguments passed but it first checks that they're attributes on the class first
      • cyberdelia has quit
      • so I guess saying it sets "all" keywords arguments passed is not quite correct
      • dmclain
        yeah, that seems like a reasonable behavior, i just missed the detail that there was an actual error being thrown
      • PKKid
        Weird, I get CSS in Chrome.. but not FF
      • olarva joined the channel
      • anuvrat joined the channel
      • caruso_g
        PKKid: yep, firefox here
      • skeet70 has quit
      • PKKid
        caruso_g, Weird.. the CSS file is being loaded in FF.. just not applied..
      • simantel
        Is there a way to filter by values in my template? I'm sorting contacts by unique addresses, but then i want to list the people who live at each address (assuming there can be multiple people at a given address). Right now I'm passing the list of unique addresses and the list of all contacts to my template.
      • briancray has quit
      • PKKid
        caruso_g, Firefx is being picky and hates that I defined my file type as "text/less" instead of "text/css" -- annoying FF.. :-P
      • andredieb joined the channel
      • anth0ny has quit
      • Guddu
        I tried using this code als but does not work http://twigstechtips.blogspot.com/2012/04/djang...
      • Could someone guide me?
      • caruso_g
        PKKid: :) interesting. where did you find it?
      • cyberdelia joined the channel
      • kenbolton joined the channel
      • estebistec joined the channel
      • briancray joined the channel
      • PKKid
        caruso_g, exit2: Thanks guys.. should be fix now.. can one of you confirm?
      • exit2
        PKKid: looks good
      • PKKid
        thanks
      • myusuf3 joined the channel
      • caruso_g
        PKKid: yep, so much better. :)
      • cyborg-one has quit
      • iiie
        simantel: like the regroup template tag? https://docs.djangoproject.com/en/dev/ref/templ... I don't use it but it's sounded like a good answer to me twice now in under 2 hours...
      • juliaelman has quit
      • hubx has quit
      • PKKid
        I wouldn;t have expected firefox to be the annoying one from the bunch. :)
      • caruso_g
        PKKid: adding your RSS and and following on Bitbucket
      • PKKid
        caruso_g, I'm not that interesting, but thanks. :)
      • exit2
        if I do this to save, how can I do something like get_or_create instead, I want to update rather than make a new entry http://dpaste.com/794339/
      • PKKid
        exit2, So you want update_or_create?
      • iiie
        Guddu: doesn't work how?
      • fixxxer has quit
      • Guddu
        iiie, I get an errror http://dpaste.com/794353/
      • exit2
        PKKid: right! But it can't seem to access it
      • caruso_g
        PKKid: I am a webdesigner/UX guy. :)
      • PKKid
        caruso_g, Im more of a backend guy, my design skills are not so great yet. :)
      • andredieb has quit
      • andredieb joined the channel
      • natea_ joined the channel
      • exit2, It depends on what you would consider "Same" setting. basically you do something like "Try to get a setting with attributes xyz, if nothing it returned in that queryset, then create a new one"
      • caruso_g
        PKKid: that would be a good collaboration. :) Contact me if you fancy. twitter: @bonsaistudio
      • kenbolton has quit
      • PKKid
        exit2, Basically I usually write the logic myself. however, here is some other people's solutions: https://groups.google.com/forum/?fromgroups=#!t...
      • atula has quit
      • iiie
        Guddu: that looks like you're getting an extra null in the file, or is entire contents a null?
      • Guddu
        iiie, Entire content is not null....But I am not sure what extra null is it validating
      • exit2
        PKKid: right more or less, check if it exists, if so - do not do anything, if it does not exist, update existing. I just want it to be one single entry in that table the whole time.
      • PKKid
        caruso_g, Sounds good. :D -- also feel free to catch me on GChat anytime: mjs7231 _at_ gmail
      • greg_f has quit
      • natea has quit
      • natea_ is now known as natea
      • kenbolton joined the channel
      • iiie
        Guddu: the contains NULL byte is an exception from the csv library, I'd try a little debugging to look for nulls and count lines (not actually process for csv and see if the delimiters or terminator (EOF -- often NULL) is getting in there)
      • Guddu
        Thanks iiie Will try debugging
      • anth0ny joined the channel
      • iiie, It so turns out that i cannot write tempfiles either
      • SuspiciousOperation at /receiving/bulk_receiving/
      • Attempted access to 'c:\windows\temp\tmponk6wn.xls' denied.
      • cyborg-one joined the channel
      • caruso_g
        PKKid: thanks, gonna add it, thanks.
      • PKKid: dinner time, thanks again for your help
      • iiie
        Guddu: fun, if you're running under runserver, you can just print (to stdout, sorry all, yes it's a bad practice, but it does get the job done)
      • leandroa joined the channel
      • exit2
        PKKid: so what update_or_create is patch?
      • err create_or_update
      • whatever
      • atula joined the channel
      • anuvrat
      • rtnpro joined the channel
      • Guddu
        iiie, This is my trace for suscpiciosOperation http://dpaste.com/794357/
      • Mohsen_Hassani joined the channel
      • hyperair joined the channel
      • kenbolton has quit
      • Mohsen_Hassani
        I need a template to extend a specific template due to a condition; is this correct? http://dpaste.com/794358/
      • anuvrat
        Guddu: are you trying to upload the xls?
      • iiie
        Guddu: SuspiciousOperation here just means that your code tried to read (or write) to a file that the process didn't have permissions to
      • Guddu
        path = safe_join(self.location, name)
      • anuvrat, Yes. uploading a .xls and trying to store it on disk so that XLRD can open it using open_workbook
      • anuvrat
        Guddu: store it in a location you can read / write to
      • Guddu
        anuvrat, I was using tempfile
      • anuvrat
        Guddu: you wont have permissions to the tmp directory on the server, usually
      • hhatch has quit
      • Guddu: its writing to windows/temp ... I am sure windows would not let you read write there
      • Guddu
        anuvrat, What is the general way to get around this?
      • anuvrat
        Guddu: create a directory elsewhere, write your file there and then try reading
      • Guddu
        anuvrat, On Unix based systems also I can't write to tmp?
      • palli joined the channel
      • anuvrat
        Guddu: as I said usually you can't write to tmp, or rather django can't write to temp unless you explicitly change the permissions
      • Guddu
        Thanks anuvrat I will write to a regular directory folder and see
      • anuvrat
        Guddu: which you can easily do via chmod, if you are running your program on a VPS ... on a shared hosting that won't be possible
      • Guddu: you're welcome
      • palli
        I want my form to be bound when doing get (so validation will run on the initial values). But (of course) when i run f = Myform(initial=request.GET, data=request.GET) i get empty values in all the fields instead of the form defined initial values.
      • sambao21 joined the channel
      • anuvrat
        http://blog.zacharyvoase.com/2009/12/09/django-... arg parse in management commands - has this been done?
      • palli
        Is there a way for me to create the form as an unbound one and then in python code change to a bound form with all the initial values as its data ?
      • Guddu
        anuvrat, Its not even writing to C drive
      • Attempted access to 'C:\\A.xls' denied.
      • anuvrat
        Guddu: windows :P ... I have successfully done this on my linux box
      • Mohsen_Hassani
        So, Isn't it possible to extend a template based on a specific condition?
      • anuvrat
        Guddu: no idea how windows handles file permissions ... try fiddling them.
      • juliaelman joined the channel
      • citadelgrad has quit
      • Guddu
        anuvrat, This could be a django issue...I will tell you why i think so....
      • palli
        Ah found it. form.data = form.initial
      • Guddu
        anuvrat, Look at this http://dpaste.com/794362/
      • I do get B.xls created...But not A.xls....this is because of that suspicious operation.....
      • I looked at C:\\Python27\\lib\\site-packages\\django\\core\\files\\storage.py and it is failing at this line
      • path = safe_join(self.location, name)
      • jroll|dupe joined the channel
      • anuvrat, Further digging reveals that self.location is coming as F:\\Program Files\\Apache Software Foundation\\Apache2.2 and name as C:\\A.xls
      • jroll has quit
      • mucker has quit
      • XofP joined the channel
      • anuvrat
        Guddu: oh ... thats weird
      • Guddu: btw, I had just used os.path.join
      • Mohsen_Hassani has quit
      • fgallina joined the channel
      • Guddu: in that case what is the value of the path?
      • dmclain
        Guddu anuvrat that behavior is very expected, the storage system is supposed to protect you from things like a user figuring out how to write files to a completely different drive from the location that the storage is configured for
      • the default storage is configured to write files to F:\\Program Files\\Apache Software Foundation\\Apache2.2
      • so asking it to write a file to the C: drive would be something that it should prrevent
      • citadelgrad joined the channel
      • CRF_H0M3R has quit
      • if you want to have default storage somewhere else it can be configured using settings.DEFAULT_FILE_STORAGE
      • atula has quit
      • pustynnikov joined the channel
      • kojiro has quit
      • n3storm joined the channel
      • Guddu it's also worth pointing out that the inside of the Apache2.2 program install is probably not a great place for DEFAULT_FILE_STORAGE to be either
      • les_sylvains joined the channel
      • juliaelman has quit
      • actually, i think now i'm misreading the docs/code
      • atula joined the channel
      • fgallina has quit
      • DEFAULT_FILE_STORAGE would use a different storage class
      • PKKid
        exit2, Did you figure out your issues?
      • dmclain
        but the file system storage class defaults to your MEDIA_ROOT if location wasn't specified
      • Coalpaw has quit
      • so Guddu, you should specify MEDIA_ROOT as a directory where you have read/write access and that XLRD can access too
      • since the default MEDIA_ROOT of blank is defaulting to the Apache install directory