Signals and model instances with deferred attributes

2011-06-21 Thread Christian Joergensen
Hello, I am experiencing an inconvenience in regards to working with signals on model instances with deferred attributes. Specifically I am trying to get a post_save signal to fire from a save() call on such a model instance. The problem is that the sender class (`origin` in

Re: Discovering the ip/port in use by runserver

2009-10-27 Thread Christian Joergensen
rocess to know what I did. You could probably just read it from sys.argv ;) /Christian -- Christian Joergensen http://www.technobabble.dk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users&q

Re: Email error reporting not working

2009-05-25 Thread Christian Joergensen
set DEBUG to False > - I defined an Admin user and entered my email address > - I ensured that Postfix is installed and running > > Is there anything else I need to do? I will gladly provide any extra > information to troubleshoot this. Does postfix receive the e-mail? Check the m

Re: Fieldlookup: NOT

2009-04-16 Thread Christian Joergensen
; > I looked at the queryset API, but it seems that there is no > alternative to qs.exclude(). What's wrong with exclude() as it is now? -- Christian Joergensen http://www.technobabble.dk --~--~-~--~~~---~--~~ You received this message because you are subscribed to

Re: Something is eating memory. How to track it down?

2009-04-07 Thread Christian Joergensen
I didn't know about that function. That is certainly prettier than my "hack" :) I assumed that was the default behaviour when iterating. There shouldn't be any need to cache previous items, as there (to my knowledge).is no way to retrieve previous items from a python iterator. Regards

Re: Something is eating memory. How to track it down?

2009-04-07 Thread Christian Joergensen
jects.all().values_list("id", flat=True) for obj_id in objs: obj = Model.object.get(pk=obj_id) do_something(obj) ... and my RAM usage was below 30 MB at all time. > Maybe it's getting late and I deserve a nice gin and tonic... Cheers, -- Christian Joergensen http

Re: Fwd: python sql query in django

2009-02-23 Thread Christian Joergensen
b=t.techpubcombo.publications_set() I believe this would work: publications = Publication.objects.filter(techpubcombo__technology=t) Regards, -- Christian Joergensen http://www.technobabble.dk --~--~-~--~~~---~--~~ You received this message because you ar

Re: newbie: printing a date in a template

2009-02-02 Thread Christian Joergensen
the date doesn't > print. Is there something simple I am doing wrong? Is `todaysdate` listed in your context? /Christian -- Christian Joergensen http://www.technobabble.dk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups &q

Re: Has anyone looked into writing an SSH backend for file uploads?

2009-01-29 Thread Christian Joergensen
What if one of the machines was unresponsive at the time of the upload? Regards, -- Christian Joergensen http://www.technobabble.dk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to

Re: Deleting a session variable

2009-01-10 Thread Christian Joergensen
'del request.session['percent']'. How do I check to see if > 'request.session['percent']' has been created? if 'percent' in request.session: del request.session['percent'] Regards, Christian -- Christian Joergensen http://www.technobabble.dk --~--~-~--~~~-

Re: which class does ####__iexact belong to, where #### is the attribute of a model?

2009-01-10 Thread Christian Joergensen
'field__iexact' actually come from? > Is it part of MyModel or somewhere else? You don't need getattr: MyModel.objects.filter(**{ my_dict['search_field'] + '__iexact': my_dict['search_value'] }) I believe that will do the trick :) Regards, Christian -- Christian Joergensen

Re: models problem

2009-01-06 Thread Christian Joergensen
respond to the SQL you are running? /Christian -- Christian Joergensen http://www.technobabble.dk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email

Re: set session expiry time in settings.py

2008-12-25 Thread Christian Joergensen
burcu wrote: > Him Team, > > i want to set session expiry time in settings.py. Could you please > help me regarding this case? http://docs.djangoproject.com/en/dev/topics/http/sessions/#session-cookie-age -- Christian Joergensen http://www.tec

Re: Does the development enterprise application have the available third party report library

2008-11-13 Thread Christian Joergensen
vance ma wrote: > Does the development enterprise application have the available report > library? What application? What library? Regards, -- Christian Joergensen http://www.technobabble.dk --~--~-~--~~~---~--~~ You received this message becau

Re: Hi guys, I'm having trouble with newform-admin interface

2008-10-25 Thread Christian Joergensen
o `python manage.py syncdb`, as you have probably installed the django.contrib.sessions application after you ran a syncdb the last time. Regards, -- Christian Joergensen http://www.technobabble.dk --~--~-~--~~~---~--~~ You received this message because you are subscr

Re: render_to_response failed to render media files in base.html

2008-10-20 Thread Christian Joergensen
sors activated and get any context processor generated extra context variables available in your template. Use the RequestContext as a base context when using render_to_response: return render_to_response('contact.html', { 'form': form, }, context_instance=RequestContext(reque

Re: syntax for runtime evaluation of Q objects

2008-10-18 Thread Christian Joergensen
te: var1 | var2 | var3 Another thing is - unless you use the key of the dictionary, a list might be more appropriate for this ;) Regards, -- Christian Joergensen http://www.technobabble.dk --~--~-~--~~~---~--~~ You received this message because you are subsc

Re: page not updating right away

2008-10-18 Thread Christian Joergensen
setting going on in my settings.py file. Is this a python cache > issue? I've tried pkill python, but doesn't work either. Is there a > template/web page cache in Django? No there isn't. Could you show us the code for your view? Regards, -- C

Re: ensuring a string does not get escaped in views.py

2008-10-18 Thread Christian Joergensen
int "album_uri_to_copy is", album_uri_to_copy album_feed = gclient1.GetFeed(album_uri_to_copy) More about debugging django here: http://simonwillison.net/2008/May/22/debugging/ Regards, -- Christian Joergensen http://www.technobabble.dk --~--~-~--~~~---~--~~

Re: cannot import name SimpleCookie on new Django install

2008-10-18 Thread Christian Joergensen
bundled module in the standard library for python 2.5 (and 2.4) Regards, -- Christian Joergensen http://www.technobabble.dk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, s

Re: how to assign a value to a model object field

2008-10-15 Thread Christian Joergensen
Lenny wrote: > Hi! > How can I assign a value to a model object field where the field name > in a string? As with any other python object, you can use setattr: setattr(instance, "property", "value") Regards, -- Christian Joergens

Re: Multiple relationships between multiple tables

2008-10-13 Thread Christian Joergensen
must actually be like ForeignKey(Person > or Phone or Email or Address or eAddress) .. Any ideas on how to achieve > this? Why aren't you using ManyToManyField's? It sounds like that's what you're trying to emulate ;) Regards, Christian -- Christian Joergensen http://www.techno

Re: how to setup the admin media?

2008-10-09 Thread Christian Joergensen
Ethan wrote: > In my first django project, use the apache server, in the admin page, > it can't find the css file. and how does the admin css file generate? http://docs.djangoproject.com/en/dev/howto/deployment/modpython/#id3 -- Christian Joergensen http://www.technobab

Re: amd64 vs x86 hosting

2008-09-24 Thread Christian Joergensen
atabase instead, and not so much whether you should use psyco or pyrex to speed up your Python code. Regards, Christian -- Christian Joergensen http://www.technobabble.dk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: json

2008-09-24 Thread Christian Joergensen
func is my javascript function which > handles data from django. but I am mainly confused about url. `url` is the URL where jQuery will request the JSON data from. It could be `/json/somefeed/` or whatever you have configured the URL of your Django view to in urls.py. Regards, Christian -- C

Re: Module not callable (Practical Django Projects)

2008-08-24 Thread Christian Joergensen
mporting markdown and running the above snippet outside of django in a python shell. Does that work? Regards, Christian -- Christian Joergensen http://www.technobabble.dk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Googl

Re: TypeError - unpack non-sequence

2008-08-20 Thread Christian Joergensen
ast where your project worked? /Christian -- Christian Joergensen http://www.technobabble.dk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send em

Re: how to locate the OS currently logged in user??

2008-08-20 Thread Christian Joergensen
rt commands >>> [line.split()[0] for line in commands.getoutput("/usr/bin/who").split("\n")] ['razor'] /Christian -- Christian Joergensen http://www.technobabble.dk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: psycopg2

2008-06-24 Thread Christian Joergensen
d at driver level, but is an application level problem. Regards, -- Christian Joergensen http://www.technobabble.dk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group

Re: Add db tables on-the-fly

2008-06-22 Thread Christian Joergensen
go idiom. If you insist, you could probably do (using 0.96): from django.core.management import syncdb syncdb() Regards, -- Christian Joergensen http://www.technobabble.dk --~--~-~--~~~---~--~~ You received this message because you are subscribed to th

Re: ASP.Net GridView Equivalent in Django

2008-06-05 Thread Christian Joergensen
Ian wrote: > I am .Net developer looking to switch over to Python. > > I have started looking at Django and was wondering if there is a > widget equivalent to ASP.Net's GridView in terms of richness of > functionality. What does ASP.Net's GridView do? Regards, -- Christian

Re: How to a record to a ManyToMany Table?

2008-06-03 Thread Christian Joergensen
Greg wrote: > Hello, > I'm trying to add a record to a ManyToMany table in a script. Use obj.m2mfield.add(related_obj). /Christian -- Christian Joergensen http://www.technobabble.dk --~--~-~--~~~---~--~~ You received this message because you are subs

Re: Apache file permission, wont let me edit file

2008-06-02 Thread Christian Joergensen
ts (root access) for that. So use sudo og su if you have that kind of access. Else you need to contact your administrator and have her do the updates for you. Regards, -- Christian Joergensen http://www.technobabble.dk --~--~-~--~~~---~--~~ You received this mess

Re: IndexError instead of DoesNotExist with filter( )[0]

2008-05-30 Thread Christian Joergensen
urns a queryset. Methods on querysets that return new querysets never raises DoesNotExist. See which methods that returns what on: http://www.djangoproject.com/documentation/db-api/ /Christian -- Christian Joergensen http://www.technobabble.dk --~--~-~--~~~---~--~~ Y

Re: A twist on cross importing models

2008-05-08 Thread Christian Joergensen
then you could just as well import it at the top of the file as you would otherwise. * that is, `import ...` not `from ... import ...`. /Christian -- Christian Joergensen http://www.technobabble.dk --~--~-~--~~~---~--~~ You received this message because you

Re: A twist on cross importing models

2008-05-07 Thread Christian Joergensen
import the model files as modules. That is, you need to do `import foo.models` in bar/models.py and `import bar.models` in foo/models.py. Then you should be able to do `foo.models.Variable.objects...`. HTH, Christian -- Christian Joergensen http://www.technobabble.dk --~--~-~--~

Re: approach on newforms fields for foreign key that can be selected or created

2008-05-06 Thread Christian Joergensen
nst the current nfa-branch and finish it off some day ;-) Regards, Christian -- Christian Joergensen http://www.technobabble.dk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" g

Re: Running django+apache on my macbook

2008-01-18 Thread Christian Joergensen
ere: http://www.djangoproject.com/documentation/install/ Note the first paragraph of "Install Apache and mod_python". Developing your applications under mod_python is quite a hassle IMO. Regards, -- Christian Joergensen | Linux, programming or web consultancy http://www.razor.

Re: Choices from table vs. Foreign Key relationship.

2007-12-18 Thread Christian Joergensen
p? Don't delete the Teacher. Instead, I would add a boolean field 'active' to the model and change the value on delete. -- Christian Joergensen | Linux, programming or web consultancy http://www.razor.dk | Visit us at: http://www.gmta.info --~--~-~--~~~---~--~~ Y

Re: New user having trouble with First View

2007-12-17 Thread Christian Joergensen
ng: [...] > Exception Type: SyntaxError > Exception Value: invalid syntax (views.py, line 6) What's on that line? -- Christian Joergensen | Linux, programming or web consultancy http://www.razor.dk | Visit us at: http://www.gmta.info --~--~-~--~~~---~

Re: Forms and .META

2007-11-23 Thread Christian Joergensen
an entry like this in your urls.py: (r'^events/(?P[^/]+)', 'project.application.views.view') And in your view collect the slug and look it up: def view(request, slug): s = get_object_or_404(Event, slug__exact=slug) I don't understand why you are talking about forms here :) -- C

Re: How to define choices that works in admin interface?

2007-11-20 Thread Christian Joergensen
gth=30, choices = > Choice.filter(""), null=False, blank=False) Normally, one would use a foreign key in this case: choice = models.ForeignKey(Choice) Regards, -- Christian Joergensen | Linux, programming or web consultancy http://www.razor.dk | Visit

Re: cronjob

2007-09-18 Thread Christian Joergensen
w/scripts/cronjobs/mail_editors.py: line > 5: syntax error near unexpected token `settings' > /var/www/vhosts/mydomain.at/www/scripts/cronjobs/mail_editors.py: line > 5: `setup_environ(settings)' > > Here´s the test-script: > > # coding: utf-8 You're missing the shebang

Re: Creating link to root

2007-09-16 Thread Christian Joergensen
the template could be used. Couldn't you just do href="/styles.css" ? -- Christian Joergensen | Linux, programming or web consultancy http://www.razor.dk | Visit us at: http://www.gmta.info signature.asc Description: OpenPGP digital signature

Re: Making the django documentation available from the admin documentation site

2007-08-23 Thread Christian Joergensen
David Reynolds wrote: > Christian, > > SmileyChris has a rather cunning application that does just that: > > http://smileychris.tactful.co.nz/ramblings/django-documentation/ > Great, thanks. :) Regards, -- Christian Joergensen | Linux, programming or we

Making the django documentation available from the admin documentation site

2007-08-23 Thread Christian Joergensen
? If anyone else has not done this before, I could start working with getting it integrated by getting the user to do a `svn export` of the docs to somewhere before firing up the admin :) Regards, -- Christian Joergensen | Linux, programming or web consultancy http://www.razor.dk | Visit us

Re: Flash Message template tag

2007-07-15 Thread Christian Joergensen
rtconner wrote: > Oh yeah I also wrote a FlashMsgMiddleware that makes this even easier. > It's not needed at all, but it'll save you a line of code here and > there. I can't post it if anyone wants it. Why not just post it to http://www.djangosnippets.org ? :) -- Christian Joergense

Re: Defining your own fields for newforms

2007-07-15 Thread Christian Joergensen
e onclear on that issue. I'll go with the DecimalField. Thank you, -- Christian Joergensen | Linux, programming or web consultancy http://www.razor.dk | Visit us at: http://www.gmta.info signature.asc Description: OpenPGP digital signature

Re: prettier html

2007-06-29 Thread Christian Joergensen
lSoup(response.content) response.content = soup.prettify() return response -- Christian Joergensen | Linux, programming or web consultancy http://www.razor.dk | Visit us at: http://www.gmta.info signature.asc Description: OpenPGP digital signature

Re: Newforms and CSS classes

2007-05-11 Thread Christian Joergensen
Christian Joergensen wrote: >>> Is it possible to have css classes attached to newforms widgets? I would >>> like to be able to distinguish between fx. checkboxes, radio buttons, >>> submit buttons, text fields (which are all 's). > >> well, yo

Re: Newforms and CSS classes

2007-05-01 Thread Christian Joergensen
lution if anyone else is interested ;) Also, please let me know if anyone else have an easier solution to this. -- Christian Joergensen | Linux, programming or web consultancy http://www.razor.dk | Visit us at: http://www.gmta.info signature.asc Description: OpenPGP digital signature

Newforms and CSS classes

2007-04-30 Thread Christian Joergensen
uired" to make CSS styling easier. Am I overlooking something, or is newforms missing this? -- Christian Joergensen | Linux, programming or web consultancy http://www.razor.dk | Visit us at: http://www.gmta.info signature.asc Description: OpenPGP digital signature

Re: Can anyone explain this?

2007-03-28 Thread Christian Joergensen
__setattr__', '__str__', 'capitalize', 'center', 'count', > 'decode', 'encode', 'endswith', 'expandtabs', 'find', 'index', > 'isalnum', 'isalpha', 'isdigit', 'islower', 'isspace', 'istitle', > 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'replace', 'rfind', > 'rindex', 'rjust', 'rst

Re: Syntax error with render_to_response call

2007-01-25 Thread Christian Joergensen
ng preventing me from using render_to_response in > this way? > > Any advice welcome - it's driving me crazy! Could it be a case of tab vs. spaces indentation? What more that Syntax Error does the django error page tell you? -- Christian Joergensen | Linux, programming or web consultanc

Re: Dynamically adding fields to a database model class

2007-01-20 Thread Christian Joergensen
Russell Keith-Magee wrote: > On 1/20/07, Christian Joergensen <[EMAIL PROTECTED]> wrote: >> I suspect there is some django magic happening behind the scenes, and >> maybe the setattr trick is not at all possible. Can anyone shed some >> light on this? > > Yes

Dynamically adding fields to a database model class

2007-01-19 Thread Christian Joergensen
is not at all possible. Can anyone shed some light on this? Thank you! [1] Like: setattr(MyModel, 'foo', models.IntegerField()) -- Christian Joergensen | Linux, programming or web consultancy http://www.razor.dk | Visit us at: http://www.gmta.info signature.asc Description: OpenPGP

Re: How can i specify rows and cols in a TextField()?

2006-12-28 Thread Christian Joergensen
Fabio Gomes wrote: I m liked the simplicity of generic views, but i can´t find a way to set up how many rows and cols my textarea have, is there a way to do it? I believe you can style them using CSS. Please correct me if i am wrong. -- Christian Joergensen | Linux, programming or web

Re: cannot update model in view

2006-12-22 Thread Christian Joergensen
is that your database driver does not support unicode. Try to encode it to something. -- Christian Joergensen | Linux, programming or web consultancy http://www.razor.dk | Visit us at: http://www.gmta.info --~--~-~--~~~---~--~~ You received this message because you

Re: how to tell if django is running from apache or standalone?

2006-11-16 Thread Christian Joergensen
sandro.dentella wrote: > Hi all, > > how can I test from within settings.py if I'm running via mod_python > or in standalone way? I need to set a variable, accordingly. You could import os and look in os.environ for differences. Maybe somthing differs. -- Christian Joerge

Re: caching views with dynamic parameters

2006-11-14 Thread Christian Joergensen
Christian Joergensen wrote: > You could do a simple: > > def my_view(request): > return render_my_view(request, request.session.LANGUAGE_CODE) > > def render_my_view(request, language_code): > # do stuff > > render_my_view = cache_page(render_my_view, ca

Re: Filtering on the existance of a "reverse" foreign key relationsship

2006-10-25 Thread Christian Joergensen
experience goes, this isn't possible. -- Christian Joergensen | Linux, programming or web consultancy http://www.razor.dk | Visit us at: http://www.gmta.info signature.asc Description: OpenPGP digital signature

Re: Filtering on the existance of a "reverse" foreign key relationsship

2006-10-25 Thread Christian Joergensen
rfectly. >> Gave me a speedup factor of about 250k :) >> >> Thanks, > > Alternatively you could use the normal django syntax: > Country.objects.filter(soccerteam__name__isnull=False) But the thing is, I can have multiple SoccerTeam relations. Doesn't that rule out this sol

Re: Filtering on the existance of a "reverse" foreign key relationsship

2006-10-24 Thread Christian Joergensen
soccerteam.country_id = appname_country.id) > 0'] > ) Great idea! I did not think about the 'extra' method. Works perfectly. Gave me a speedup factor of about 250k :) Thanks, -- Christian Joergensen | Linux, programming or web consultancy http://www.razor.dk | Visit us at: http://www.gmta.info signature.asc Description: OpenPGP digital signature

Filtering on the existance of a "reverse" foreign key relationsship

2006-10-24 Thread Christian Joergensen
lly need to use custom SQL here, or does the django ORM provide the means to solve this problem? Thanks, -- Christian Joergensen | Linux, programming or web consultancy http://www.razor.dk | Visit us at: http://www.gmta.info signature.asc Description: OpenPGP digital signature