Re: IntegrityError, Duplicate key, MySQL 5, blank and unique

2006-03-06 Thread Ivan Sagalaev
johnsu01 wrote: >Using trunk, I have a model that has a number of fields which are >CharFields, that I would like to be optional but if they are filled >out, unique. > > I may be well wrong but I don't think you can express this at DB level. Uniqueness at DB level includes empty value (even NU

Re: IntegrityError, Duplicate key, MySQL 5, blank and unique

2006-03-06 Thread Ivan Sagalaev
Ivan Sagalaev wrote: > if model.get_list(**{'self.field_name'+'__exact':field_data}) > > Ouch :-) Make this 'get_list' to be 'get_count' instead... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django

Re: IntegrityError, Duplicate key, MySQL 5, blank and unique

2006-03-06 Thread Malcolm Tredinnick
On Mon, 2006-03-06 at 11:25 +0300, Ivan Sagalaev wrote: > johnsu01 wrote: > > >Using trunk, I have a model that has a number of fields which are > >CharFields, that I would like to be optional but if they are filled > >out, unique. > > > > > I may be well wrong but I don't think you can express

Re: kicking off a scheduler

2006-03-06 Thread Nebojša Đorđević
[EMAIL PROTECTED] wrote: > Are there any hooks that I don't know about where I could kick off a > scheduler when my project is initialized by Django? I saw a response to > another post mentioning to use a system scheduler (cron, etc.). I > *could* do this, but would rather use the sched lib. Any i

Re: Attn. Dreamhost users

2006-03-06 Thread SmileyChris
I'm having the same issue - 500 errors trying to run hello.fcgi... I didn't install any fancy new svn however. So you're saying the problem just solved itself? :-\ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Dj

Re: MySQL error when running manage.py init on Mac OS X with Fink installed

2006-03-06 Thread Dmitry Medvedev
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 common problem, try upgrading your mysql libraries (mysql client itself) or @server set password for your user like : SET PASSWORD FOR some_user '@' some_host ' = OLD_PASSWORD(' newpwd '); Ian wrote: > I am trying to run django from svn under Mac

Re: IntegrityError, Duplicate key, MySQL 5, blank and unique

2006-03-06 Thread Ivan Sagalaev
Malcolm Tredinnick wrote: >In a correct SQL implementation, NULL is not comparable to anything, > > Yes... It should be :-). And as you said implementation is the whole another businness. johnsu01 talked about MySQL and given its history of not very strong adherence to standard but preferring

Re: Built in comments half working, Template-loader postmortem error.

2006-03-06 Thread coulix
An other probel i didn' spot. the comments i thought i added for one object (recipe) only, are actualy mapped to all recipes. its like one comment aply to all entries ! even better, when i go to the admin part / free comments i get this : AssertionError at /cefinban/admin/comments/freecomments/

Re: IntegrityError, Duplicate key, MySQL 5, blank and unique

2006-03-06 Thread Malcolm Tredinnick
On Mon, 2006-03-06 at 12:59 +0300, Ivan Sagalaev wrote: > Malcolm Tredinnick wrote: > > >In a correct SQL implementation, NULL is not comparable to anything, > > > > > Yes... It should be :-). And as you said implementation is the whole > another businness. johnsu01 talked about MySQL and give

De-Coupling and the template engine?

2006-03-06 Thread ChaosKCW
Hi One of the great design philosohies I love about Django is the decoupling. However when trying to use the template engine on its own, the import refers the django setttings module env variable, which turn should point to a settings.py which in turn is part of a project ? This seems coupled to

Re: Built in comments half working, Template-loader postmortem error.

2006-03-06 Thread coulix
FIXED : all of this was because of the slug field wich was pk. It needed ID to be pk, i therfore changed name and slug to unique. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

getting a model's content_type_id

2006-03-06 Thread Rob Slotboom
Is there a way to get a model's content_type_id? I need it to store an object's id and content_type_id in another table. Currently I solved this by using an sql-statement but maybe there is some 'hidden' property or function like: self.content_type or self.get_content_type --~--~-~--~--

Conditional Validation of Formfields

2006-03-06 Thread Luke Skibinski Holt
If a field isn't required, then it isn't validated. I need to do a conditional validation: if a field value is blank or not selected, then validate these other fields which are not ordinarily validated. Is there a way to force a formfield through the validators even if is_required=False ? Luke

Re: Conditional Validation of Formfields

2006-03-06 Thread Luke Skibinski Holt
I think I've found my solution in django/core/validators.py where the docs make a passing reference. Theres a range of "RequiredIf..." and "ValidateIf..." types to pick from that should cover my needs. Will the docs on custom manipulators/validators be padded out some in the future, or is magic

Re: De-Coupling and the template engine?

2006-03-06 Thread Daniel Ericsson
On 6 mar 2006, at 12.30, ChaosKCW wrote: > Hi > > One of the great design philosohies I love about Django is the > decoupling. However when trying to use the template engine on its own, > the import refers the django setttings module env variable, which turn > should point to a settings.py which

Re: Attn. Dreamhost users

2006-03-06 Thread Hans-Christian Holm
I've been experiencing the same with Django on Dreamhost. But after some frustrating 500 errors, my first Django app miraculously started to run fine. I just waited a few minutes. I noticed that once, I would get 500 after some compile error in my code. I don't get 500 for every compilation er

Re: De-Coupling and the template engine?

2006-03-06 Thread Russell Keith-Magee
On 3/6/06, ChaosKCW <[EMAIL PROTECTED]> wrote: > This seems coupled to me ? Is there a way to use the template engine on > its own ? Or am just missing the obvious ? Great minds think alike/Fools never differ :-) Check out: http://code.djangoproject.com/ticket/1321 This came up a few weeks ago

Re: Django in Boo

2006-03-06 Thread Hans-Christian Holm
My first reaction to Django was "hey, this looks nice, maybe it could be ported to Boo, my favourite language at the moment?" On second thought, I'd rather see Django run on IronPython. You could use Boo with that, if you wanted to. I would be very interesting to see if Django+IronPython could

Can't import view

2006-03-06 Thread tomass
Hi Folks, I have an application that I'd written in an older version of Django that I'm upgrading to 0.91 and for some reason I'm having problems with the views. Here's an excerpt from my urls.py (r'^admin/', include('django.contrib.admin.urls.admin')), (r'^jobmonitor/$', include('greenleaftech

Re: Can't import view

2006-03-06 Thread Amit Upadhyay
On 3/6/06, tomass <[EMAIL PROTECTED]> wrote: (r'^jobmonitor/$', include('greenleaftech.jobmonitor.views.index')),try: (r'^jobmonitor/$', 'greenleaftech.jobmonitor.views.index'),include is used to include a different urls file for further resolution. -- Amit UpadhyayBlog: http://www.rootshell.be/~up

are uploaded files kept in memory?

2006-03-06 Thread Istvan
I'm evaluating Django for an application in wich we need to process uploaded files of various sizes (potentially quite large). >From the docs it looks like uploaded files will kept in memory instead of being streamed into (temporary) files. Is that the case? --~--~-~--~~--

Referencing foreign keys in generic views

2006-03-06 Thread [EMAIL PROTECTED]
Hi, I don't know if I have missed something in the documentation, but it took me a quite a while to figure out how to (de)reference a ForeignKey field in object_detail view. By dereferencing a foreign key I mean a case where I have a Document class that has a field author = ForeignKey(Person).

Re: Referencing foreign keys in generic views

2006-03-06 Thread James Bennett
On 3/6/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Does anyone have a link to documentation that explains how this should > be done? Doing this in a template uses the same methods as any other use of the database API, except that the parentheses are omitted. For a reference of how the DB

Many-To-Many Filtering

2006-03-06 Thread [EMAIL PROTECTED]
Bit of newbie question I guess, but I can't seem to find the answer in the documentation or the group archive, so sorry if it's been asked before. I'm currently running the magic-removal branch and have two models looking something like this: class Topic (models.Model): parent = models.F

Django & Rico

2006-03-06 Thread Martin Ostrovsky
An out-of-leftfield question, has anybody tried and (successfully) used Rico (openrico.org) with Django? Or any XML over HTTP for that matter with Django? Just looking for some code examples. Thanks. --~--~-~--~~~---~--~~ You received this message because you are

Re: date time errors: please explain?

2006-03-06 Thread [EMAIL PROTECTED]
gizo wrote: > With all due respect, this doesn't attend to my question. oh, sorry, I thought your question was "timedelta doesn't allow for months, does it?" to which the answer is "no, because adding a month isn't a well-defined concept". > Why can I use MySQLdb from python to run a date_

Re: date time errors: please explain?

2006-03-06 Thread [EMAIL PROTECTED]
> objects for invalid dates, it's probably quite easy to get a ValueError > exception from that MySQL operation around this time of the year... get a ValueError exception from the DB bindings when they attempt to convert the invalid date to a datetime object, that is. --~--~-~--~~

Re: Django in Boo

2006-03-06 Thread Eugene Lazutkin
Hans-Christian Holm wrote: > My first reaction to Django was "hey, this looks nice, maybe it could be > ported to Boo, my favourite language at the moment?" On second thought, I'd > rather see Django run on IronPython. You could use Boo with that, if you > wanted to. I would be very interesting

Implementing Multiple File Upload

2006-03-06 Thread Rob Cowie
Hi all, I wish to implement a system that allows users to upload multiple files and associate them with a model I have defined. The model is similar to the following: class Entry(meta.http://groups.google.com/group/django-users -~--~~~~--~~--~--~---

Re: Django & Rico

2006-03-06 Thread James Bennett
On 3/6/06, Martin Ostrovsky <[EMAIL PROTECTED]> wrote: > An out-of-leftfield question, has anybody tried and (successfully) used > Rico (openrico.org) with Django? Or any XML over HTTP for that matter > with Django? Just looking for some code examples. Rico? Not that I know of. There's work under

grabbing many-many related objects

2006-03-06 Thread Alan Bailey
Hi there - I'll just start into the example I'm wondering about without introducing it. We have a bunch of users, along with the 'resources' they have access to. So, I can do this: me = persons.get_object(username__exact='bailey') me.get_resourcerecord(resource=resourcetypes.get_object(short_n

Re: Implementing Multiple File Upload

2006-03-06 Thread [EMAIL PROTECTED]
im not sure but can't you have class File(meta.Model): file = meta.FileField(...) owner = ForeignKey(Entry) class Entry(meta.Model): id = meta.AutoField(primary_key=True --~--~-~--~~~---~--~~ You received this message because you are subscribed to t

Re: grabbing many-many related objects

2006-03-06 Thread Russell Keith-Magee
On 3/7/06, Alan Bailey <[EMAIL PROTECTED]> wrote: Hi there -I'll just start into the example I'm wondering about without introducingit.  We have a bunch of users, along with the 'resources' they have accessto.So, I can do this:me = persons.get_object (username__exact='bailey')me.get_resourcerecord(

Re: Django & Rico

2006-03-06 Thread limodou
On 3/7/06, Martin Ostrovsky <[EMAIL PROTECTED]> wrote: > > An out-of-leftfield question, has anybody tried and (successfully) used > Rico (openrico.org) with Django? Or any XML over HTTP for that matter > with Django? Just looking for some code examples. > > Thanks. > You can use it just as you w

Re: grabbing many-many related objects

2006-03-06 Thread Alan Bailey
On Tue, 7 Mar 2006, Russell Keith-Magee wrote: > It's a little difficult to understand exactly what it is you want without a > concrete model example - but if I'm understanding you correctly, the answer > is 'it may be possible with trunk/0.91, and is definitely possible with > magic-removal'. >

Re: grabbing many-many related objects

2006-03-06 Thread Malcolm Tredinnick
On Mon, 2006-03-06 at 18:07 -0600, Alan Bailey wrote: > On Tue, 7 Mar 2006, Russell Keith-Magee wrote: > > > It's a little difficult to understand exactly what it is you want without a > > concrete model example - but if I'm understanding you correctly, the answer > > is 'it may be possible with

Re: Many-To-Many Filtering

2006-03-06 Thread Russell Keith-Magee
On 3/7/06, [EMAIL PROTECTED] <[EMAIL PROTECTED] > wrote:Bit of newbie question I guess, but I can't seem to find the answer in the documentation or the group archive, so sorry if it's been askedbefore.I'm currently running the magic-removal branch and have two modelslooking something like this:clas

Re: are uploaded files kept in memory?

2006-03-06 Thread Russell Keith-Magee
On 3/6/06, Istvan <[EMAIL PROTECTED]> wrote: I'm evaluating Django for an application in wich we need to  processuploaded files of various sizes (potentially quite large).>From the docs it looks like uploaded files will kept in memory insteadof being streamed into (temporary) files.  Is that the ca

Re: are uploaded files kept in memory?

2006-03-06 Thread Malcolm Tredinnick
On Tue, 2006-03-07 at 08:55 +0800, Russell Keith-Magee wrote: > > On 3/6/06, Istvan <[EMAIL PROTECTED]> wrote: > > I'm evaluating Django for an application in wich we need > to process > uploaded files of various sizes (potentially quite large). > >

Re: Many-To-Many Filtering

2006-03-06 Thread Stephen Newey
On 07/03/06, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: > > class Topic (models.Model ): > > parent = models.ForeignKey('self', null=True, blank=True, > > related_name='child') > > title = models.CharField(maxlength=128) > > description = models.TextField() > > > > clas

possible to keep elements' order while get_list(id__in=[...])?

2006-03-06 Thread EricHsu
hi all, giving a id list in which the elements' order is important, for example: category_id_list = [1, 4, 9, 6] is it possible to make sure that categorys.get_list(id__in=category_id_list) returns category object list in the same order as category_id_list? that is, make sure the returned list l

Re: Many-To-Many Filtering

2006-03-06 Thread Russell Keith-Magee
On 3/7/06, Stephen Newey <[EMAIL PROTECTED] > wrote: > At present, there isn't an 'exists' operation for queries - although it> sounds like a good addition. It would probably end up as part of aggregate> functionality, so it might be worth adding a note to ticket 1435 so your > idea doesn't get for

another bug caused importing import DJANGO_SETTINGS_MODULE error?

2006-03-06 Thread favo
anyone meet the bug below? if your have a app have the same name as projectname, manage.py will always print out : Traceback (most recent call last): File "./manage.py", line 11, in ? execute_manager(settings) File "/usr/lib/python2.3/site-packages/django/core/management.py", line 1051, i

Can/Should I place python objects in Django Session?

2006-03-06 Thread Siah
I used to think I can't and it is a bad practice to place objects (non-strings) in django sessions. I just realized I can, but I don't know if it's a good practice. Some feedback in this regard is appreciated, Thanks, Sia --~--~-~--~~~---~--~~ You received this

Re: Can/Should I place python objects in Django Session?

2006-03-06 Thread [EMAIL PROTECTED]
hi, this has been discussed before, http://groups.google.com/group/django-users/browse_thread/thread/dd83fbfc7657a9da/ http://groups.google.com/group/django-users/browse_thread/thread/25e60576dcee5d7a/ and the conclusion is although you are able to you shouldn't --~--~-~--~~

Re: Can/Should I place python objects in Django Session?

2006-03-06 Thread Siah
Thanks John, It is extremely tempting to place objects in sessions though. I'm pretty sure I'll still use it to a safe extent. Thanks, Sia --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To p

Re: Can/Should I place python objects in Django Session?

2006-03-06 Thread limodou
On 3/7/06, Siah <[EMAIL PROTECTED]> wrote: > > Thanks John, > It is extremely tempting to place objects in sessions though. I'm > pretty sure I'll still use it to a safe extent. > > Thanks, > Sia > I think you can do what you want if there is not a official way. -- I like python! My Blog: http:

Re: Attn. Dreamhost users

2006-03-06 Thread Eugene Lazutkin
Hans-Christian Holm wrote: > I've been experiencing the same with Django on Dreamhost. But after some > frustrating 500 errors, my first Django app miraculously started to run > fine. I just waited a few minutes. > > I noticed that once, I would get 500 after some compile error in my code. I >

Re: Can/Should I place python objects in Django Session?

2006-03-06 Thread Ivan Sagalaev
[EMAIL PROTECTED] wrote: >hi, >this has been discussed before, >http://groups.google.com/group/django-users/browse_thread/thread/dd83fbfc7657a9da/ >http://groups.google.com/group/django-users/browse_thread/thread/25e60576dcee5d7a/ > >and the conclusion is although you are able to you shouldn't >

Re: possible to keep elements' order while get_list(id__in=[...])?

2006-03-06 Thread Ivan Sagalaev
EricHsu wrote: >is it possible to make sure that >categorys.get_list(id__in=category_id_list) returns category object >list in the same order as category_id_list? > Nope. The order of a result of a query without 'ORDER BY' is undefined. But as soon as you have python list in memory you can sort

URLField Limit 200 maxlenght

2006-03-06 Thread favo
URLField is limit to 200 maxlenght, and not expose a agrument to change, hope that fix in next version of Django. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send ema