Re: maximum recursion depth exceeded ???

2008-10-20 Thread Thomas Guettler
) inside login(): > def login(request ,template_name): > ... > login(request, v) > I guess you mean user.login() HTH, Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Ma

How to use class_prepared signal

2008-10-16 Thread Thomas Guettler
in the permission table is not done yet. Any suggestions? Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django

Re: DB record retrieval from every N minutes

2008-10-15 Thread Thomas Guettler
delta(minutes=fudge_minutes) to compute the start and end times of your target time. http://docs.djangoproject.com/en/dev/ref/models/querysets/#range On unix you would set up a cron-job which gets called very N minutes. Does this help you? Thomas -- Thomas Guettler, http://www.thomas-guettler.de/

Re: Development server serves media from wrong directory

2008-10-10 Thread Thomas Guettler
Hi, > MEDIA_URL = 'D:/workspace/isiscore/media/ That's not a URL. A URL looks like 'http://myserver/' or '/media/' Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de --~--~-~--~~~---~--~~ You recei

Re: newbie question about breadcrumbs

2008-10-10 Thread Thomas Guettler
.org/snippets/1026/ Of course it only works for views that you created. It does not change the breadcrumbs of the admin page. Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de --~--~-~--~~~---~--~~ You received this m

Re: Learning Django

2008-10-10 Thread Thomas Guettler
first. If you have read and understood the python tutorial, you can ask yourself (or google) if you want to try postgres instead of mysql. If this is solved, install your favorite database and open your web browser: http://docs.djangoproject.com/en/dev/ HTH, Thomas -- Thomas Guettler, ht

Re: test client post exception due to cStringIO

2008-10-09 Thread Thomas Guettler
ypeError: expected read buffer, dict found > > My conclusion is that my client.py imports StringIO from cStringIO, > which doesn't accept a dict as content in its __init__ method. But I > can't be the only person using django to have cStringIO installed, > right? So someone would have

Re: What happened to django.core.validators

2008-10-09 Thread Thomas Guettler
meppum schrieb: > Is there an equivalent? > > > This page explains form and field validation: http://docs.djangoproject.com/en/dev/ref/forms/validation/ HTH, Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-g

Re: pdf file generated problem

2008-10-07 Thread Thomas Guettler
buffer.close() > response.write(pdf) > - > attach = pdf > mail = EmailMessage(subject, message, sender,[send_to]) > mail.attach(attach.name, attach.read(), attach.content_type) > mail.send() > > this will give me error saying ob

Re: SQL: Migration How To?

2008-10-07 Thread Thomas Guettler
diff orig.sql new.sql Now you need to now a little SQL to write the correct "ALTER TABLE ..." statements. But must of the time it is not that difficult. HTH, Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli

Re: pdf file generated problem

2008-10-07 Thread Thomas Guettler
> except Exception, e: > raise ValueError, e > request.user.message_set.create(message="Mail sent successfully.") > return HttpResponseRedirect('../') > > The problem here is if I say attach = response then I am getting error > 'HttpResponse'

Re: reverse() outside HTTP-Context (SCRIPT_NAME)

2008-10-02 Thread Thomas Guettler
d adds the http://servername/) should be callable within http context, too. I can live with the current algorithm. But maybe the documentation of reverse() could be enhanced. Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettle

reverse() outside HTTP-Context (SCRIPT_NAME)

2008-10-02 Thread Thomas Guettler
it. But it only returns '/myview/'. Is this a bug in the docs, code or in my brain? docs for reverse(): http://docs.djangoproject.com/en/dev/topics/http/urls/#reverse Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de

Re: How to process 1 form data to another form??

2008-09-30 Thread Thomas Guettler
T parameter: http://.../myview?mail_id=1_id=2 In myview: request.GET.getlist('mail_id') --> ['1', '2', ...] HTH, Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de --~--~-~--~~~---~--~~ You received thi

DateField range searches

2008-09-29 Thread Thomas Guettler
ld be too much magic to change django, that range searches with dates values on datetime columns get automatically expanded. Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de --~--~-~--~~~---~--~~ You received this

AdminDateWidget outside admin

2008-09-26 Thread Thomas Guettler
After adding widgets.css it works. Is this a bug or an undocumented feature? Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de --~--~-~--~~~---~--~~ You received this message because you are subscribed

Re: nested applications and syncdb question

2008-09-26 Thread Thomas Guettler
from myclass import MyClass file myclass.py: class MyClass(models.Model): class Meta: app_label='myapp' HTH, Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de --~--~-~--~~~---~--~~ You received

Re: How to View Raw Generated SQL

2008-09-25 Thread Thomas Guettler
t from db cursor? I found > http://docs.djangoproject.com/en/dev/faq/models/#how-can-i-see-the-raw-sql-queries-django-is-running > by this doesn't show anything. When they say "just do this", are they > implying we should run that from a manage.py shell? > > --

Admin: ManyToMany: SelectMultiple on both Admin Pages

2008-09-16 Thread Thomas Guettler
. Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Re: basic http authentication in API

2008-09-15 Thread Thomas Guettler
mark schrieb: > Hi All, > > i'am writing API for a service and i want to use basic http > authentication for my service users. > > I use this: http://code.djangoproject.com/ticket/689 HTH, Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) th

Re: A trick to force autoreloading, in case of changes in views.py

2008-09-15 Thread Thomas Guettler
g to the subject. I just hit reply without removing it. Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "

Re: ***SPAM*** A trick to force autoreloading, in case of changes in views.py

2008-09-12 Thread Thomas Guettler
; > Now you can edit your views_base.py and see the changes in action, > without restarting Web Server (except of args of defs(request, args). > > > > -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de --~--~-~--~~~-

Decoupling authorization from view

2008-09-11 Thread Thomas Guettler
this view and a small middleware to render "403 forbidden" pages. Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Goo

Re: Persistent Global Imports

2008-09-11 Thread Thomas Guettler
HI, Maybe your apache starts a new child for every request? ... -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: get_absolute_url gotcha

2008-09-11 Thread Thomas Guettler
; does not necessarily mean what it says. The error message is > also displayed if there is an error in the the method. > -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de --~--~-~--~~~---~--~~ You recei

Re: Persistent Global Imports

2008-09-11 Thread Thomas Guettler
y view files for > *every* request, which makes the application unusably slow. > Please post your wsgi configuration. Do you have something like maximum-requests=1? Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) th

Re: When can you call urlresolvers.reverse()?

2008-09-09 Thread Thomas Guettler
, **kwargs): return lazy_string(urlresolvers.reverse, *args, **kwargs) }}} from lazy import reverse instead of from django.core.urlresovlers import reverse HTH, Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de

Hierarchical Tagging

2008-09-09 Thread Thomas Guettler
Hi, django-tagging looks nice, but I need to have hierarchical tags: animal / bird / eagle Any idea: Hack/Update django-tagging, create own, use django-??? Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de

always rollback decorator

2008-09-09 Thread Thomas Guettler
is the commit_on_success decorator sends COMMIT. I guess I need to convert all commit_on_success decorators to a new commit_on_success_unless_inside_transaction decorator. Any idea how to solve this? Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler

Re: Wiki/CMS app?

2008-08-28 Thread Thomas Guettler
progress can be viewed: > http://timikidemo.io41.com/ > > Tim ^,^ > > > -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: Wiki/CMS app?

2008-08-27 Thread Thomas Guettler
rom being mature or production ready, but is usable and > I'm actively working on it. (I only started development about 2 or 3 > weeks ago.) > > See http://launchpad.net/timiki for getting the code. It's only in a > bzr repository for now as it's not release worthy yet. > > I will

Wiki/CMS app?

2008-08-26 Thread Thomas Guettler
control is no issue for me. All users can edit everything. - liberal licence (at best BSD-like) - of course: Django based. is there already something like this? Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de

Re: Adding fields to form in form.clean()

2008-06-25 Thread Thomas Guettler
schrieb: > On Wed, 2008-06-25 at 09:27 +0200, Thomas Guettler wrote: > >> Hi, >> >> depending on the values from form.cleaned_data, I want to present different >> input fields to the user. Example: >> The user chooses a country, and after submit (no aj

Re: upload file to specific directory/id?

2008-06-25 Thread Thomas Guettler
Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send em

Adding fields to form in form.clean()

2008-06-25 Thread Thomas Guettler
the uncleaned request.POST or form.data. I guess I need to create two forms .. Any hints? Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de --~--~-~--~~~---~--~~ You received this message because you are subscribed

Re: dynamically filling ChoiceField

2008-06-23 Thread Thomas Guettler
mically fill a ChoiceField by filtering on a value known > to the URLView? Every "dynamic fill" example I've found assumes the > form knows it all - I haven't seen anything which shows me how to pass > that value from the view to the form. > > -- Thomas Guettler,

Re: Full-text searching in postgres with qsrf

2008-05-14 Thread Thomas Guettler
e. According to http://www.djangoproject.com/documentation/db-api/ you need select_params select={ 'rank': "rank_cd(textsearchable, to_tsquery(%s), 32)", }, Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de --~--~-~--~-

Re: is_valid() name change?

2008-04-25 Thread Thomas Guettler
Malcolm Tredinnick schrieb: > On Fri, 2008-04-25 at 09:37 +0200, Thomas Guettler wrote: > [...] > > >> I wrote >> a ticket some time ago. If you care, please leave >> a comment: >> >> http://code.djangoproject.com/ticket/6675 >>

Re: is_valid() name change?

2008-04-25 Thread Thomas Guettler
at cleaned_data is sometime available and sometimes not. The developer should get a better error message then 'AttributeError'. I wrote a ticket some time ago. If you care, please leave a comment: http://code.djangoproject.com/ticket/6675 Thomas -- Thomas Guettler, http://www.thomas-guettler.de/

Re: Show diff between fresh and running database schema

2008-04-23 Thread Thomas Guettler
Malcolm Tredinnick schrieb: > On Wed, 2008-04-23 at 15:37 +0200, Thomas Guettler wrote: > >> Hi, >> >> has some one a script to show the difference between the >> running database and one which get created by syncdb? >> >> >> > Thi

Show diff between fresh and running database schema

2008-04-23 Thread Thomas Guettler
ilable for postgres, you would need something like for other DBs, too. Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups &

Running Tests: Stop at first error

2008-04-23 Thread Thomas Guettler
Hi, if one unittest fails at the database level, often all following tests fail with this error: execute SQL failed: current transaction is aborted, commands ignored until end of transaction block Is there a way to stop after the first failing test? Thomas -- Thomas Guettler, http

Re: How to get ':' in address?

2008-04-22 Thread Thomas Guettler
n/ > but shown as > http://localhost:8000/top-category%3Amaterialien/ > in the browsers address. > > any hint? Thanks > > > > -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de --~--~-~--~~~---~--~

Re: define special attributes with ModelForm

2008-04-21 Thread Thomas Guettler
args, **kwargs): super(TestForm, self).__init__(*args, **kwargs) self.fields['string'].widget.attrs['size']=64 }}} -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de --~--~-~--~~~---~--~~ You received

Re: Enterprise applications with Django

2008-04-16 Thread Thomas Guettler
news sites, forums ... > I guess YouTube is highly concurrent, distributed ... I think you can create enterprise applications with django and python. What do you think is possible with Java, that you can't do with python? Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mai

Re: One app installed several times

2008-04-16 Thread Thomas Guettler
two site. several projects which use one app: Several databases. Completely separated. my solution: One DB, several tables. Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de --~--~-~--~~~---~--~~ You received th

One app installed several times

2008-04-15 Thread Thomas Guettler
to do this better? Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to

Re: Search Frameworks

2008-04-15 Thread Thomas Guettler
ed a way to convert them to unicode. HTH, Thomas Güttler [1]: http://www.postgresql.org/docs/current/interactive/datatype-textsearch.html -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de --~--~-~--~~~---~--~~ You recei

Re: Intial Data from Script

2008-04-09 Thread Thomas Guettler
se. I found this. The solution is post_syncdb signal: http://www.b-list.org/weblog/2007/nov/21/install-time/ Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de --~--~-~--~~~---~--~~ You received this message

Application specific settings

2008-04-08 Thread Thomas Guettler
Hi, what is the best way for application specific settings? Up to now I do it like this: {{{ # settings.py import APPNAME }}} APPNAME is a small python file where I store the values. Most of the time there are only some lines like this: var=value. Thomas -- Thomas Guettler, http

Intial Data from Script

2008-04-08 Thread Thomas Guettler
Hi, how can I insert initial data from a script? Static SQL files don't work for my case. Background: I need to load some SQL (tsearch2 (postgresql)) if the database version is smaller than 8.3 ... Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas

Re: Making login work with every page.

2008-04-07 Thread Thomas Guettler
t some which are under /public/... Be sure, that you don't do infinite redirects: if not re.match(r'^/(login|logout|public/.*$', request.path) ... : ... return django.http.HttpResponseRedirect(login_url) -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: gu

Re: ModelForms check if value has changed.

2008-04-07 Thread Thomas Guettler
t; Is their a way to get the 'initial' value of the email formfield and > only perform a check if it has changed? > > I wrote a snippet which checks if a form has changed. Maybe it helps you: http://www.djangosnippets.org/snippets/621/ Thomas -- Thomas Guettler, http://www.th

Re: How to check if instance with same values exists

2008-04-07 Thread Thomas Guettler
nal server error' in his browser. But I don't think you need introspection. Since you know the object at coding time, you don't need to check what kind of objects you are dealing with. Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli

Re: paginator

2008-04-07 Thread Thomas Guettler
Horst Gutmann schrieb: > When you do the actual Paginator.page call the Paginator does nothing > more than you'd have with > Object.objects.[...].all()[lowerlimit:upperlimit]. > > And it does Object.objects.all().count() Which results in "SELECT COUNT(*) ..." Th

FYI: Random Newline in POST data

2008-04-02 Thread Thomas Guettler
: http://bugs.python.org/issue170 I post this here, in hope it safes time for other developers. Unfortunately there is no good fix (except patching python) found yet. Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de

Re: ***SPAM*** Re: Adding an "invalid" choice to a ChoiceField?

2008-04-02 Thread Thomas Guettler
> >> And required=False for the ChoiceField (which is the default). >> > > Are you sure? the newforms documentation [1] seems to indicate that > required=True is the default for all Fields. > Sorry, this was a typo. required=True is the default. -- Thomas Gu

Re: Adding an "invalid" choice to a ChoiceField?

2008-04-01 Thread Thomas Guettler
or the ChoiceField (which is the default). Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users&q

Re: How to check the SQL that the Django ORM is executing?

2008-03-28 Thread Thomas Guettler
snippets.org/snippets/344/ -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to t

Re: User created in postgresql is not found when Adding Data to the API.

2008-03-28 Thread Thomas Guettler
- drop the old DB or tables, and call syncdb. (Data gets lost) - Modify the database with "ALTER TABLE" For the second solution, you can call "./manage.py sqlall old.sql" before and "./manage.py sqlall new.sql" after the update. Then compare both files with 'diff

Re: Howto execute custom SQL from the command line

2008-03-27 Thread Thomas Guettler
l | ./manage.py dbshell -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this grou

Re: User created in postgresql is not found when Adding Data to the API.

2008-03-27 Thread Thomas Guettler
Chirolo schrieb: > Hi again. > I tried what Thomas suggested, but I still get the following error: > NameError: name 'pwdtuple' is not defined > > I am sorry, one line was missing: import os import pwd pwdtuple=pwd.getpwuid(os.getuid()) USER=pwdtuple[0] HOME=pwdtuple[5] --

Re: User created in postgresql is not found when Adding Data to the API.

2008-03-26 Thread Thomas Guettler
> __init__.py", line 33, in cursor > cursor = self._cursor(settings) > File "/usr/lib/python2.5/site-packages/django/db/backends/ > postgresql_psycopg2/base.py", line 69, in _cursor > self.connection = Database.connect(conn_string, **self.options) > Operation

Re: Using primary key ID in file upload location?

2008-03-10 Thread Thomas Guettler
re in a special directory. path../OBJECT_ID/... The drawback is, that I can't use the admin interface for uploading images. But the benefit is, that I can add attachments by copying a file into this directory. HTH, Thomas -- Thomas Guettler, http://ww

Re: form.ChoiceField

2008-03-06 Thread Thomas Guettler
admin interface. Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post

Re: Can't redirect using HttpResponseRedirect with a form in a template inclusion tag

2008-03-06 Thread Thomas Guettler
h onclick="... location.href='...'" HTH, Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group

LDAP Auth and Groups

2008-03-03 Thread Thomas Guettler
-- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to dj

Re: Problem with django.db.transaction.commit_manually

2008-02-18 Thread Thomas Guettler
Hi, You get this because the transaction is 'dirty' (some statement was executed, but there was no commit/rollback afterwards). I guess this happens in render_to_response in your example. > K' > finally: > if result['status'] == 'OK': > otherfile.test() >

Re: how to make cron works

2008-02-15 Thread Thomas Guettler
On unix (at least linux) you can run a script with an empty environment like this: env -i path/to/script This way you can test on the shell what goes wrong. I do all the set up in .bashrc an and run the cron job like this: 0 * * * . $HOME/.bashrc; $HOME/.../script HTH, Thomas [EMAIL

Re: url tag and reverse()

2008-01-31 Thread Thomas Guettler
Am Freitag, 1. Februar 2008 06:53 schrieb Eric Abrahamsen: > This is kind of an extension of an earlier (mostly unresolved) issue I > had brought up here: > http://groups.google.com/group/django-users/browse_thread/thread/63beb7566d >c352a8/1e6e137f5b5a434a > > Here's my current url conf (I've

Re: Image upload in user's directory

2008-01-31 Thread Thomas Guettler
Am Freitag, 1. Februar 2008 07:57 schrieb django_user: > Hi, > I am using the following in my Image model: > file = models.ImageField(upload_to='/%y/%m/%d') > > I want every image to be uploaded in the users directory like '// > %y/%m/%d' instead of all files in default location. > > Is it

Re: Optimistic Locking

2008-01-31 Thread Thomas Guettler
> Could you explain how this works, please? > > It looks - to my uneducated eyes - if this leaves open a potential race > condition where the mtime field could yet be changed in the database by > another process within the "decision time" of this method. Do I > misunderstand? It seems to me that

Re: Simultaneous edits

2008-01-31 Thread Thomas Guettler
Am Mittwoch, 30. Januar 2008 16:18 schrieb Michael Hipp: > Does Django have any built-in way to handle or prevent simultaneous, > incompatible edits to a database record? Some days ago there was a thread about optimistic locking: I wrote an second answer some minutes ago.

Re: Optimistic Locking

2008-01-31 Thread Thomas Guettler
Am Montag, 28. Januar 2008 10:16 schrieb Alistair Lattimore: > Thomas, > > Do you use a custom manager to select out the row before issuing the > save to make sure that the in memory timestamp matches that of the > database? > No, since I don't use caching the mtime should be 'fresh'. Since I

Re: database performance problem

2008-01-30 Thread Thomas Guettler
> def markable(checkins, project_category): > projects = project_category.projects.all() > res = [] > for day in checkins.group_dates(): > for ci in day: # for every checkin that day > if ci.project in projects: # <-- HERE > res.append(day.date) >

Re: Have get_profile() delegate to one of several profile models depending on type of user

2008-01-29 Thread Thomas Guettler
Hi, A profile is like a one to one relation. Since the future of OneToOneField is unknown I heard you should use ForeignKey() with unique=True. You can modify djangos User model (e.g. in your model file), and give it a property to make the access easier. In this get_myprofile() method, you can

Re: How can I parse and process the contents of an URL?

2008-01-28 Thread Thomas Guettler
Am Sonntag, 27. Januar 2008 19:39 schrieb MariusB: > I'm trying to take a link as an argument, open it, read it's content > and then display the first 50 characters from it. > First of all, I've tried to put the code in the views.py, but I didn't > make it. Now I made a middleware component with

Re: category counter

2008-01-25 Thread Thomas Guettler
Hi, There are two ways of counting: # Bad way: len(MyModel.objects.filter(...)) This will fetch all rows (SELECT * FROM ... WHERE ...;) # Good way: MyModel.objects.filter(...).count() This will do the couting at the database SELECT COUNT(*) FROM ... WHERE ...; If you know how to get

Re: Optimistic Locking

2008-01-24 Thread Thomas Guettler
Am Donnerstag, 24. Januar 2008 13:08 schrieb Tim Sawyer: > Hi Folks, > > I'm just evaluating django for use on a project. I have a multiuser > application where many users can be changing data at once. > > What's the status of hibernate style optimistic locking, where each object > has a version

Re: How to get a model's fk's host class?

2008-01-24 Thread Thomas Guettler
Am Donnerstag, 24. Januar 2008 05:02 schrieb xunSir: > class Person(models.Model): > PIN = models.CharField(maxlength=20, primary_key=True) > Name = models.CharField(maxlength=20) > > class Burse(models.Model): > PIN = models.ForeignKey(Person) > Cash = models.IntegerField() >

Re: How to remove email heading "Content-Type"?

2008-01-23 Thread Thomas Guettler
Am Dienstag, 22. Januar 2008 22:09 schrieb Francis: > Hi, > > I'm using the attach_alternative command to send html emails. > > But when I use this command, I always get a "Content-Type: text/html; > charset=utf-8" heading in all my emails. > > Is it possible to get rid of it? Why do you want to

Re: Django media project

2008-01-22 Thread Thomas Guettler
Am Dienstag, 22. Januar 2008 07:31 schrieb Chris: > Hello I just opened a new project on google code and I was wondering > if there was anyone that would be willing to help me work on this > project in their free time. Check it out. http://code.google.com/p/megal/ > Please give me feed back too.

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

2008-01-22 Thread Thomas Guettler
> 2. file uploads are the most vital part of freesound. While I have used > tramline successfully with splice, it still feels like a relatively ugly > solution to me (especially as you need to patch mod_python in order for > it to work). As far as I know streaming file uploads have been on the >

Breadcrumbs

2008-01-21 Thread Thomas Guettler
Hi, I developed this method to create breadcrumbs. What do you think about it? Thomas # Python from urlparse import urljoin # Django from django import http from django.core import urlresolvers from django.core.urlresolvers import reverse from django.conf import settings from

Re: static file problems (newbie)

2008-01-09 Thread Thomas Guettler
Hi, Can you access http://127.0.0.1:8000/css/idap.css ? Maybe you have a tag in you html? Am Mittwoch, 9. Januar 2008 13:49 schrieb [EMAIL PROTECTED]: > Hello Django Users, > > I looked at the documentation about the static file serving but don't > seem to get it to work. > > the url pattern

Re: Modifing User.__unicode__

2008-01-08 Thread Thomas Guettler
Am Dienstag, 8. Januar 2008 14:10 schrieb Alex Koshelev: > Simpliest way is to patch model class at applications loading time: > > #somewhere in your own models.py file of some app > from django.contrib.auth.models import User > > def user_unicode(self): > return '%s: %s %s' % (self.username,

Modifing User.__unicode__

2008-01-08 Thread Thomas Guettler
Hi, our customer wants to display the username as 'username: firstname lastname' The easiest way would be to overwrite User.__unicode__. But where should you put code like this? Up to now I put it in our middleware. Any comments, or better solutions? # middleware.py import new from

Re: Raising Http Redirect

2008-01-02 Thread Thomas Guettler
Am Mittwoch, 2. Januar 2008 11:09 schrieb James Bennett: > On Jan 2, 2008 3:49 AM, Thomas Guettler <[EMAIL PROTECTED]> wrote: > > The HTTP return codes 404 and 500 can be raised with an exception. > > > > That's very handy. Unfortunately a Http Redirect can't be raised

Raising Http Redirect

2008-01-02 Thread Thomas Guettler
Hi, The HTTP return codes 404 and 500 can be raised with an exception. That's very handy. Unfortunately a Http Redirect can't be raised. Do other django users thing this would be usefull, too? I implemented it myself. But I think something like this should be in django. #responseutils.py

Signals: Server ready to server first request.

2007-12-14 Thread Thomas Guettler
Hi, I read this: http://code.djangoproject.com/wiki/Signals But I couldn't find a solution to execute code, if the SCGI/FastCGI/WSGI server is up, ready to handle the first request. Or is there an other way (without signals)? Thomas --~--~-~--~~~---~--~~ You

Re: Testing forms

2007-11-16 Thread Thomas Guettler
Responding to myself: I choosed solution 2 (parse HTML form) with the help of ClientForm: http://www.djangosnippets.org/snippets/467/ Comments welcome Am Freitag, 16. November 2007 13:03 schrieb Thomas Guettler: > Hi, > > my has a lot of input widgets which are build fro

Testing forms

2007-11-16 Thread Thomas Guettler
Hi, my has a lot of input widgets which are build from several newform.form instances. If I want to test the form with client.post(), I need to pass all values of the input fields in a dictionary, even if I just want to modify one value. It would be nice if I could get all initial values in

No need for FileField

2007-11-13 Thread Thomas Guettler
Hi, I have model Object and I want to store 0..N files for each. To keep the files together the files should be saved under a directory like this: .../objects/ID/ FileField does not support this. Now I found a simple solution, that I want to share. The solution is simple: I don't need

Re: Circular dependencies problem

2007-11-13 Thread Thomas Guettler
Am Dienstag, 13. November 2007 12:00 schrieb [EMAIL PROTECTED]: > But then this N:M field would only be used some times... it doesn't > seam as a good way to do this. > > I could always create a big app with all the models but I would like > to be able have apps for each main class so my views.py

Re: Circular dependencies problem

2007-11-13 Thread Thomas Guettler
Am Dienstag, 13. November 2007 09:08 schrieb Thomas Guettler: > Am Dienstag, 13. November 2007 03:35 schrieb [EMAIL PROTECTED]: > > Hello, > > > > i'm new to django so excuse if this is a really stupid question. > > > > I have these three apps with are

Re: Circular dependencies problem

2007-11-13 Thread Thomas Guettler
Am Dienstag, 13. November 2007 03:35 schrieb [EMAIL PROTECTED]: > Hello, > > i'm new to django so excuse if this is a really stupid question. > > I have these three apps with are inter dependable, how can I make this > work in Django maintaining all of this modules separate. Do you really need

Re: name 'django' is not defined

2007-11-07 Thread Thomas Guettler
Am Mittwoch, 7. November 2007 15:41 schrieb Florian Lindner: > Hello, > I'm using Django trunk. > > After some weeks of paused development I started my app again today. But as > soon as I access the URL defined at the root urls.py: > > (r"^blog/", include("xgm.Blog.urls")), > > I get an error: >

Re: Start development: which branch?

2007-11-07 Thread Thomas Guettler
Am Mittwoch, 7. November 2007 12:25 schrieb Florian Lindner: > Hello, > I'm just about to start a project with Django (which will also be for > learning Django). > > Should I use trunk for development? Or is there any branch better for > development? (with regard to the introduction of newforms)

Re: newforms: how to validate form_for_model ?

2007-11-07 Thread Thomas Guettler
Am Mittwoch, 7. November 2007 12:02 schrieb parabol: > Hi, > I have a form class which is generated with form_for_model. How can I > write my custom validator? I think I should set a clean() method for > that class. Is it reasonable to say that; > > fom1.clean= def clean You could set the

Re: settings.py gets imported twice

2007-11-06 Thread Thomas Guettler
Am Dienstag, 6. November 2007 07:00 schrieb Matti Haavikko: > Here's an alternative solution - it's based on the idea that the > handlers are added to the logger only once. (getLogger returns the same > logger instance each time). > > import logging > logger=logging.getLogger("dws") > if not

<    1   2   3   4   >