2008-8-17

23:26 neuro_damage
yashh: how would I capture the sluggify?
23:26 yashh
jlilly u mean u want to populate the form with data or what?
23:26 yashh
neuro more info neeededd
23:27 jlilly
yashh: well, I'd like to use a forms.ChoiceField that only shows a subset of the available data.
23:27 yashh
hmm
23:27 Glenjamin
there's a property on the choicefield you can override to change its queryset
23:27 jlilly
so if the form is about wanting to buy a Toyota, it shows the possible models of Toyota, not all of the models. [So not Models.objects.all() but Models.objects.filter(brand="Toyota")]
23:28 Glenjamin
you'll want to subclass the form to accept a parameter, and then update the querysets in the constructor
23:28 jlilly
hrm. alright, thx.
23:28 yashh
may be ajax stuff jlilly
23:28 neuro_damage
yashh: well now I'm passing into a function the sluggified url that replaces what's in the models database with different caps and spaces
23:28 neuro_damage
so I can search every entry and compare using the sluggified versions of both what's in the database and what I'm searching for
23:29 jlilly
yashh: I don't think it should be, tbh. If you're already rendering an object, you should have relevant information to build the correct form sans ajax.
23:29 jlilly
Just have to figure out how to do it :)
23:29 neuro_damage
but trying to convert the sluggified URL back into a proper case etc...to search the database models could cause more problems.
23:30 Glenjamin
the problem is with your design then
23:30 yashh
neuro
23:30 yashh
u are in deep trouble
23:30 neuro_damage
oh yeah it's definitely in my design lol
23:30 yashh
see make ur database design like this
23:30 yashh
Title, slug
23:30 neuro_damage
ok?
23:30 yashh
slug should be populated from title
23:30 yashh
url look up should be done through slug
23:31 yashh
there's no question of converting them in run time and them search
23:31 neuro_damage
yashh: so have the model store it slugified then eh?
23:31 neuro_damage
hrm...I like that idea.
23:31 yashh
ys
23:31 yashh
may be check out django blog design
23:32 yashh
Entry has a title , slug,
23:32 yashh
23:34 neuro_damage
yashh: so it was just slugify('string')
23:36 yashh
hmm
23:36 yashh
yes
23:36 yashh
depends how to u add data
23:37 yashh
if it through admin add prepopulated_fields in admin.py
23:37 yashh
if it through any custom form modify ur save() method to add slug = slugify(title)
23:38 neuro_damage
yashh: yeah...that's what I tried doing by overriding the models save method...but it's giving me errors saying asset_description a field is not defined.
23:39 yashh
thats a different attribute I think
23:39 neuro_damage
yashh: so model form needs to be changed?
23:39 neuro_damage
oh this is annoying I was so close to finishing buggar
23:39 neuro_damage
looks like my sunday just got donzo
23:39 yashh
dpaste it
23:40 neuro_damage
23:40 neuro_damage
that's the error.
23:41 neuro_damage
23:41 neuro_damage
that's the model itself with the save() method overriden
23:41 yashh
ok
23:41 yashh
got it
23:42 yashh
its self.asset_description
23:42 neuro_damage
oh whoops
23:42 neuro_damage
my bad again, all the different languages I keep coding in I keep forgetting to do that...oop is a little different between python, java/c/c++
23:42 neuro_damage
yashh: hey though seriously appreciate you walking me through my silly mistakes today :)
23:43 yashh
no problem
23:43 yashh
I am near exhaustion
23:43 yashh
its time to leave
23:43 yashh
and njoy a good movie
23:43 yashh
monday starts my routine
23:43 yashh
damn I love weekends
23:45 wolfboy22
is there a way to define a class for the elements of a form in django.forms ?
23:45 neuro_damage
yashh: heh, yeah dude I hate my job
23:45 neuro_damage
yashh: and so monday - friday = hell :(
23:45 yashh
what do u do?
23:46 ironfroggy
Under what circumstances could a QuerySet give me the same record more than once?
23:46 ironfroggy
thats a pretty big violation of being a set.
23:47 keseph
It gives you rows that are in the DB
23:47 neuro_damage
yashh: how do I get the urls.py to accept the sluggified url?
23:47 wolfboy22
ironfroggy: did you set it to distinct?
23:47 keseph
So if there're duplicate rows in the DB, you'll get them
23:47 neuro_damage
what would be the regex for the one word that contains '-' instead of spaces?
23:47 phoenixfire159
hey, are there any good signal docs out there?
23:47 phoenixfire159
that take into account the latest changes
23:47 keseph
neuro_damage: What do you mean "the one word"
23:47 keseph
Any word that contains - ?
23:47 ironfroggy
im not talking about distinct values, im talking about the exact same record being in the set ELEVEN times.
23:47 yashh
my god neuro it catches the whole slug in one variabel
23:48 phoenixfire159
specifically changeset 8223?
23:48 neuro_damage
keseph: well it's for instance ... ahv-iv-380-buggy-vibrator
23:48 yashh
may be u can seperate them in the view
23:48 ironfroggy
that isnt what a _set_ is. a query from a relational database should never include a row more than once!
23:48 keseph
So, [-a-z0-9]
23:48 keseph
ironfroggy: False. False. False.
23:48 keseph
QuerySet is in no way related to formal sets
23:48 yashh
ok I am really exhausted
23:48 yashh
thats it for the day
23:48 ironfroggy
well, it IS called a querySET, so i assume at least the most basic behavior of a set.
23:48 yashh
bye
23:49 keseph
And there is absolutely nothing inherent in RDB to prevent duplicate rows
23:49 neuro_damage
(r'^models/(?P<model_to_search>)\w+', search_models),
23:49 keseph
No.
23:49 keseph
No. No. No.
23:49 phoenixfire159
anyone???
23:49 keseph
It's natural language
23:49 phoenixfire159
signals???
23:49 neuro_damage
yashh: alright dude later
23:49 yashh
sure
23:49 keseph
So it's a convenient way to refer to a collection
23:49 yashh
u can catch me on twitter
23:49 keseph
And Set is a lot shorter to type than QueryCollection
23:49 ironfroggy
i cant imagine any circumstances that would say "hey, whatever results this includes, give it to me like a million times because im a moron"
Page 24 of 25   ← Previous  Next →(2,438 total)