Re: Problems creating a project with django-admin startproject (New Django user)

2007-10-03 Thread Nis Jørgensen
[EMAIL PROTECTED] skrev: > Just installed python/apache/django/mod_python with all the latest > versions. > > I think I got most of my PATH variables set up correctly. However, > when I try: > > C:\django>django-admin.py startproject testproject1 > Traceback (most recent call last): > File

Re: error when trying to save unicode data

2007-10-02 Thread Nis Jørgensen
Kenneth Gonsalves skrev: > On 02-Oct-07, at 6:21 PM, Nis Jørgensen wrote: > > >>> get_or_create, *only* using the value of 'word' in the query - if >>> created, then I do an update to set the other fields - otherwise I >>> leave it alone. >>&g

Re: error when trying to save unicode data

2007-10-02 Thread Nis Jørgensen
Kenneth Gonsalves skrev: > > I now do > get_or_create, *only* using the value of 'word' in the query - if > created, then I do an update to set the other fields - otherwise I > leave it alone. You could also use the "defaults" argument to get_or_create:

Re: error when trying to save unicode data

2007-10-02 Thread Nis Jørgensen
Kenneth Gonsalves skrev: > hi, > > I have a view that takes a sentence in unicode from a database, > splits it into words and dumps those words in the Word table. The > 'word' in word table is unique, and it is expected that duplicates be > rejected, so I put 'save()' within a try-except

Re: RSS feed reader in Python

2007-10-02 Thread Nis Jørgensen
stanleypark skrev: > We just finiched a really cool RSS feed news reader. I need people > comments on it. > here is the link of the web site. > I see no link at this point in your post. Anyway, who are "we"? > If you wish to know more about RSS feeds here is a group link that I > just started.

Re: strange behavior of primary_key and ManyToManyField

2007-10-01 Thread Nis Jørgensen
zeliboba skrev: > actually, I understand how it works, it seems to be a bug anyway. > consider this: > > from django.db import models > > class Author(models.Model): > name = models.CharField(maxlength=50) > > class Reference(models.Model): > """ > >>> a = Author(name='some name') >

Re: Objects.get() need to limit 1 record

2007-10-01 Thread Nis Jørgensen
cschand skrev: > Thanks for you replies > > but one thing... there are some differences between get and filter > > from get return obj is user model obj > but in filter it is recordsets... (I don't know i am right or not) > .get(...) returns a model object .filter(...) returns a queryset -

Re: baffling i18n problem after unicode update

2007-09-20 Thread Nis Jørgensen
Kenneth Gonsalves skrev: > On 20-Sep-07, at 4:42 PM, Werner F. Bruhin wrote: > > >>> other pdf reports. Not this particular one. I *know* there has to be >>> some very simple explanation for this - but cant for the life of me >>> find what it is. >>> >>> >> Does "Good" in Finish use

Re: unknown encoding cp0

2007-09-19 Thread Nis Jørgensen
Benedict Verheyen skrev: > Hi, > > a while back i updated my python isntall to version 2.5.1. on a Windows > 2000 server. It also runs Apache 2.2 & mod_python for Django. > Since the python upgrade, i got this "unknown encoding cp0" error. > > I hadn't changed anything to the code. The errors

Re: cronjob

2007-09-18 Thread Nis Jørgensen
patrickk skrev: > now I get: > ImportError: No module named django.core.management > > the directory "django_src" is on my python-path. > It probably isn't on cron's python-path, though. Try adding PYTHONPATH=/your/python/path to the top of your cronta

Re: ERROR: duplicate key violates unique constraint

2007-09-18 Thread Nis Jørgensen
Michal skrev: > Hello, > I have problem with inserting duplicate rows into DB. > > There is registration form on my site. User fill email address together > with additional parameters (form definition: http://dpaste.com/19959/). > After POST it to the server, email is checked in form against

Re: ifequal function not working?

2007-09-14 Thread Nis Jørgensen
John M skrev: > the ID is the primary key ID generated by django on models. > > basically, it's not the syntax im having issue with, i think the > selected_id is being passed / parsed as a string not an intenger like > ID is. > So where do you get the selected_id from? GET/POST variables are

Re: Deleting the relations and not the objects?

2007-09-14 Thread Nis Jørgensen
Xan skrev: > class Aclass(models.Model): > be = models.ForeignKey('B') > ce = models.ManytoManyfield('C') > > class B(models.Model): >[...] > > class C(models.Model): > [...] > > Suppose that with admin interface, I put: > be = b1 (b1 is B) > ce has c1, c2,

Re: Only Simplified Chinese translation not working?

2007-09-13 Thread Nis Jørgensen
Ryan K skrev: > Hi. I have a few languages I've translated my site into. They all work > except Simplified Chinese. Any hints as to why? > Try being more specific than "does not work". Do you see English, garbled characters, something else? > This is in my settings file: > > LANGUAGES = ( >

Re: how to validate not blank field?

2007-09-10 Thread Nis Jørgensen
[EMAIL PROTECTED] skrev: > thanks for your reply! i resolved using this code in the models.py > before save(): def save(self): if len(self.title)<6: raise > ValidationError("cannot be blank or small than 6 byte!") it works for > me! > > but i find this code in django-tagging

Re: how to validate not blank field?

2007-09-10 Thread Nis Jørgensen
[EMAIL PROTECTED] skrev: > i used this: def isBlank(field,all_data): if field_data is None: > raise ValidattionError(u'Cannot be Blank.') > > it not work for me. It seems you are being bitten by the behavior described thus in the documentation: """ After a form has been submitted, Django

Re: another complex SQL / extra() question

2007-09-06 Thread Nis Jørgensen
) > > but that doesn't work either (even though the raw SQL does, even with > the WHERE id IN (...). ) > > Any ideas? > Idea #1: Be more specific than "does not work" #2: Find out what SQL is generated, and how it differs from what you run from the db

Re: isnull lookup's contradicting result

2007-09-06 Thread Nis Jørgensen
Michael Radziej skrev: > On Thu, Sep 06, Russell Keith-Magee wrote: > > >> On 9/6/07, Michael Radziej <[EMAIL PROTECTED]> wrote: >> >>> I'd *love* to have a sneak preview of your changes, any way? ;-) >>> >> Hey! Get to the back of the line! No queue-jumping! I was here first! :-)

Re: Signing with mouse

2007-09-06 Thread Nis Jørgensen
Kelsey Ruger skrev: > I am looking for a python based utility that will allow a user to sign > their name with a mouse and save the resulting image for inclusion in > a PDF. Has anyone heard of something like this? > A word of warning: Users may not be able to prodcue anythin that looks like

Re: Q lookup with both OR and AND

2007-09-06 Thread Nis Jørgensen
[EMAIL PROTECTED] skrev: > I'm having trouble piecing together a query for this model: > > class Ticket(models.Model): > ... > assigned_user = models.ForeignKey(User) > name = models.CharField(maxlength=255) > private = models.BooleanField(default=False) > > I'm trying to get all

Re: Q lookup with both OR and AND

2007-09-06 Thread Nis Jørgensen
Michael Radziej skrev: > On Thu, Sep 06, [EMAIL PROTECTED] wrote: > > >> I thought I was close with this, but it only returned tickets assigned >> to me. (The parenthesis around the 2nd and 3rd Q's obviously didn't >> help) >> >> Ticket.objects.filter(Q(private__exact=False) | >>

Re: Problem with Mysql database

2007-09-06 Thread Nis Jørgensen
Nader skrev: > I have used 'inspectdb' to produce the model, because I had a dump > mysql file. In Meta section of model I have defined the table name: > > class Meta: > db_table = 'Dataset' > > Besides If I check the application model with "python manage.py sqlall > dataset" I see the

Re: Djangonauts in Sweden?

2007-09-06 Thread Nis Jørgensen
Nis Jørgensen skrev: > Emil Björklund skrev: > >> Hi folks, >> >> Two part post: >> >> 1. Just wanted to introduce myself: Emil, web designer/developer from >> Malmö in southern Sweden, studying Information Architecture at Malmö >> University w

Re: django checkout doesn't work..

2007-09-03 Thread Nis Jørgensen
ng the methods used by svn or similar. In this case, ask your system administrator for help. Nis Jørgensen No House IT --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this gro

Re: Multiple one-to-one relationships for a single class

2007-08-31 Thread Nis Jørgensen
Malcolm Tredinnick skrev: > On Tue, 2007-08-21 at 21:21 -0700, Catriona wrote: > >> What I have is an event which has about 12 fields. Optionally any >> combination of a single weather record, a single event detail record, >> a single survey record and one of four event subclass records may be

Re: unique_together and composite columns indexing

2007-08-30 Thread Nis Jørgensen
Peter Melvyn skrev: > Hi all, > > if I'm not mistaken, if I have a model with unique constraint > 'unique_together', Django does not support composite index of related > columns, i.e. > > class AModel (models.Model): > col_a = models.CharField(maxlength=20, db_index=True) > col_b =

Re: [Urgent] Freelance Django Developers Wanted

2007-08-30 Thread Nis Jørgensen
ble to work > independently, but also be able to demonstrate effective people and > time management skills, so as to deliver work within our deadlines. > > Send us your daily/hourly rates, your availability as well as a few > words about work you've done before. > > Any ques

Re: Django app for locations? (countries, provinces, cities, venues...)

2007-08-27 Thread Nis Jørgensen
Austin Govella skrev: > Is there an existing Django app for managing locations? > > Specificall, countries, states/provinces, cities, and specific > locations with addresses. > > > > (I was just adding such an app to my project, but thought I might be > duplicating someone better effort...) >

Re: Dynamic OR queries

2007-08-27 Thread Nis Jørgensen
Steven Armstrong skrev: > Chris Hoeppner wrote on 08/25/07 18:40: > >> Hi there! >> >> I was just wondering how to dynamically "or" together an indetermined >> quantity of Q objects. They're constructed from a string like q=a+b+c, >> which would get stiched together as "(Q(field=a) |

Re: Using Filter on a list of objects?

2007-08-09 Thread Nis Jørgensen
Greg skrev: > Nis, > Thanks for the help. We'll I got my view to work for website visitors > searching by any combintation of Size, Price, and Color. My code is > not the most efficient and I wonder how the performance is going to be > once I add more products and take it off of developmental

Re: Using Filter on a list of objects?

2007-08-08 Thread Nis Jørgensen
Greg skrev: > Tim, > I added your code into my view. However, it seems to error out on me > when I get to the line 'if 'color' in request and request['color'] <> > NO_COLOR: '. The error says: > > KeyError at /rugs/searchresult/ > '0 not found in either POST or GET' > The error message

Re: DB queries with filter and exclude

2007-08-07 Thread Nis Jørgensen
[EMAIL PROTECTED] skrev: > Wow, thanks for the reply. I can't get this to work though--I get an > "iteration over non-sequence". Can you take a look? > author.book_set is a Manager. You need author.book_set.all() (or author.book_set.all in a template) to get a QuerySet which you can iterate

Re: age in years calculation

2007-08-03 Thread Nis Jørgensen
Lucky B skrev: > how about surrounding the statement with a try and work the leap year > to regular year case with the exception? That seems like overkill. There isn't really any leap-year handling necessary: import datetime.date as date def age (d1, d2=None): if not d2: d2 =

Re: How to get selected value set in newforms

2007-08-02 Thread Nis Jørgensen
[EMAIL PROTECTED] skrev: > I think the problem is related to passing the resultsdict dictionary to the > DisplayForms. > Once, I did not pass in the dictionary then the initial value works. > Yes. Passing in values creates a bound form. Initial data are used only for unbound forms. I think

Re: Admin & Models

2007-08-02 Thread Nis Jørgensen
Nathan Ostgard skrev: > list_display can use functions as their value... so, you can have: > > class Employee(models.Model): > sub_dept = ForeignKey(SubDept) > > def company(self): > return sub_dept.dept.company > > def dept(self): > return sub_dept.dept > > class Admin: >

Re: How to get selected value set in newforms

2007-08-02 Thread Nis Jørgensen
[EMAIL PROTECTED] skrev: > I am still having problems setting the select widget to the 3rd value in the > drop down list. > Looking further it seems that the html does not have the selected="selected" > value in any of the items. > The documentation states that if use a bound form you will

Re: Model Examples page, gone?

2007-08-02 Thread Nis Jørgensen
Nimrod A. Abing skrev: > Hello, > > I was just going through the current docs and wanted to look up some > examples and I noticed that the Model Examples page is gone: > > http://www.djangoproject.com/documentation/models/ > > though it can still be accessed in the older versions of the docs. > >

Re: Postgresql and transactions, revisited

2007-08-01 Thread Nis Jørgensen
Russell Keith-Magee scribit: > On 7/31/07, Nis Jørgensen <[EMAIL PROTECTED]> wrote: > >> I had the problem that any db error in any of my tests (including >> setups) would cause all following tests to fail (because the transaction >> was not rolled back). This w

Postgresql and transactions, revisited

2007-07-30 Thread Nis Jørgensen
I want to use the test framework with my application, using postgresql/psycopg2. I had the problem that any db error in any of my tests (including setups) would cause all following tests to fail (because the transaction was not rolled back). This was made even worse by the fact that I used the

Re: Displaying the contents of a Dict (Using POST)...showing 'x' and 'y' keys?

2007-07-27 Thread Nis Jørgensen
Greg skrev: > I post some info to a view. When I do a 'assert False, request.POST' > I see the following > > [u'2'], u'5': [u'2'], u'4': [u'3'], u'7': [u'---'], u'6': [u'2'], > u'y': [u'4'], u'8': [u'---']}> > > It should only have 8 keys (1 through 8). Instead I see the keys 'x' > and 'y'?

Re: Best way to pass data to a HttpResponseRedirect?

2007-07-27 Thread Nis Jørgensen
Michael Lake skrev: > Hi all > > Nis Jørgensen wrote: > >> The argument to HttpResponseRedirect is a url. You seem to be confusing >> it with a template. >> > > OK I can do this: > > code > # some error occu

Re: Best way to pass data to a HttpResponseRedirect?

2007-07-27 Thread Nis Jørgensen
Michael Lake skrev: > Hi all > > A really simple question: > > I'm mostly using code like this: > data = {'message': 'Some message to user...'} > return render_to_response('main.html', data) > > But for error messages to users if one wishes to use a redirect like this: > return

Re: Problem when deleting a register from the database

2007-07-26 Thread Nis Jørgensen
AnaReis skrev: > Hi all! > I have a delete that isn't working properly. It deletes more than 1 > register when it shouldn't because I'm specifying the primary key in > the filter. > The class file is this: > class UserInstrument(models.Model): > user_name = models.CharField(primary_key=True,

Re: Forms for complex model hierarchies

2007-07-26 Thread Nis Jørgensen
Jonathan Buchanan skrev: > On 7/26/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > >> Hi group, >> >> I have a rather complex hierarchy of models. Say, I have a model A. A >> has a 1:N relation to model B, which itself has a 1:N relation to >> model C. >> >> What I want is a single web

Re: Django - technology or magic?

2007-07-24 Thread Nis Jørgensen
to_see skrev: > "Any sufficiently advanced technology is indistinguishable from > magic." > Arthur C. Clarke, "Profiles of The Future", 1961 (Clarke's third > law) > > Snippet #26 solved my problem, essentially in two lines. I could not > write those lines for myself now, and I'm not

Re: Related Field has invalid lookup: icontains

2007-07-23 Thread Nis Jørgensen
l5x skrev: > Hello, > > I have code for searching: > > news = News.objects.filter( > Q(title__icontains=phrase) > | Q(tags__icontains=phrase) > | Q(short__icontains=phrase) > | Q(content__icontains=phrase) > | Q(author__icontains=phrase) > | Q(source__icontains=phrase) > ) > News

Re: reverse pagination

2007-07-23 Thread Nis Jørgensen
Amit Upadhyay skrev: > Hi, > > You are all aware of object pagination, search results, your photo on > flickr, stories on reddit, all have a next page/previous page paradigm. > Django makes it trivially easy to create such pages by providing object_list > generic view. There are some problems

Re: 4 beginner's questions

2007-07-21 Thread Nis Jørgensen
Stefan Matthias Aust skrev: > > Let's assume you have users who are allowed to assign nick names to > theirselves and still all thoses nick names must be different. This is > want I call a random ID. > If a user assigns it, it is not random, by any definition of random I can think of. I do

Re: How to loop through a Dict to add values?

2007-07-20 Thread Nis Jørgensen
Greg skrev: > Derek, > Ok...I made the change and I'm now getting the error: > > TypeError at /rugs/cart/1/4/ > unsupported operand type(s) for +: 'int' and 'Price' > > Is 'a['choice'].price' not an Int? It says it is in my model file. > No it doesn't - "price" is defined as a ForeignKey to

Problems with fastcgi and pidfile

2007-07-20 Thread Nis Jørgensen
I cannot seem to get manage.py runfcgi pidfile=myfile.pid to work unless I have daemonize=false as well. I haven't started investigating what actually happens - thought I'd hear if I am doing something stupid first. Django is [EMAIL PROTECTED], Debian Etch, python 2.4.4, flup 0.2126-1

Re: Problem when inserting into a table with a MySQL auto_increment primary key

2007-07-18 Thread Nis Jørgensen
AnaReis skrev: > Hi all, > I have a problem when inserting a register into this table that I'm > working with. > This table belongs to a MySQL database and the storage engine is > MyISAM. The database that I'm using is a legacy database and I can't > change it in any way. > When I insert a

Re: sessions - cookies in opera

2007-07-18 Thread Nis Jørgensen
Daniel Kontsek skrev: > Hello > > I have a web application with 2 views. The first view checks if the > session dictionary has a 'uid' key - if not it generates an random ID > and puts it into request.session dict. The second view reads the uid > from the session dict and creates a Project DB

Re: Unique=true

2007-07-18 Thread Nis Jørgensen
Nis Jørgensen skrev: > [EMAIL PROTECTED] skrev: > >> OK, fixed the above problem -- figured out that it was related to my >> setting unique=True on a field. But that raises the larger question... >> >> I have a bit of data that may or may not exist... a identifi

Re: Unique=true

2007-07-17 Thread Nis Jørgensen
[EMAIL PROTECTED] skrev: > OK, fixed the above problem -- figured out that it was related to my > setting unique=True on a field. But that raises the larger question... > > I have a bit of data that may or may not exist... a identifier on the > user that not all users will have, but if they DO

Re: model managers of base classes

2007-07-17 Thread Nis Jørgensen
omat skrev: > Thanks for the pointer, Nis. > > Model inheritance made my models so much DRYer that it will be hard to > give up, at least psychologically... > > And, except for the managers, it worked just as I would expect, and > for the managers, it was easy to patch. > Just to make sure I

Re: Greenpeace Source Code

2007-07-17 Thread Nis Jørgensen
FrostedDark skrev: > Does anyone have the Greenpeace source code... their svn server has > been down for over a week now and I would love to take a look at it. > It has moved here: https://svn4.cvsdude.com/greenpeace/custard Yours Nis Jørgensen Currently doing other Dj

Re: model managers of base classes

2007-07-17 Thread Nis Jørgensen
wrong? > This is by "current" design - subclassing of models is not supposed to work yet. Here is a writeup of how it will likely work: http://code.djangoproject.com/wiki/ModelInheritance Since this is currently not supposed to work

Re: Cross Importing Model Problem

2007-07-05 Thread Nis Jørgensen
Bryan Veloso skrev: (I am only commenting on the model (database and Django) in this post - I don't really know enough about imports to help you with that bit) > I have 2 models for an MMORPG control panel I'm building. Each set of > data is within it's own app with related models, etc. So

Re: Sybase support for Django

2007-07-04 Thread Nis Jørgensen
Russell Keith-Magee skrev: > Ok. In which case, a Sybase backend will probably hit the same > problems as the existing MS SQL backend. MS SQL doesn't contain > support for LIMIT/OFFSET in queries, which Django uses these keywords > to optimize the results obtained from large queries. (I think

Re: generating customized flyers (pngs or pdf)

2007-06-27 Thread Nis Jørgensen
KpoH skrev: > Hello, > use PIL (http://www.pythonware.com/products/pil/) for this > Note the nice logo in the left sidebar :-) Nis --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post

Re: reduce execution time of object.count()

2007-06-13 Thread Nis Jørgensen
Nis Jørgensen skrev: > > What is missing above is creating INSERT/UPDATE/DELETE rules for the > "entity" view. I hacked together the ones below - they seem to work, > but there might be subtle points of how this works that I have not > understood. > [...]

Re: reduce execution time of object.count()

2007-06-13 Thread Nis Jørgensen
Nis Jorgensen skrev: > Paul Rauch wrote: > >> Is there a way to reduce execution time by counting objects? >> >> it's even splitted in two queries now, with only 2474487 entries ;) >> >> in django I use "model.objects.count()" >> >> SELECT COUNT(*) FROM "rainbowtables_hashes":34.552 >> >>

Re: applying patch

2007-06-10 Thread Nis Jørgensen
cesco skrev: > Hi, > > I'm trying to apply the patch given in > http://code.djangoproject.com/ticket/3297 > using tortoiseSVN on windows but I get the following error message: > > The line "Index: " was not found > Either this is not a diff file or the diff is empty. > > The file I downloaded

Re: Problem with postgres transactions

2007-06-05 Thread Nis Jørgensen
Joshua D. Drake skrev: > Nis Jørgensen wrote: >> [...] anytime a >> database error occurs, all subsequent calls to the database fails with >> the error message "ProgrammingError: current transaction is aborted, >> commands ignored until end of transaction

Problem with postgres transactions

2007-06-05 Thread Nis Jørgensen
Hello all I am using Django 0.96 with postgresql 8.1 and psycopg2. The error handling does not work as I would expect it to. Specifically, anytime a database error occurs, all subsequent calls to the database fails with the error message "ProgrammingError: current transaction is aborted,