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

2008-10-25 Thread Christian Joergensen
u probably need to do `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 be

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 because y

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: 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 to

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

2009-01-10 Thread Christian Joergensen
o put in place of '???' > Where does '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_val

Re: Deleting a session variable

2009-01-10 Thread Christian Joergensen
his is the case I get an error > when I do '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, C

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

2008-08-20 Thread Christian Joergensen
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

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: Module not callable (Practical Django Projects)

2008-08-24 Thread Christian Joergensen
odule. What is it? Try importing 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 subscr

Re: json

2008-09-24 Thread Christian Joergensen
ell, 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

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 Goo

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.tech

Re: Multiple relationships between multiple tables

2008-10-13 Thread Christian Joergensen
erField()s 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 -- Christia

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: cannot import name SimpleCookie on new Django install

2008-10-18 Thread Christian Joergensen
d 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: ensuring a string does not get escaped in views.py

2008-10-18 Thread Christian Joergensen
unning `runserver`. print "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: page not updating right away

2008-10-18 Thread Christian Joergensen
cache > 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 yo

Re: syntax for runtime evaluation of Q objects

2008-10-18 Thread Christian Joergensen
ue, just as if you wrote: 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

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

2008-10-20 Thread Christian Joergensen
_to_response to have context processors 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&#

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 p

Re: newbie: printing a date in a template

2009-02-02 Thread Christian Joergensen
oesn'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 Group

Re: Fwd: python sql query in django

2009-02-23 Thread Christian Joergensen
thing like: > > pub=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 me

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

2009-04-07 Thread Christian Joergensen
= Model.objects.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

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

2009-04-07 Thread Christian Joergensen
you. 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 ite

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 subscribe

Re: Email error reporting not working

2009-05-25 Thread Christian Joergensen
- I 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

Re: Discovering the ip/port in use by runserver

2009-10-27 Thread Christian Joergensen
inside > the django process 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 Gro

Re: prettier html

2007-06-29 Thread Christian Joergensen
ite. from BeautifulSoup import BeautifulSoup class BeautifulSoupPrettifyMiddleware(object): def process_response(self, request, response): if 'text/html' in response['Content-Type']: soup = BeautifulSoup(response.content) response.content = so

Defining your own fields for newforms

2007-07-15 Thread Christian Joergensen
complicated, so please let my know if I can clearify anything ;) The source code for CurrencyValue and CurrencyField is here: http://dpaste.com/14508/ 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: Defining your own fields for newforms

2007-07-15 Thread Christian Joergensen
nclear 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: 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 ? :) -- Chri

Making the django documentation available from the admin documentation site

2007-08-23 Thread Christian Joergensen
/python or something? 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.razo

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

Re: Running django+apache on my macbook

2008-01-18 Thread Christian Joergensen
ook here: 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.r

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" group. To

Re: A twist on cross importing models

2008-05-07 Thread Christian Joergensen
;re stuck. You need to 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.d

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 are su

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

2008-05-30 Thread Christian Joergensen
s 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: Apache file permission, wont let me edit file

2008-06-02 Thread Christian Joergensen
oot 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 message

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 su

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, --

Re: Add db tables on-the-fly

2008-06-22 Thread Christian Joergensen
Django 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

Re: How do I add the user ID to a template?

2008-06-24 Thread Christian Joergensen
x27;s a better way to do this, but I can't seem to find > an answer. Help! Use the RequestContext: http://www.djangoproject.com/documentation/templates_python/#subclassing-context-requestcontext Regards, -- Christian Joergensen http://www.technobabble.dk --~--~-~--~~-

Re: psycopg2

2008-06-24 Thread Christian Joergensen
solved 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

Re: Can anyone explain this?

2007-03-28 Thread Christian Joergensen
h__', '__init__', > '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', > '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', > '__rm

Newforms and CSS classes

2007-04-30 Thread Christian Joergensen
d required" 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: Newforms and CSS classes

2007-05-01 Thread Christian Joergensen
ld: Just thought I would mention my solution 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

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, you ca

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: cronjob

2007-09-18 Thread Christian Joergensen
at/www/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

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

2007-11-20 Thread Christian Joergensen
e', maxlength=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.

Re: Forms and .META

2007-11-23 Thread Christian Joergensen
't you just have 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 underst

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: Choices from table vs. Foreign Key relationship.

2007-12-18 Thread Christian Joergensen
the Foreign Key relationship? 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 --~--~

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

2006-10-24 Thread Christian Joergensen
Do I really 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

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

2006-10-24 Thread Christian Joergensen
E > appname_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

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

2006-10-25 Thread Christian Joergensen
27; method. Works perfectly. >> 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'

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: 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: 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 J

Re: cannot update model in view

2006-12-22 Thread Christian Joergensen
ve the thing 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 mess

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

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 Descriptio

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

Re: Syntax error with render_to_response call

2007-01-25 Thread Christian Joergensen
page. > > Is there some ruling 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 Joergense

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 django.db.models.base