free blog   apache   shopping directory   php powered
pr3d4t0rOwner_: The strangest thing is that the template is being included (via extend), then it chokes when it finds the first block.
pr3d4t0rOwner_: Yes, child extends the page in the example.
girasquidIs it even possible to pass an initial argument to a forms.BooleanField? No matter what I do, I can't seem to get it to be True when my form is rendered
Owner_pr3 i thought i only saw the parent template's link
pr3d4t0rOwner_: Right.
pr3d4t0rOwner_: Let me post the whole thing; there isn't much to it.  Please stand by.
pr3d4t0rOwner_: The template error occurs whether the block is overriden in the specialized template or not.
EloffCan I query database views (as opposed to tables) with the django orm?
cleiferhey guys, i have a custom field i'm using to represent timedeltas until it lands it django proper - i'd like to make it so when the integer value is loaded from the db its converted to a timedelta -- anyone know if there's a hook for that, or if i need to use a descriptor?
Action: pr3d4t0r is very close to giving up on Django and using App Engine This One Time for the demo he's got pending and then resolve this later.
Owner_pr3d4t0r: ok i got no idea, osrry dude
cleiferAdys, ping
pr3d4t0rOdd_Bloke: No worries - thank you.
pr3d4t0rOh, he left :)
ubernostrumpr3d4t0r: what version of Django are you using?
pr3d4t0rubernostrum: 1.1.
pr3d4t0rubernostrum: With Python 2.5.2.
Adyscleifer: ?
cleiferhey, i have a quick question about field hooks, i know you've done some work on durationfield
pr3d4t0rubernostrum: Let's see... it's on an Ubuntu Server, single core, dedicated machine.  All it'll do is act as a dev Django server.  Nothing else in the box.
Adyscleifer: sure
cleiferi'm working up a simple one until it lands in django -- having trouble knowing the hook to convert an integer from the DB to a timedelta
ubernostrumpr3d4t0r: and what's the full error message it gives you?
cleifermy field subclasses IntegerField and i'm storing seconds since that's the resolution we need
Adyscleifer: did you look at the last durationfield patch? thats exactly what it does, subclasses bigint instead of int
cleiferi can store timedeltas but when i retrieve my fields' value i get integers - just wondered if i needed to write a descriptor to convert that int to a timedelta or if i could do it in a hook when it loads from the db
cleiferAdys, yeah i've looked at it, hot stuff!
Adysbut iirc it's something with from_python method
pr3d4t0rubernostrum: Would you prefer a browser capture or a paste?  It's long.
Action: pr3d4t0r assumes that paste is OKi and that HTML formatting won't get messed up.
Adyscleifer: but yeah basically you convert the value from int to timedelta in from_python
cleiferyeah, i've got it going in, it's the reading the int from the db that i need to hook
pr3d4t0rubernostrum: - here's the complete output as I see it on the browser.
intranationpr3d4t0r: return HttpResponse(output.render(None))
intranationYou want None to be {}
Adyscleifer: ill brb, will check the patch in 5 mins
cleiferAdys, thanks a ton!
intranationIf I came late and guessed correctly
Adyscleifer: out of curiousity, any reason why you can't just use my patch and subclass it to use int?
cleiferAdys, i don't want to patch django, we need to run on 1.1
Adysah right
pr3d4t0rintranation: Ah!
cleiferso with your field, if I do obj.duration = timedelta(seconds=300), -- then i reload shell, obj.duration == 300, or obj.duration == timedelta(seconds=300) ?
pr3d4t0rintranation: Thanks a bunch - it makes sense.
intranationContexts always need to be a dictionary
intranationbecause the key part of it is the variable name in the template
pr3d4t0rintranation: Got it.  It makes perfect sense.  It needs an *empty* dictionary :D
pr3d4t0rintranation, ubernostrum: Thanks..
pr3d4t0rMan, do I feel stupid right now...
intranationpr3d4t0r: it's just one of those things you get used to after using Django for years... ;)
EyePulpany way to allow a model manager to be passed an argument?  I need to get a queryset back in a few different places using some vars from the request object, and I'd like to pass the request to a model manager to help with filtering
EyePulpit just seemed cleaner, at least, to work it through a model manager.
cleiferAdys, i got it figured out
cleiferi needed to use the SubfieldBase metaclass on my field
visik7anyone using gocept.cxoracle with djangorecipe ?
cleiferthat ensures that to_python gets called
ubernostrumpr3d4t0r: yeah, you always render a template with a Context object.
ubernostrumpr3d4t0r: as covered by the Django documentation, which may be a good next stop...
pr3d4t0rubernostrum: I'm reading it - just had a mental fart thinking "I'm not passing anything to this one yet" so I used none instad of { } :\
Action: pr3d4t0r hangs his head in shame.
Adyscleifer: ah
Adysyeah fields are a bit complex
cleiferyeah i forgot about subfieldbase
cleiferluckily django's docs kick ass
fabiant7tanyone knows of an existing app providing me with sth. like an if_app_installed template tag, if_app_intalled decorator and an is_app_installed method?
atoiis there any way to eagerly load certain connections along a foreign key? That is... is there a way to User.objects.filter(x=y) and have the extra relation loaded up so when I memcache the resulting set the relation is cached too?
PentheusHello everyone.  I have a really large app with a bunch of "app/models/" files that load each model in the models directory so that they're picked up by syncdb and such.  This is causing a huge issue with circular imports since an import from app.models.file.FileClass results in hitting the which triggers an import * basically
bparker06atoi: select_related()
atoibparker06, awesome, I'll search the docs. :) Thanks.
PentheusIs there something I can do to get django to pick up all these files in the models directory without creating an __init__ file spelling out an import for each model class within each model directory
Pentheus(which I believe is the cause of my circular import issue)
danklesPentheus: you mean your app's code is doing the import from app.models.file.FileClass ?
subsumeif __init__ is importing everything and nothing is impotring __init__, then there shouldn't be circs.
PentheusI do like so:
Pentheusfrom app.models.file import FileClass
Pentheuswhich (from the traceback)
Pentheusappears to trigger the __init__ in that directory
atoi"Note that, by default, select_related() does not follow foreign keys that have null=True."
danklesSo what's the actual error?
fabiant7tPentheus: why do you need to import * in your
atoiI wonder if there's a way to change that default behavior.
PentheusI have "from file import FileClass" for each file within the file in order to get django to see all the models
Pentheusfor syncdb, etc.
festthis problem has been bothering me as well- I just created a huge file as a temporary workaround
festand as we know- nothing is more permanent than temporary solutions :/
festPentheus, you might try to structure your apps so that no two applications depend on each other's models
PentheusThats impossible for me though
subsumeseems like poor design then.
Adysor, smart use of python which you haven't thought about?
AdysI hate people classifying everything as poor design because it's not the intended use
PentheusThis is an example of the Traceback, showing the __init__'s triggering imports leading to circular imports
subsumeyeah. I classified everything as poor design. No dude. I classified one thing as poor design.
Adysthat said, you should look into using a proxy abstract class living elsewhere, and subclassing it once for each of them
Adyssubsume: you classified something as poor design without knowing what the design actually is
subsumeWhatever you say.
subsumePentheus: nobody needs to see a traceback about your circular imports. What you need to do is take a comb to that nasty project.
PentheusAnd what would this comb do?
subsumeStop making things depend on one another. Its a basic thing to avoid in python.
subsumeI don't see how this is even related to you stuff.
PentheusI never had circular dependency issues before working with Django, this seems to be a pink elephant in the room that everyone ignores
hoinkwheel-reinvention prevention: simple contact form design pattern?: I'm noobing with Django, creating a textarea-and-send-button contact.  Any urls for Known Good ways to do this?
PentheusSome people don't want agiant
bparker06I never had to put anything in an
subsumePentheus: well, you can reference other models by using a string.
dankleshoink: ubernostrum has one
PentheusOnly when they are in the same file, Subsume
subsumePentheus: Wrong.
PentheusOk, tell me how?
subsumePentheus: ForeignKey('youjust.Do')
bparker06Pentheus: you can use 'appname.somemodel'
PentheusI don't understand what that buys me
bparker06no circular dependencies
subsumerighton buddy.
PentheusAs soon as I do that Django complains that the class (youjust.Do) is not later defined
subsumeIs that a string??
PentheusI'm saving a bit on the typing
PentheusI know about quoting FKs
subsumeHmm. Never heard of it.
Pentheus"asset.networkportcloud: 'node' has a relation with model Node, which has either not been installed or is abstract."
BrianHVwhy would a url field give me a "This URL appears to be a broken link" error even though I can access the link through a browser?
hyljePentheus: works fine for me, cross-app or not
subsumePentheus: no idea what you're talking about. paste models.
bparker06Pentheus: you are still referring to 'node' by importing it, and not via string
PentheusNo, this is pure FK stringage
Sonderbladewhat does "IntegrityError: current transaction has been aborted, all commands ignored until the end of the transaction" mean and how do you end the transaction?
subsumeBrianHV: cause your pattern is off?
zerokBrianHV: is perhaps the dns on the server not configured?
subsumeoh duh. probably that.
zerokBrianHV: if you want to disable that check, set verify_exists=False in the field definition
subsumePentheus: typically when you paste, you actually include what the person told you to apply.
PentheusWhat am I missing subsume?
subsumethe app label?
bparker06all the other models?
subsumethe whole point?
BrianHVzerok: I can wget the link from the server... but I'll try verify_exists
intranationPentheus: you want server = models.ForeignKey('appname.models.ServerCloud')
visik7anyone know how to add a zc.recipe.egg:custom into the extra-paths of djangorecipe ?
intranationPentheus: basically anything that'll pass the conditions for __import__, here:
PentheusJust tried it with the app label
BrianHVzerok: verify_exists worked.  thanks.
zerokBrianHV: wierd. django only tried to open the url with urllib2 :-/
PentheusIt was difficult to  weed the actual help out of the snide remarks
PentheusThank you subsume, all the same :)
Pentheusand et al
subsumeNo problemo. =).
Pentheusworks perfectly
BrianHVzerok: aah, that gives me a clue.  urllib2.HTTPError: HTTP Error 302: The HTTP server returned a redirect error that would lead to an infinite loop.
zerokah ^_^
phretorhi, why does ModelForm.clean() does not get called from AdminModel subclasses?
machrideris there a django-esque way to implement a job queue (like, sending out emails asynchronously)?
subsumephretor: did you connect it to the modeladmin?
subsumemachrider: cron ?
SilverSiRHey guys how can i specify which django version an app uses. I have two on my system 1.0 and 1.1.1. Right now it's defaulting to 1.1.1 but I want it to use the 1.0 version
phretorsubsume: the clean?
intranationmachrider: at my work we use RabbitMQ with a Django management command
bparker06I agree there is lots of 'superior ego' flying around here usually
subsumeSilverSiR: in dev server
subsumeSilverSiR: ??
SilverSiRjust running python runserver
subsumelol. I am far from superior but I know how to link a model via a string pretty goddamn reliably.
machridersubsume: ideally something that would work on win32 too
bparker06but that's a common theme with open source people
machriderintranation: thanks, i'll take a look
bparker06subsume: and others don't
subsumeSilverSiR: PYTHONPATH=/home/you/whatever/ python shell where whatever contains your alternate django
bparker06which is why they come here for help
bparker06not to get yelled at
zerokmachrider: there are a couple, but probably the most robustness you'll get out of some combination with some amqp server libe rabbitmq. celery offers a nice interface for that
machriderrelated question: can django handle two threads accessing the ORM simultaneously?
machriderproducer consumer style
intranationmachrider: dumb/easy way would be to have a model which stores commands and fetch the jobs out of that
subsumebparker06: well yeah, but when they don't listen and tell you 'they know' they need a chop down.
phretoris there any special way to implement a ModelForm's clean() for use in an AdminModel subclass?
bparker06subsume: I still don't agree with how you handle most people's questions
bparker06I think it's completely rude
subsumeWhatsamatter with a little good cop bad cop
bparker06it makes people /quit
subsumehaha, yeah right. I really doubt I've ever chased anyone off their problem.
Popular searches: mew vs   had to relocate PCH   xmonad   tictimed stop   

Generated by 2.1mg by Jeff Waugh - return