Re: wordpress hooks and actions system in django?

2008-02-21 Thread Bram - Smartelectronix
Dj Gilcrease wrote: > On Thu, Feb 21, 2008 at 6:23 AM, Bram - Smartelectronix > <[EMAIL PROTECTED]> wrote: >> Basically plugins can register with the host app and say "I want to be >> plugged in here or there" (the hook). The host app in various places ha

wordpress hooks and actions system in django?

2008-02-21 Thread Bram - Smartelectronix
hey guys, I've been asked to write a wordpress-like system in django, with hooks and action-hooks for plugin-creation alla wordpress. Now the question is - how would you guys handle this? I was thinking that hooks could be represented by template tags which pass the context to whatever

Re: filtering on a date field's component; a bug?

2008-01-22 Thread Bram - Smartelectronix
omat wrote: > Hi all, > > I have a model with a date field. When I try to filter based on its > months like: > > q1 = Event.objects.filter(start_date__month__in=[1, 2, 3]) > > I get an "unable to resolve field 'start_date__month'" error. > > Is this usage not supported or is this a bug?

Re: considering django for The Freesound Project, some (de)constructive critisism

2008-01-22 Thread Bram - Smartelectronix
Hello all, James Bennett wrote: > The fix has been in Django since the day it was publicly released: > 'raw_id_admin=True'. You think World Online runs sites with tens of > thousands of users and hundreds of thousands of stories without > running into that? ;) Ah... Those details one tends to

considering django for The Freesound Project, some (de)constructive critisism

2008-01-21 Thread Bram - Smartelectronix
Hello Everyone, you might have previously read posts from me about splicemusic.com, which now successfully runs on django. Quite a while ago I created the Freesound Project ( http://freesound.iua.upf.edu ), which in turn became hugely popular and a victim of it's own success (i.e. drowning

strange duplicate key error (generic issue?)

2008-01-11 Thread Bram - Smartelectronix
Hello all, I have this model: class Favorite(models.Model): content_type = models.ForeignKey(ContentType) object_id = models.PositiveIntegerField() content_object = generic.GenericForeignKey() user = models.ForeignKey(User) created = models.DateTimeField() class

DateField and output/input versus SelectDateWidget

2007-12-19 Thread Bram - Smartelectronix
hello everyone, A) if you render a DateField it renders as: /MM/DD and then you have to tell the user he should use the input_format ( which is MM/DD/ by default) which is kind of duh! :) B) if you use the SelectDateWidget (in the code but not in the docs) it will only work with

Re: completely escaping an included template

2007-12-19 Thread Bram - Smartelectronix
Jan Rademaker wrote: > > See http://www.djangoproject.com/documentation/templates/#force-escape Thank you... - bram --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

completely escaping an included template

2007-12-18 Thread Bram - Smartelectronix
Hello everyone, trying to upgrade to the latest trunk, I'm wrestling a bit with the autoescape function. Talking about embed-code for an enduser, I used to write: {% include embedded_player.html %} Copy-paste this: The first part shows to the end-user how the embeddable player will look

Re: very slow behavior of dev server + strange errors before reaching view

2007-12-04 Thread Bram - Smartelectronix
Karen Tracey wrote: > Traceback seems to indicate something during the request processing is > generating a 500 exception, but attempting to render the template for > the error response is failing on lookup for "request" in the empty > context used for generating the error response page. Do

very slow behavior of dev server + strange errors before reaching view

2007-12-03 Thread Bram - Smartelectronix
Hi, I'm trying to get a big project up and running again on my local machine. I updated to the latest trunk. I'm getting this error before reaching my view function and after waiting about 30 seconds while both mozilla and django just sit and do nothing, not even waste CPU:

Re: sporadic VariableDoesNotExist's...

2007-09-07 Thread Bram - Smartelectronix
As said, the weird thing is that it SPORADICLY fails, not all the time. I.e. it only fails once every X views. Could this possibly have something to do with the anonymous user caching? - Bram > > On Sep 6, 12:14 pm, Bram - Smartelectronix <[EMAIL PROTECTED]> > wrote: >>

sporadic VariableDoesNotExist's...

2007-09-06 Thread Bram - Smartelectronix
Hello Everyone, I have a request context which sets {'request':request}... On windows (dev-server) everything is fine and dandy, but on our live site (splicemusic.com, Apache2 + mod_python) I see *sporadic* appearances of: "VariableDoesNotExist: Failed lookup for key [request] in [{}]"

Re: django app for managing sending email to users...

2007-08-03 Thread Bram - Smartelectronix
Jacob Kaplan-Moss wrote: > On 8/3/07, James Tauber <[EMAIL PROTECTED]> wrote: >> I was thinking of developing a django app for this with support for >> queuing and throttling of sends, scheduled sends, and logging of mail >> failures. I'm NOT interested at all in using it for unsolicited email >>

Re: get object qs with certain generic relation

2007-08-03 Thread Bram - Smartelectronix
Jonathan Buchanan wrote: > class Flag(models.Model): > objects = FlagManager() > > Usage:: > > songs = Flag.objects.get_by_model_and_flag_type(Song, 'illegal') Thanks a lot Jonathan... I guess I should adding custom managers to all my classes containing generic relations! - bram

Re: age in years calculation

2007-08-03 Thread Bram - Smartelectronix
Jonathan Buchanan wrote: > > http://toys.jacobian.org/presentations/2007/oscon/tutorial/ > > Slide 14, unit tests too! :) >>> dob = date(1980,2,29) >>> dob.replace(year=2007) Traceback (most recent call last): File "", line 1, in ValueError: day is out of range for month it ain't a

age in years calculation

2007-08-03 Thread Bram - Smartelectronix
Hey Everyone, does anyone have a good age in years calculation function for usage with datetime.date that returns the age in nr of years of a person? We were using: def get_age(self): now = datetime.today() birthday = datetime(now.year, self.birthday.month, self.birthday.day)

get object qs with certain generic relation

2007-08-03 Thread Bram - Smartelectronix
hello all, I have a generic relation Flag, with a FlagType: class FlagType(models.Model): name = models.CharField(maxlength=50) description = models.TextField() class Flag(models.Model): type = models.ForeignKey(FlagType) # type of flag content_type =

Re: a rather big, new django site:

2007-07-30 Thread Bram - Smartelectronix
Julio Nobrega wrote: > Damn, 3 weeks ago I was talking to a friend about an idea for a > website which is just like Splice. The focus was a little bit more > towards musicians, letting them upload tracks and setting prices for > its usage, but anyway, the sound mixer you coded is fantastic, and

caching and "hello username" on each page

2007-07-28 Thread Bram - Smartelectronix
hello everyone, I would LOVE to use caching for both anonymous and logged in users, but the problem is that every page on our site (http://www.splicemusic.com) has the typical "hello username | log out | ..." at the top of each page. Now, how can I possibly cache both anonymous and logged in

django admin + apache + mod_python => breakage

2007-07-28 Thread Bram - Smartelectronix
hello everyone, I have a rather "well connected" model like this ( used here: http://www.splicemusic.com/contests/ ): class Contest(models.Model): [ snip of regular fields ] # the sounds people HAVE to use to enter the contest required_sounds = models.ManyToManyField(Sound,

a rather big, new django site:

2007-07-28 Thread Bram - Smartelectronix
http://www.splicemusic.com/ ( summary: upload sounds, load them into a flash audio sequencer with effects and synthesizers + standard community features) thanks a lot to all the people who have helped me getting this thing up and running! :-) cheerio, - bram

meta path_info, yet again

2007-07-19 Thread Bram - Smartelectronix
hello everone, a while back I mailed about a problem with path_info. Basically I'm having the same problem and the previous fix we discussed no longer works. I'm getting this behavior: http://www.com/a/ => path_info = "/a" http://www.com/a/b/ => path_info = "/b"

all on one server release, ballpark?

2007-06-26 Thread Bram - Smartelectronix
hey guys, due to some unfortunate events we will have to release our current django-based site on one server instead of two. We were planning to put postgres on another machine, but that's not possible for now. The machine is a dual opteron 1.8GHz (dualcore) with 4GB of RAM. Running

Re: reduce execution time of object.count()

2007-06-13 Thread Bram - Smartelectronix
simonbun wrote: > If your situation allows it, you could de-normalize and save the count > result in a separate table. Then you need to adjust the count whenever > you add / delete a row ofcourse. We keep a set of 'stats' tables which count various things in the database (nr of comments, number

deleting rows with generic relations

2007-06-13 Thread Bram - Smartelectronix
hello everyone, Say I have Model1 Model2 Model3 And generic relations pointing to these... Like, say, Comments or Tags When deleting Model1, 2, 3 I obviously need to delete all the generic ones! Is there any smarter way to go about this except for overriding delete( ) and doing it by

Re: newforms: setting a field to a value in clean( )

2007-06-11 Thread Bram - Smartelectronix
MartinWinkler wrote: > > Bram - Smartelectronix schrieb: > >> in clean( ) we would like to set a field value. In particular: if there >> are errors in a signup form, we'd like to delete the passwords to user >> gave before as to not send unencrypted passwords bac

newforms: setting a field to a value in clean( )

2007-06-10 Thread Bram - Smartelectronix
Hi all, in clean( ) we would like to set a field value. In particular: if there are errors in a signup form, we'd like to delete the passwords to user gave before as to not send unencrypted passwords back... How can we do this? Thanks! - bram

Re: Best-practices for form with image

2007-05-30 Thread Bram - Smartelectronix
Xin Xic wrote: > Well, I want out a form for a human verification with an image and an > input field. But I don't know how is the best practice for make this. > How do you do it? Try: http://smileychris.tactful.co.nz/ramblings/recaptcha/ de res, - bram

JSON-ifying newform errors?

2007-05-30 Thread Bram - Smartelectronix
Hey everyone, I was thinking that I'd like to know if there is a standard way of transforming a newforms reply to JSON (or anything else). I'd like to think it would be easy to have a new-form, submit it via JSON and be able to -automatically- display the errors, as if you would just have

relation-spanning lookups with generic relations?

2007-05-28 Thread Bram - Smartelectronix
Hi there, Say I have: class TaggedItem(models.Model): """A tag on an item.""" tag = models.SlugField() content_type = models.ForeignKey(ContentType) object_id = models.PositiveIntegerField() content_object = models.GenericForeignKey() class Meta:

Re: newforms and recaptcha => MultiWidget/MultiField?

2007-05-27 Thread Bram - Smartelectronix
SmileyChris wrote: > > I did this yesterday: > http://smileychris.tactful.co.nz/ramblings/recaptcha/ HOT Damn!! Will try ASAP and report back. - bram --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django

newforms and recaptcha => MultiWidget/MultiField?

2007-05-25 Thread Bram - Smartelectronix
hello everyone, I'm trying to recreate reCaptcha ( http://recaptcha.net/learnmore.html ) in newforms. Trouble is: I want this to be represented by a sinlge Field inside a form and then do the API calls in the clean() of that Field. This is how this field/widget should render:

Re: decimal fields + json serializing [was Re: Decimal fields have landed on trunk: rename your FloatFields]

2007-05-24 Thread Bram - Smartelectronix
Hello Malcolm, Malcolm Tredinnick wrote: > Pleasee file a ticket with a small, self-contained, repeatable example > that demonstrates the problem. Reporting ticket son the mailing list is > a good way to have them forgotten about. > > I did test JSON serialisation of decimals, so it doesn't

initial data + cut up models.py = trouble?

2007-05-21 Thread Bram - Smartelectronix
hey everyone, I successfully cut up my models.py into different files, so now I have: models/ + something1.py + something2.py + something3.py and in __init__.py from something1 import * from something2 import * from something3 import * to make

Re: fixtures for generic relations?

2007-05-19 Thread Bram - Smartelectronix
Russell Keith-Magee wrote: >> how do I -in fixtures- explain a variable needs to come from another table? >> I don't want to write "content_type: 15" as elsewhere! > > That's the way its done. GenericRelation is a convenience wrapper > around the content type and object id database entries; you

fixtures for generic relations?

2007-05-18 Thread Bram - Smartelectronix
hi everyone, how do I -in fixtures- explain a variable needs to come from another table? I don't want to write "content_type: 15" as elsewhere! - bram --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django

splitting up models.py woes

2007-05-18 Thread Bram - Smartelectronix
hello everyone, I'm trying to split up my models.py into different files, more specifically I've made a directory "models": /models + __init__.py + models1.py + models2.py + models3.py First of all I had the trouble that django was now misinterpreting the app_name but that's

Re: making custom exceptions like Http404?

2007-05-16 Thread Bram - Smartelectronix
omat wrote: > Add a middleware class like this: oh, duh!! thanks a lot :-) - bram --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

making custom exceptions like Http404?

2007-05-16 Thread Bram - Smartelectronix
hey everyone, looking at the source code this isn't immediately clear to me... What if I wanted to make a HttpPermissionError or HttpThisPageIsBeingUpdated or ... exception that has it's own template? This way, from anywhere in the code you could throw your very own exception... Am I

formulaic row-permissions + django

2007-05-15 Thread Bram - Smartelectronix
hey guys, I was wondering if anyone has ever does a formulaic permissions thing in django. something where you can define user permissions for certain actions, depending on the various attributes of an object. Think something like: def can_view(user): if self.is_private and

Re: order of fields in a newform

2007-05-15 Thread Bram - Smartelectronix
Malcolm Tredinnick wrote: >> Is there any way to explicitly order fields? > > This is one of those cases where reading the newforms source is going to > be the best way to work out the answers. It shouldn't be too hard for > anybody who wants this kind of depth to trace through what is going on.

order of fields in a newform

2007-05-15 Thread Bram - Smartelectronix
Hey everyone, How do I change the order of the fields in a newform: class ContactForm(forms.Form): to = forms.ModelChoiceField(ContactEmail.objects.all()) message = forms.CharField(widget=forms.Textarea()) def __init__(self, user, *args, **kwargs): super(ContactForm,

where to "listen" for backwards incompatible changes in trunk?

2007-05-14 Thread Bram - Smartelectronix
hey guys, just lost a about an hour trying to figure out why some stuff stopped working when we noticed someone had done an update of django on our test server :-) Anyway, where do I "listen" to backwards incompatible changes? Is there an RSS feed? Is there a mailinglist (django dev??)? If

Re: Multiple Profiles

2007-05-14 Thread Bram - Smartelectronix
Amit Upadhyay wrote: > On 5/9/07, *Vinay Sajip* <[EMAIL PROTECTED] > > wrote: > > One simple problem with Amit's approach, as written, is that you have > to deal with "fuser" and "duser", which feels a little kludgy (I > realise he was just demonstrating

Re: First impression of django

2007-05-11 Thread Bram - Smartelectronix
James Bennett wrote: > On 5/11/07, Bram - Smartelectronix <[EMAIL PROTECTED]> wrote: >> there should be a clear way to trigger exceptions when non-existing >> variables are added to the templates. > > Again, the reasoning is that it's bet

Re: First impression of django

2007-05-11 Thread Bram - Smartelectronix
James Bennett wrote: >> TEMPLATE_STRING_IF_INVALID: The zen of python: "Errors should never pass >> silently.". I want an exception if the template can't resolve a variable. > > "Unless explicitly silenced." Django goes out of its way to advertise > that certain types of template errors will

using django in cronjobs + database locks...

2007-04-26 Thread Bram - Smartelectronix
hi all, I have a particular file-processing "cron" job that uses django. Something much like this: while True: for image in Image.objects.filter(processing_state="pending"): #process image time.sleep(30) Now I notice that while running this script the DB table

Re: Any books available

2007-04-06 Thread Bram - Smartelectronix
Tim Chase wrote: > To be published: > http://www.amazon.com/Pro-Django-Development-Done-Right/dp/1590597257/ does anyone know how up-to-date this one is / will be? with a still fast-changing-project like django, even if the authors are the über djangoists, this book could already be out of

Re: PATH_INFO missing first part

2007-04-06 Thread Bram - Smartelectronix
Dirk Eschler wrote: > > i had a very similiar problem once. It turned that i had a "DocumentRoot" > defined in my vhost config and that caused weird PATH_INFO problems. Django > doesn't care about the DocumentRoot (IMHO), so i just removed it, but it took > me quite a while to figure that

Re: PATH_INFO missing first part

2007-04-05 Thread Bram - Smartelectronix
Malcolm Tredinnick wrote: > This looks correct. Not sure why it isn't working, sorry. If you wanted > to do some more poking around, we set up PATH_INFO in > django/core/handlers/modpython.py, so you could put some debugging in > there to see what the value we get from modpython is. I'm reluctant

PATH_INFO missing first part

2007-04-05 Thread Bram - Smartelectronix
Hello everyone, mod_python 3.3.1 apache 2.0.52 python 2.5 django trunk, updated 5 minutes ago I go to http:/example.com/a/b/c/d/ and PATH_INFO returns /b/c/d/ losing the first bit! This for any URL. I've been googling to no avail... :-S if anyone has a hint, I would be very grateful!

Re: huge number of SQL queries doing get_profile( )...

2007-03-27 Thread Bram - Smartelectronix
Bram - Smartelectronix wrote: > 2. in the profile I'm generating some data, for example, the user's > avatar filename will use self.user.username to create the avatars path, > which will do yet another query (select ... from auth_user)! Replying -partly- to my own message, this slight

huge number of SQL queries doing get_profile( )...

2007-03-27 Thread Bram - Smartelectronix
Hello everyone, I've noticed that when I look at the queries output of my app, I'm getting a LOT of repeating queries and a lot of queries that aren't needed at all. For example, I have a list of users, ordered by a certain property and paginated: qs =

referrers: to django or not?

2007-03-17 Thread Bram - Smartelectronix
hey everyone, Im our pages we would love to keep a list of "most recent" or perhaps "most incoming in the last 7 days" referrers for quite a few pages... I.e. something like: "in the last 7 days your blog/item/whatever has been visited from: 7 x http://somewebsite.com 5 x

Re: Count foreignkey(self)

2007-03-17 Thread Bram - Smartelectronix
[EMAIL PROTECTED] wrote: > If I have a model with something like > > class A (models.model): > parent = meta.ForeignKey('self', blank=True, null=True, > related_name='child') > > Is it possible to do a select for some results in A along with a count > of all their children? class

Re: transactions and unique variables:

2007-03-15 Thread Bram - Smartelectronix
Tim Chase wrote: > Which follows the pattern > >UPDATE tbl >SET field = ( > SELECT SUM(field) > FROM tbl > WHERE [EMAIL PROTECTED] or [EMAIL PROTECTED] > ) - field >WHERE [EMAIL PROTECTED] or [EMAIL PROTECTED] > > Any help? > > -tkc (aka "the atomic swapper"? :)

Re: transactions and unique variables:

2007-03-15 Thread Bram - Smartelectronix
Bram - Smartelectronix wrote: > Rubic wrote: >> Bram, >> >> Try removing (commenting out) the transaction decorator >> and transaction.commit(), then re-run your code. The >> ProgrammingError exception may be hiding the real >> exception. At least that'

Re: transactions and unique variables:

2007-03-15 Thread Bram - Smartelectronix
Rubic wrote: > Bram, > > Try removing (commenting out) the transaction decorator > and transaction.commit(), then re-run your code. The > ProgrammingError exception may be hiding the real > exception. At least that's been my experience. Nope..., I'm really getting the "unique key violation"

Re: newb: Django ORM for Custom SQL

2007-03-15 Thread Bram - Smartelectronix
johnny wrote: > I need to retrieve latest record (each record has a time stamp, > created_at), only one record, from sale table where product_id=1. How > do I do this in Django ORM? I have looked at .objects.extra{}, but I > am getting ProgrammingError 1064. > > I need to get this sql into

transactions and unique variables:

2007-03-15 Thread Bram - Smartelectronix
Hi everyone, I have items that have an order. This function is supposed to move items up (swapping the order with the previous item) or down (...). I tried doing it via a transaction (as 'order' is logically unique), but on the first save() it fails with a ProgrammingError:

Re: Python HTML lib_filter

2007-03-07 Thread Bram - Smartelectronix
James Bennett wrote: > On 3/7/07, Bram - Smartelectronix <[EMAIL PROTECTED]> wrote: >> this is pretty much exactly what i had been looking for lately... > > It's also worth pointing out that Django includes a "striptags" > template filter which strips all H

Re: Python HTML lib_filter

2007-03-07 Thread Bram - Smartelectronix
Bram - Smartelectronix wrote: > Sam wrote: >> I have translated Cal Henderson's lib_filter.php to python. >> >> If you need to filter your users HTML input, you might like it. >> >> http://amisphere.com/contrib/python-html-filter/ > one thing: perhaps it wou

Re: Python HTML lib_filter

2007-03-07 Thread Bram - Smartelectronix
Sam wrote: > I have translated Cal Henderson's lib_filter.php to python. > > If you need to filter your users HTML input, you might like it. > > http://amisphere.com/contrib/python-html-filter/ this is pretty much exactly what i had been looking for lately... one thing: perhaps it would be

Re: my first patch: template if[not]equal with negative numbers

2007-03-07 Thread Bram - Smartelectronix
Bram - Smartelectronix wrote: > > > Any hints? looks like SmileyChris got ahead of me and did all the fix'n, but i guess i'd still like to know so i can prepare future patches better. - bram --~--~-~--~~~---~--~~ You received this message be

Re: my first patch: template if[not]equal with negative numbers

2007-03-07 Thread Bram - Smartelectronix
Malcolm Tredinnick wrote: > On Wed, 2007-03-07 at 02:34 +0100, Bram - Smartelectronix wrote: >> Malcolm Tredinnick wrote: >>> (2) This is the sort of thing that should come with a test to ensure we >>> don't introduce the same mistake again. Have a look in >>

Re: my first patch: template if[not]equal with negative numbers

2007-03-06 Thread Bram - Smartelectronix
Malcolm Tredinnick wrote: > (2) This is the sort of thing that should come with a test to ensure we > don't introduce the same mistake again. Have a look in > tests/regressiontests/templates/tests.py for related tests and add a > couple of options in there. i forgot to ask: should additions to

Re: my first patch: template if[not]equal with negative numbers

2007-03-06 Thread Bram - Smartelectronix
> (1) When you create a patch, best to do it from the top of the Django > source tree (the directory just about django/). Then we can tell which > file you are patching. There are many files called __init__.py in our > source tree and we really need to know *which one* is the right one to >

my first patch: template if[not]equal with negative numbers

2007-03-06 Thread Bram - Smartelectronix
as it's the first patch i do, perhaps someone can tell me if i did well ;-) http://code.djangoproject.com/ticket/3670 - bram --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: hosting single static files at root? (modpy + apache)

2007-03-02 Thread Bram - Smartelectronix
Michael Cuddy wrote: >> how can I host a few single files at root level, like for example a >> crossdomain.xml file. Using Apache2 + mod_python. >> >> ( http://www.moock.org/asdg/technotes/crossDomainPolicyFiles/ ) >> >> thx for any hints, > > Here's what I'm doing. My (django pertinent part

hosting single static files at root? (modpy + apache)

2007-03-01 Thread Bram - Smartelectronix
hey everyone, how can I host a few single files at root level, like for example a crossdomain.xml file. Using Apache2 + mod_python. ( http://www.moock.org/asdg/technotes/crossDomainPolicyFiles/ ) thx for any hints, - bram --~--~-~--~~~---~--~~ You received

Re: json serialization without certain fields and with extra information?

2007-03-01 Thread Bram - Smartelectronix
Manoj Govindan wrote: > > >> The serializer in trunk has a fields option, which only serializes the >> fields supplied. >> >> Ex: >> serializers.serialize('json', my_user_set, fields=('username', 'id')) > > This doesn't work at the moment > http://code.djangoproject.com/ticket/3466 > > But

Re: json serialization without certain fields and with extra information?

2007-02-28 Thread Bram - Smartelectronix
limodou wrote: > django also uses simplejson to dump python variable, why you want to > avoid it? And I think using simplejson is more flexiable and simple. Because it's more generic and I don't want to recreate what's done in the models... In the end I did it like this: # MODEL

Re: json serialization without certain fields and with extra information?

2007-02-28 Thread Bram - Smartelectronix
limodou wrote: > On 2/28/07, Bram - Smartelectronix <[EMAIL PROTECTED]> wrote: >> hey everyone, >> >> >> 1. is there any way to serialize models and remove some fields? I.e. I >> would like to serialize User for example, but I definitely don't

json serialization without certain fields and with extra information?

2007-02-28 Thread Bram - Smartelectronix
hey everyone, 1. is there any way to serialize models and remove some fields? I.e. I would like to serialize User for example, but I definitely don't want the email to be there. 2. is there a way to provide "custom" parts of the serialization? For example, when serializing a Book I would

Re: stored procedures in initial SQL ?

2007-02-14 Thread Bram - Smartelectronix
Malcolm Tredinnick wrote: > At the moment, the only workaround is to call out to your own shell > script (or other) to do the insert. If you have a look around line 506 > of django/core/management.py, you can see where Django emits a > "post-syncdb" signal after setting up the database, so you

stored procedures in initial SQL ?

2007-02-13 Thread Bram - Smartelectronix
Hi, with the preprocessing that's being done on 'initial' SQL before adding it to the DB I'm getting into trouble with the stored procedures I would like to add to the DB (for the model in question). The backend specific SQL gets treated the same way. I think it's impossible to change the

Re: best "right now" solution for large file uploads?

2007-02-13 Thread Bram - Smartelectronix
Nathan R. Yergler wrote: > I recently had this problem and got nowhere with the ticket 2070 > patches. I wanted large file upload with user feedback. I ended up > implementing a two-part solution: a CGI that actually handles the > uploading (the "tramline"-like component) and a Django interface

best "right now" solution for large file uploads?

2007-02-12 Thread Bram - Smartelectronix
hey guys, given the premises that I need a solution "right now" which is the best way to go? Patch Django? Try to get tramline working? Write something myself? Something else?... I'm pretty desperate, so anything that could help more than welcome! thanks a lot for any help, - bram

@staticmethod + django + python 2.5 ?

2007-02-06 Thread Bram - Smartelectronix
hey everyone, should there be any reason for @staticmethod not to work in django model classes? or should I be using the non-decorator syntax? ( django dev server + python 2.5 ) - bram --~--~-~--~~~---~--~~ You received this message because you are

Re: tying custom queries back into the queryset / object model / paginator... ?

2007-02-06 Thread Bram - Smartelectronix
Lawrence Oluyede wrote: >> * is there a way to do custom queries, and tie the result back into the >> object model or into the queryset interface? I have a query which >> (really) returns 'django objects', which is impossible to write with the >> ORM, but after doing the query I would like to get

Re: order_by not working with foreign keys:

2007-02-01 Thread Bram - Smartelectronix
Michael Radziej wrote: > Bram - Smartelectronix: > > >> I'll be updating the ticket, but I was wondering when the ticket would >> be merged with trunk. > > Someone needs to writes tests for this. As soon as this has been > done, the ticket can be promoted to &q

Re: order_by not working with foreign keys:

2007-02-01 Thread Bram - Smartelectronix
Michael Radziej wrote: > Hi, > > there's a ticket with a patch about the order_by-Problem: > > http://code.djangoproject.com/ticket/2210. > > Does it help? I just figured out that this problem also exists, even if the name ISN'T different: class Book(models.Model): title =

Re: request.META.PATH_INFO strangeness...

2007-01-30 Thread Bram - Smartelectronix
Graham Dumpleton wrote: > > This can occur where you are using Location directive set to '/' and > the actual DocumentRoot directory is specified and has physical > directories which correspond to the leading components of the logical > URL. > > Ie., if under your document root you have

Re: request.META.PATH_INFO strangeness...

2007-01-29 Thread Bram - Smartelectronix
James Bennett wrote: > On 1/29/07, Bram - Smartelectronix <[EMAIL PROTECTED]> wrote: >> oh, sorry 'bout that! =) >> >> cent-os running: >> >> * apache2 2.0.52 >> * mod_python 3.2.10 >> * python 2.5 >> * postgres 8.1.4 >>

Re: request.META.PATH_INFO strangeness...

2007-01-29 Thread Bram - Smartelectronix
James Bennett wrote: > On 1/29/07, Bram - Smartelectronix <[EMAIL PROTECTED]> wrote: >> Collin Grady wrote: >>> It would be helpful if you provide more info - how are you passing the >>> requests to django, for instance? >> I'm passing them in a cont

Re: request.META.PATH_INFO strangeness...

2007-01-29 Thread Bram - Smartelectronix
s.i18n', 'project.app.context_processors.media_url_and_request', ) hope this is enough info... - bram > On Jan 29, 11:42 am, Bram - Smartelectronix <[EMAIL PROTECTED]> > wrote: >> hello everyone, >> >> Short question! >> >> If I go tohttp://my.server.com/hello/this/is/my/path/ &

request.META.PATH_INFO strangeness...

2007-01-29 Thread Bram - Smartelectronix
hello everyone, Short question! If I go to http://my.server.com/hello/this/is/my/path/ and request.META.PATH_INFO is set to "/path" not to "/hello/this/is/my/path/" Running mod_python / apache. In the dev-server it obviously ( ;-) ) works just fine... Any clues? Thanks a lot, - bram

Re: order_by not working with foreign keys:

2007-01-26 Thread Bram - Smartelectronix
Michael Radziej wrote: > Please report your results in the ticket, I'd appreciate! Done. - bram --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: order_by not working with foreign keys:

2007-01-25 Thread Bram - Smartelectronix
Michael Radziej wrote: > Hi, > > there's a ticket with a patch about the order_by-Problem: > > http://code.djangoproject.com/ticket/2210. > > Does it help? Knowing it's broken helps a LOT :-) I'll try to see if it works w/ the patch. Thanks Michael, - bram

Re: order_by not working with foreign keys:

2007-01-25 Thread Bram - Smartelectronix
Waylan Limberg wrote: > Actually, as you have `related_name` set (to 'stats'), I believe this > may be what you want: > > Book.objects.all().select_related().order_by('-stats__avg_rating')[0:10] OK, as this failed as well, I made a clean example, from ZERO, and tried it. Any ideas why this

Re: order_by not working with foreign keys:

2007-01-24 Thread Bram - Smartelectronix
Waylan Limberg wrote: > On 1/24/07, Bram - Smartelectronix <[EMAIL PROTECTED]> wrote: >> Book.objects.all().select_related() >> .order_by('-bookshop_bookstat.avg_rating')[0:10] >> > > You should replace the dot (.) with a double underscore (__

Re: order_by not working with foreign keys:

2007-01-24 Thread Bram - Smartelectronix
Honza Král wrote: >> - >> class Book(models.Model): >> >> >> class BookStat(models.Model): >> book = models.OneToOneField(Song, related_name='stats') >> avg_rating = models.FloatField(max_digits=2,

Re: currently online users?

2007-01-24 Thread Bram - Smartelectronix
Jeremy Dunck wrote: > > The attached file implements a (lightly-tested) middleware. Wow, thanks a lot! I'll let you know how it goes! - bram --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users"

Re: order_by not working with foreign keys:

2007-01-24 Thread Bram - Smartelectronix
Honza Král wrote: > it occured before on the mailing list... > > if you add select_related(), it will work... > > the problem is that specifying ordering like this doesn't force the > join in the query so you might end up with a query that sorts on > something that just isn't there... That

order_by not working with foreign keys:

2007-01-23 Thread Bram - Smartelectronix
Hello Everyone, Trying this: Book.objects.all().order_by('-app_statistics.avg_rating') I get: ProgrammingError at /bleep/ ERROR: missing FROM-clause entry for table "app_statistics" at character 375 Anyone know what the problem is? (working with trunk,

currently online users?

2007-01-23 Thread Bram - Smartelectronix
hey everyone, haven't seen any hacks around, so thought I'd better ask... is there a way to get the "currently online users" in some way? Something like: "if a user has done something in the last 2 minutes he's considered online". Or is this exactly what "last_login" can be used for? Any

generic relations for auth.User instead of myapp.UserProfile?

2007-01-19 Thread Bram - Smartelectronix
Hello everyone, currently we have a working UserProfile, working with the auth.User. Now, we plenty of things in this profile (tags, favorites, the usual social networking blah ;-)), and we would really like to move them to User as the rest of the models all refer to User! So, there's

Re: newforms validation

2007-01-17 Thread Bram - Smartelectronix
serbaut wrote: Respect! Dont have time to wait though... :D Can you please consider passing the cleaned value to the (undocumented?) clean_%s method in Form.full_clean()? -value = getattr(self, 'clean_%s' % name)() +value = getattr(self, 'clean_%s' %

Re: subclassing in newforms

2007-01-17 Thread Bram - Smartelectronix
Bram - Smartelectronix wrote: If you say more people have tried it (without reading this before ;-)) I would think the intuitive way is definitely the way to go. replying to my own mail... it does make the *order* of the fields in the template render rather unintuitive... Intuitively I'd say

  1   2   >