Re: Date Widget (or date format) in newforms

2007-07-19 Thread Russell Keith-Magee
On 7/20/07, larry <[EMAIL PROTECTED]> wrote: > > Has anyone written a date widget with separate fields for day, month, > and year (and, ideally, a calendar) for the newforms package? Check out the capabilities of MultiWidget. This provides a mechanism to break apart a single model field into mult

Re: Debugging file uploads

2007-07-19 Thread Russell Keith-Magee
On 7/19/07, Stefan Matthias Aust <[EMAIL PROTECTED]> wrote: > > Is this something I should file an issue for? > > The Django debug HTML page is great for finding bugs in templates and > view functions. However, if you have an error in a view function with > a request object that contains a - say -

Re: Mapping models to CRUD urls?

2007-07-19 Thread Russell Keith-Magee
On 7/20/07, John M <[EMAIL PROTECTED]> wrote: > > Does caching matter that much in my example, since it's dynamic data > anyway? Don't let the fact that the data is dynamic distract you. All database backed websites are dynamic at some level. However, when you have thousands of requests for a res

Re: schema evolution

2007-07-20 Thread Russell Keith-Magee
On 7/20/07, Derek Anderson <[EMAIL PROTECTED]> wrote: > > but i use django > quite a bit now and am surprised some sort of this hasn't been merged > yet, so i figured i'd bring it up to date and re-release. By casting a quick eye over the patch, I caught at least two reasons that this hasn't been

Re: newforms

2007-07-20 Thread Russell Keith-Magee
On 7/20/07, Alper KANAT <[EMAIL PROTECTED]> wrote: > > What is newforms any way ? A new looking (style) of a form or something > ? If so, can somebody post a screenshot please ? Newforms is the replacement for the old manipulator framework. The old forms framework was based around the concept of

Re: newforms

2007-07-20 Thread Russell Keith-Magee
On 7/20/07, Chris Hoeppner <[EMAIL PROTECTED]> wrote: > > It might be worth finally writing the "form processing" chapter in the > Django Book, Russ :) The Django Book isn't my bailiwick - that's Adrian and Jacob's project. While I'm sure it will be a wonderful tutorial and reference when it is p

Re: foreign key on database not created with models referencing from other application

2007-07-20 Thread Russell Keith-Magee
On 7/21/07, james_027 <[EMAIL PROTECTED]> wrote: > > When the relationship is within the same namespace (am I using the > right term, pls correct me) the manage.py syncdb create the tables > without a problem if all the tables are create on the same time, but > if the tables weren't created the sa

Re: Mapping models to CRUD urls?

2007-07-20 Thread Russell Keith-Magee
On 7/21/07, John Matthew <[EMAIL PROTECTED]> wrote: > Given that, I assume that the cache will look at the http://.../model3/add/ > and cache that? meaning it doesn't add the parameters to the cache lookup? Ultimately it will depend on your caching mechanism, but in theory, any page that has be

Re: Accessing the backend's string-quoting functionality?

2007-07-20 Thread Russell Keith-Magee
On 7/21/07, Tim Chase <[EMAIL PROTECTED]> wrote: > > >> Is there a way to access the back-end's string-quoting mechanism? > > > > from django.db import backend > > foo_quoted = backend.quote_name('foo') > > This seems to be (browsing the code) the table/field-name > escaping mechanism, not the "es

Re: I have a class in my Models that contains one field which happens to be an integer type

2007-07-20 Thread Russell Keith-Magee
On 7/21/07, jeffself <[EMAIL PROTECTED]> wrote: > > How do I get the season to > display in the select box of my season field on the Game form? > Normally this would be fixed by using def __unicode__(self) but since > its not a CharField, I can't use that. I tried def __integer__(self) > but that

Re: foreign key on database not created with models referencing from other application

2007-07-20 Thread Russell Keith-Magee
On 7/21/07, james_027 <[EMAIL PROTECTED]> wrote: > > I am doing this in winxp , mysql 5 , python 2.5 , latest mysql driver > for python. Hope I've provided enough info. Not even close. Perhaps I'm not being clear. I have tried your example. It works for me. The fact that many thousands of other

Re: Newforms - attributes for splitdatetimewidget

2007-07-20 Thread Russell Keith-Magee
On 7/21/07, jeffhg58 <[EMAIL PROTECTED]> wrote: > > I am just digging into the newforms functionality. I am looking at the > splitdatetimewidget. > I am trying to having a different attributes for the first field and > the second field, and would like to know how to go about doing it. I would sug

Re: foreign key on database not created with models referencing from other application

2007-07-20 Thread Russell Keith-Magee
On 7/21/07, james_027 <[EMAIL PROTECTED]> wrote: > > I didn't say that the relation aren't working, I just wondering why > foreign key wasn't created in my case. I am using both SQL Manager > 2005 lite and MySQL Administrator just to take a look at the table > created. When I run your example, th

Re: superuser login forgotten

2007-07-21 Thread Russell Keith-Magee
On 7/21/07, schmitzkatze <[EMAIL PROTECTED]> wrote: > > I have forgotten my superuser login, what to do? > Even with another project I have to have it. > I can not login ad the admins page Use the Python prompt to modify the admin User. Run ./manage.py shell, then run the following commands. >>

Re: foreign key on database not created with models referencing from other application

2007-07-21 Thread Russell Keith-Magee
On 7/21/07, james_027 <[EMAIL PROTECTED]> wrote: > > I dont know what you mean by what_I_have_done? Help me to replicate exactly the steps that you have taken to make this problem occur. I have your model file. If _I_ use that model file, and it works fine for me. Obviously you have done somethin

Re: How to implement Django-like models?

2007-07-21 Thread Russell Keith-Magee
On 7/21/07, Stefan Matthias Aust <[EMAIL PROTECTED]> wrote: > > Therefore, > can anybody point me to some tutorial/documentation on how to do this > kind of meta programming in Python? Google is your friend. Guido wrote a decent introduction to the topic when types and classes were unified in Pyt

Re: foreign key on database not created with models referencing from other application

2007-07-21 Thread Russell Keith-Magee
On 7/22/07, james_027 <[EMAIL PROTECTED]> wrote: > > 5. then i run python manage.py syncdb > > the result is ... in my cellusage table there is no foreign key > created. but in the profile table there is a foreign created. > mysql> describe mytest_profile; ++-+--+-

Re: Script works in django and in manage.py but doesn't anywhere else

2007-07-21 Thread Russell Keith-Magee
On 7/22/07, Kai Kuehne <[EMAIL PROTECTED]> wrote: > > ImportError: No module named kaikuehne ... > When I run the code above in ``python manage.py shell`` it works perfectly so > I guess I'm just missing to set something what mange.py does: You need to set up your PYTHONPATH. Your project should

Re: Storing binary data into a table

2007-07-21 Thread Russell Keith-Magee
On 7/21/07, Stefan Matthias Aust <[EMAIL PROTECTED]> wrote: > > I want to store binary data as part of my model. I didn't find > something like a BlobField or BinaryField. What's the best approach to > achieve this? Seems that Python has no byte array type (yet), so the > Python way is probably to

Re: Null=True not respected by admin?

2007-07-22 Thread Russell Keith-Magee
On 7/22/07, sagi s <[EMAIL PROTECTED]> wrote: > > I created a table where some of the fields have null=True since it's > okay for them to be empty. > Looking at the schema in mysql this option was correctly translated > into the DB's schema, however when I try to add an entry via the admin > inter

Re: foreign key on database not created with models referencing from other application

2007-07-22 Thread Russell Keith-Magee
On 7/22/07, james_027 <[EMAIL PROTECTED]> wrote: > > the profile table's dell has constraint clause in it, while the > cellusage table has no constraint clause only key clause is only tells > that it is index. That appears to be the effect of ticket #2720 [1] that I mentioned earlier. The foreign

Re: Django - technology or magic?

2007-07-23 Thread Russell Keith-Magee
On 7/24/07, to_see <[EMAIL PROTECTED]> wrote: > Am I having a fairly normal introduction to a web framework? I cannot > see this as technology. All I see is magic. You should note that when Clarke made that comment, he was referring to the fact that if you don't understand the fundamentals of

Re: Multiple for loops, alternating between key and value?

2007-07-23 Thread Russell Keith-Magee
On 7/24/07, drkfce <[EMAIL PROTECTED]> wrote: > > Is there any possible way to have the first loop just display the key? Sure - you just need to walk through the data correctly. Your context contains the `switch_info`, which is a list of dictionaries. When you print {% for item in switch_info %

Re: Which database, and why?

2007-07-24 Thread Russell Keith-Magee
On 7/24/07, Andreas Ahlenstorf <[EMAIL PROTECTED]> wrote: > > Am 24.07.2007 um 04:43 schrieb Kenneth Gonsalves: > > > The current versions of those manuals do not seem to > > have those sections any more - so how can you trust a group that is > > rewriting it's history? > > You're always right and

Re: django.contrib.dataplot 0.3

2007-07-24 Thread Russell Keith-Magee
On 7/24/07, Toby Dylan Hocking <[EMAIL PROTECTED]> wrote: > > If any of you are interested in creating data graphics for your web apps, > try checking out the new version of my plotting framework, > django.contrib.dataplot. Here is an example of what it can do: Hi Toby, Looks like a great app! P

Re: Template debugging

2007-07-24 Thread Russell Keith-Magee
On 7/23/07, Chris Hoeppner <[EMAIL PROTECTED]> wrote: > Hi there! > > I was wondering if this is even possible (perhaps, some middleware?). > I'd like to have a closer look into the context that is getting rendered > in each view, including the data I get from the RequestContext. You might want t

Re: transaction commit

2007-07-24 Thread Russell Keith-Magee
On 7/24/07, Michal Konvalinka <[EMAIL PROTECTED]> wrote: > It works but I would like to ask If I am violating some Django > principles or not. Your example is correct, and you aren't violating any 'Django principles'. Django provides decorators because it can be convenient to wrap a whole funct

Re: Insert vs. Update

2007-07-24 Thread Russell Keith-Magee
On 7/24/07, PyMan <[EMAIL PROTECTED]> wrote: > > Can anyone tell me why Django do this while using save()? : The behavior comes from the Object relational mapping (key word - Object). Since save() is an operation on an Object relational mapper, it was established as an unambiguous mechanism to ge

Re: Form_for multiple models

2007-07-24 Thread Russell Keith-Magee
On 7/24/07, Chris Hoeppner <[EMAIL PROTECTED]> wrote: > Well... Actually, what I need is the same as form_for_instance, but for > more than a single model. Why not use multiple forms? There is nothing stopping you from putting multiple forms into a context, and populating multiple forms from a s

Re: transaction commit

2007-07-24 Thread Russell Keith-Magee
On 7/24/07, Michal Konvalinka <[EMAIL PROTECTED]> wrote: > > The problem is that there's no example how to use transactions without > decorators in the documentation, there's no example here in this > mailing list... I found the example in > django.db.transaction.py This is a problem that should

Re: transaction commit

2007-07-24 Thread Russell Keith-Magee
On 7/25/07, Peter Melvyn <[EMAIL PROTECTED]> wrote: > > > Your example is correct, and you aren't violating any 'Django principles'. > > Really? Should not be there something like this? Yes - this is a more complete example, and catching the rollback case is a good idea. The point I was trying to

Re: Customizing the settings configuration

2007-07-24 Thread Russell Keith-Magee
On 7/24/07, gorans <[EMAIL PROTECTED]> wrote: > > I though that there could be a way to trick Django into reading > special development settings for me, something like having a settings > 'package' import separate settings files: No need for any special handling - just use the --settings option t

Re: Auth framework - initials et of users/groups ?

2007-07-24 Thread Russell Keith-Magee
On 7/25/07, Peter Melvyn <[EMAIL PROTECTED]> wrote: > > On 7/25/07, Przemyslaw Wegrzyn <[EMAIL PROTECTED]> wrote: > > > > Thanks! I overlooked the 'fixtures' feature, I'll give it a try. > > I don't know wjhat kind of SQL server do you use, but If I'm not > mistaken, fixtures are not fully suppor

Re: Auth framework - initials et of users/groups ?

2007-07-24 Thread Russell Keith-Magee
On 7/25/07, Przemyslaw Wegrzyn <[EMAIL PROTECTED]> wrote: > > I'd like to use fixtures to initialize all my authentication data, so > I'd like to disable this question as well: ... > Is there any option to do it ? Well, I have not enough time to check the > sources myself :-/ Yes. You can use the

Re: Please Help with Namespace Issue.

2007-07-24 Thread Russell Keith-Magee
On 7/25/07, Sebastian Macias <[EMAIL PROTECTED]> wrote: > > When I run the app with the development server everything is fine, I > can go to http://localhost:8000/accounts/login/ and I get no errors > but when I test it using apache/mod_python I get the following error. > > ImportError at / > No m

Re: django.contrib.dataplot 0.3

2007-07-24 Thread Russell Keith-Magee
On 7/25/07, Toby Dylan Hocking <[EMAIL PROTECTED]> wrote: > However, I thought that the contrib/ subdirectory of the django > distribution would be the most natural place to install it, since it is an > add-on app that is meant to be used by other apps. Can you suggest another > location that wou

Re: Shift a QuerySet?

2007-07-24 Thread Russell Keith-Magee
On 7/25/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Hello, > > This may sound like a strange inquiry, but is there any way using > Django's ORM to "shift" a queryset? To explain my question, I'll > provide an example. ... > Now, I want to "shift" my queryset to be a queryset of JUST the

Re: Shift a QuerySet?

2007-07-24 Thread Russell Keith-Magee
On 7/25/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > An analogous operation would be: > playlist_aggregates = PlaylistAggregation.objects.order_by('-count') > playlists = [p.playlist for p in playlist_aggregates] The query itself looks like it's just a query over Playlist objects where al

Re: unbound method get_profile()

2007-07-24 Thread Russell Keith-Magee
On 7/25/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > def profile(request): > template_name = 'user_profile.html' > obj_list = User.get_profile() ... > unbound method get_profile() must be called with User instance as > first argument (got nothing instead) Look closer at th

Re: Shift a QuerySet?

2007-07-24 Thread Russell Keith-Magee
On 7/25/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Oops, that should read "Cannot resolve keyword 'playlist_aggreation' > into field", even though I am messing with song aggregations and > playlist aggregations :) Apologies - I got tied up in underscores :-) Try: Playlist.objects.filt

Re: How to prevent updating auto_now date field.

2007-07-26 Thread Russell Keith-Magee
On 7/27/07, Mambaragi <[EMAIL PROTECTED]> wrote: > > I have to prevent updating auto_nowed field for just one action. > > Is it possible? It is not possible in 0.96, but it is possible on trunk. A recently added feature allows you to call: instance.save(raw=True) which will prevent any field pr

Re: newforms: How to make a Checkboxed user select list...

2007-07-26 Thread Russell Keith-Magee
On 7/26/07, onno <[EMAIL PROTECTED]> wrote: > > On Jun 26, 9:57 am, Jens Diemer <[EMAIL PROTECTED]> wrote: > > Jens Diemer schrieb: > > > > > I would like to make a newforms user select list, from every existing > > > django > > > users, looks like this: > > ... > This might be added to the docs.

Re: Confusion over CRUD generic views and newforms

2007-07-26 Thread Russell Keith-Magee
On 7/27/07, Matt <[EMAIL PROTECTED]> wrote: > > 3693 is marked as 'accepted' - does that mean that its changes are in > trunk? No - it means that this is a change that we want to make, but haven't yet. Usually it means that there isn't a patch available, or that the patch isn't correct. In this c

Re: db mock for unit testing

2007-07-27 Thread Russell Keith-Magee
On 7/27/07, Andrey Khavryuchenko <[EMAIL PROTECTED]> wrote: > > Then I've paused and wrote DbMock class for django that uses some black > magic to steal django db connection and substitute it with temporary sqlite > in-memory db. How is this different to the default Django behavior if you specify

Re: File Upload field problem in auto-generated django forms

2007-07-27 Thread Russell Keith-Magee
On 7/28/07, Robert <[EMAIL PROTECTED]> wrote: > > Hi all- > I'm very new to django, so pardon my faulty nomenclature! > I'm trying to create a view that creates a guides the user through > inserting some information into a table in my database. One of the > columns in my database model is of the t

Re: db mock for unit testing

2007-07-29 Thread Russell Keith-Magee
On 7/29/07, Andrey Khavryuchenko <[EMAIL PROTECTED]> wrote: > > I'm not using django's testing framework for several reasons: > - I'm using django from 0.91 days and wasn't following django-users all >this way > - I use nose and twill for testing and they have no ready-to-use plugs >into

Re: db mock for unit testing

2007-07-29 Thread Russell Keith-Magee
On 7/29/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > So what advantages are there to the mocking approach over just replacing > the setting? Genuine mocking (as opposed to this proposal) has one really big advantage - it's lightning fast. All the db-calls get faked using a cache-like set

Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField

2007-07-29 Thread Russell Keith-Magee
On 7/30/07, Greg <[EMAIL PROTECTED]> wrote: > > Ok, > I just added a Field in my Orders class. It looks like this: ... > Do I need to put something into my timestamp field when I create the > Orders instance? For example: Yes; your field is a required field, so you will need to provide timestam

Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField

2007-07-29 Thread Russell Keith-Magee
On 7/30/07, Greg <[EMAIL PROTECTED]> wrote: > > Russ, > I tried including the code that you recommended. However, I'm still > getting the same error: > > AttributeError at /admin/rugs/orders/1/ > 'unicode' object has no attribute 'strftime' Just to clarify - If you create, modify and save an obj

Re: How do I echo template variables?

2007-07-30 Thread Russell Keith-Magee
On 7/30/07, Chris Hoeppner <[EMAIL PROTECTED]> wrote: > > I didn't know of that function. Nice to know. But, is there a var where > to access *all* the vars available in the template and it's contents? > I've been needing that one for debugging for ever! Try {% debug %} http://www.djangoproject.

Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField

2007-07-30 Thread Russell Keith-Magee
On 7/30/07, Greg <[EMAIL PROTECTED]> wrote: > > Russ, > Here is what I get with I use 'python manage.py shell' ... > >>> b.timestamp > u'2007-07-29' Ok - this is interesting. This should be a datetime object. This suggests a problem with the database backend. I've just tried what you've sent me

Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField

2007-07-30 Thread Russell Keith-Magee
On 7/30/07, Greg <[EMAIL PROTECTED]> wrote: > > Russell, > I'm using sqlite > > DATABASE_ENGINE = 'sqlite3' Hrm. I don't get this problem with sqlite, either; b.timestamp returns a datetime object for me. It is possible this might be a problem specific to sqlite on Windows - I don't currently ha

Re: How do I echo template variables?

2007-07-30 Thread Russell Keith-Magee
On 7/30/07, Peter Melvyn <[EMAIL PROTECTED]> wrote: > > On 7/30/07, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: > > > Try {% debug %} > > If you mentioned this feature: is there an easy way to reformat {% > debug %} output the same/similiar way an exce

Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField

2007-07-30 Thread Russell Keith-Magee
On 7/31/07, Greg <[EMAIL PROTECTED]> wrote: > > Russ, > I'm using SQLite version - 0.99svn. And here is my django info Ermm.. are you sure? Django requires v3 of SQLite, and pysqlite v2 bindings... I can't even think where you would get a subversion release of SQLite 0.99. If you really _do_ hav

Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField

2007-07-30 Thread Russell Keith-Magee
On 7/31/07, Greg <[EMAIL PROTECTED]> wrote: > > I guess I have v3. In my settings.py file i have: > > DATABASE_ENGINE = 'sqlite3' That's just what your settings file says. This setting could read sqlite3 even if you don't have sqlite installed. Yours Russ Magee %-) --~--~-~--~~

Re: Is this a test? Is this only a test?

2007-07-30 Thread Russell Keith-Magee
On 7/31/07, Todd O'Bryan <[EMAIL PROTECTED]> wrote: > > Is there an easy way to tell if something is running as a test so that I > can mock that behavior? I'm thinking of something like ... > Or maybe this isn't the right approach at all and I'm missing something > that would make this easier. Ad

Re: Postgresql and transactions, revisited

2007-07-31 Thread Russell Keith-Magee
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 was made even worse by the fact that I used > the db in tearDown, which

Re: Error: 'unicode' object has no attribute 'strftime'. Just added models.DateField

2007-07-31 Thread Russell Keith-Magee
On 7/31/07, Greg <[EMAIL PROTECTED]> wrote: > > pysqlite2.3.3 That's just the binding. What version of SQLite itself? Russ %-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this g

Re: schema evolution

2007-07-31 Thread Russell Keith-Magee
On 7/31/07, Derek Anderson <[EMAIL PROTECTED]> wrote: > testing and documentation (plus two minor bug fixes) are checked into > the schema-evolution branch: > > tests/modeltests/schema_evolution/models.py > docs/schema-evolution.txt Documentation should be about how to use a featu

Re: Unique check errors when using postgres and explicit ids

2007-07-31 Thread Russell Keith-Magee
On 8/1/07, Kai Kuehne <[EMAIL PROTECTED]> wrote: > I'm using django SVN and the windows version of psycopg2. > Postgres is running on linux (version 8.1.8). It doesn't work on > webfaction either, so this information shouldn't be that helpful. Without seeing the exact error, I can think of two p

Re: Unique check errors when using postgres and explicit ids

2007-07-31 Thread Russell Keith-Magee
On 8/1/07, Kai Kuehne <[EMAIL PROTECTED]> wrote: > > Is this the 'normal' behavior of postgres? I've never used it > before but this seems very odd to me. I'm deleting the whole > database and creating it new every time. After deleting I'm doing this: > > >>> manage.py syncdb > >>> db-dump.py load

Re: loading fixtures: no error, no data

2007-08-01 Thread Russell Keith-Magee
On 8/1/07, omat <[EMAIL PROTECTED]> wrote: > > Installed 34 object(s) from 1 fixture(s) If this message is getting printed, then the fixture is getting loaded _somewhere_, save() has been called on 34 object instances, and the transaction has been successfully committed. The only way I can think

Re: loading fixtures: no error, no data

2007-08-01 Thread Russell Keith-Magee
On 8/1/07, omat <[EMAIL PROTECTED]> wrote: > > My bad. In my previous post, I think it would be a good idea to crop > the models a bit for simplicity. Please use this one: > http://dpaste.com/hold/15751/ Works fine for me, as long as you have two users defined (pk=1 and pk=2). The fixture you pro

Re: loading fixtures: no error, no data

2007-08-01 Thread Russell Keith-Magee
On 8/1/07, David Reynolds <[EMAIL PROTECTED]> wrote: > > How about .save() is being overridden and Super(Model, self).save() > isn't being called? FYI - as of [5658], fixtures call save() directly on the base Model class, ignoring any user-defined save method. Yours, Russ Magee %-) --~--~--

Re: loading fixtures: no error, no data

2007-08-01 Thread Russell Keith-Magee
On 8/1/07, omat <[EMAIL PROTECTED]> wrote: > > Thanks for the reply Russ... > > The models are here: > http://dpaste.com/hold/15746/ > > The dump in json format is here: > http://dpaste.com/hold/15747/ > Are you sure the fixture comes from these models? I get an immediate failure because industry

Re: loading fixtures: no error, no data

2007-08-01 Thread Russell Keith-Magee
On 8/1/07, omat <[EMAIL PROTECTED]> wrote: > > Shouldn't Django be reporting that failure? Success messages are > confusing. I _did_ get an error message, warning me about an invalid primary key: psycopg.DatabaseError: {: 'ERROR: insert or update on table "mytest_documentissue" violates foreign

Re: Compare column entries in database query

2007-08-02 Thread Russell Keith-Magee
On 8/2/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > I want to find all entries in a database where two specific fields are > equal: > > mytable.objects.filter(column_a='column_b') At present, the answer is unfortunately 'you can't do this' (unless you use a hack like the one you mentioned

Re: Using limit_choices_to on a ManyToMany Field

2007-08-02 Thread Russell Keith-Magee
On 8/3/07, Greg <[EMAIL PROTECTED]> wrote: > > Come onI know that somebody can figure this out Greg - seriously, it's been 6 hours since your original message. Give people a chance to _read_ your message before you complain about the fact that nobody has answered. Yours, Russ Magee %-) --~-

Re: DateField() , AttributeError: 'str' object has no attribute 'strftime'

2007-08-05 Thread Russell Keith-Magee
On 8/4/07, Frank Singleton <[EMAIL PROTECTED]> wrote: > > AttributeError: 'str' object has no attribute 'strftime' Hi Frank, You're the second person in recent history to report this problem - however, I've been unable to replicate it. The last user was on Windows, and I had mentally put it down

Replying to spam messages

2007-08-06 Thread Russell Keith-Magee
On 8/6/07, Chris Hoeppner <[EMAIL PROTECTED]> wrote: > > I *hate* spammers. And I like ponies. You aren't alone in hating spam, but unfortunately, its the price you pay for having an open mailing list. Replying to these messages doesn't help to stop the problem - it makes it WORSE it two very sp

Re: XML serializer

2007-08-06 Thread Russell Keith-Magee
On 8/6/07, birkin <[EMAIL PROTECTED]> wrote: > > > The Django serializers accept any iterable, not just query sets. You > > can pass in any list or set of Django object instances, and they > > willserializefine. > > > I thought the same thing from this line in the serialization > documentation: >

Re: full-text indexing

2007-08-06 Thread Russell Keith-Magee
On 8/7/07, cesco <[EMAIL PROTECTED]> wrote: > > Hi, > > is there any rough estimate on when the full-text indexing branch will > be integrated into trunk? The short answer is that there isn't really a rough estimate for anything on Django - and especially not on branch merges. It will be done whe

Re: DateField() , AttributeError: 'str' object has no attribute 'strftime'

2007-08-07 Thread Russell Keith-Magee
On 8/6/07, justquick <[EMAIL PROTECTED]> wrote: > > AttributeError: 'str' object has no attribute '_meta' This problem is unrelated to Image or FileFields - the problem is your ForeignKey. String-form foreign key references only work with models defined in the same application. If you want to re

Re: DateField() , AttributeError: 'str' object has no attribute 'strftime'

2007-08-08 Thread Russell Keith-Magee
On 8/8/07, Collin Grady <[EMAIL PROTECTED]> wrote: > > This is not a backend issue at all - the problem is you're assigning a > string to the DateField, which is not what it needs. You are completely correct. I saw the error message, saw it was similar to a problem I was triaging recently, an

Re: Single-object serializers?

2007-08-09 Thread Russell Keith-Magee
On 8/9/07, Shawn Allen <[EMAIL PROTECTED]> wrote: > > Hey everyone, > > I'm about to tackle an API that supports multiple response formats > using serializers. I realize that the API (as simple as it is) is > subject to change, but it seems like a totally sensible pattern for > what I'd like to do

Re: Testing/Fixtures/Production/TestRunner

2007-08-09 Thread Russell Keith-Magee
On 8/9/07, Chris Green <[EMAIL PROTECTED]> wrote: > > 1) initial_data has bitten me not realizing it was synced in > production each time. I think that initial_data should only get > inserted if you have an empty new database. Perhaps things synced > each time should be called "constant_data".

Re: SQLite + float vs MySQL + Decimal

2007-08-09 Thread Russell Keith-Magee
On 8/9/07, Vincent Foley <[EMAIL PROTECTED]> wrote: > > Hello, > > I found a curious problem in my application when I put it into > production this week: when a models.FloatField is "extracted" from the > database, its type changes depending on the database. With SQLite in > development, I got ba

Re: Developing and testing a model mixin

2007-08-11 Thread Russell Keith-Magee
On 8/12/07, Ned <[EMAIL PROTECTED]> wrote: > > Firstly, is a mixin a good way to do this? This is one approach - another would be an abstract base class. We (by which, I mean Malcolm) is currently working on improving the inheritance capabilities in Django - providing a way to cleanly implement a

Re: basic testing procedure?

2007-08-11 Thread Russell Keith-Magee
On 8/10/07, patrickk <[EMAIL PROTECTED]> wrote: > > here are a couple of questions: > 1. where to define the testing? in models.py or in tests.py? I´d like > to seperate the testing from models.py, so how can I write doctests > in a seperate file (the example in the django documentation only > exp

Re: Testing/Fixtures/Production/TestRunner

2007-08-11 Thread Russell Keith-Magee
On 8/11/07, Chris Green <[EMAIL PROTECTED]> wrote: > > On Aug 9, 7:55 am, "Russell Keith-Magee" <[EMAIL PROTECTED]> > wrote: > > On 8/9/07, Chris Green <[EMAIL PROTECTED]> wrote: > > > 2) Setting up users/groups/users manually in the runne

Re: basic testing procedure?

2007-08-13 Thread Russell Keith-Magee
On 8/13/07, patrickk <[EMAIL PROTECTED]> wrote: > > thanks russ. > > is it possible to make the testing-output more verbose? I tried "-v", > but that doesn´t work. It´d be nice to see what tests have been > running and what the output is (more than just "OK"). --verbosity=[0|1|2]. It's in the hel

Re: doctest and response.template and response.context problem

2007-08-13 Thread Russell Keith-Magee
On 8/13/07, eXt <[EMAIL PROTECTED]> wrote: > > So here is a template and a context. Why I can't access it in my > doctest via response.template and response.context? How are you running your doctest? In order to capture the template rendering details, Django needs to add some instrumentation to

Re: Adding permissions in a fixture

2007-08-13 Thread Russell Keith-Magee
On 8/14/07, Todd O'Bryan <[EMAIL PROTECTED]> wrote: > > I asked this before and no one answered, but after having to do this > manually in the shell for about the fifteenth time, I'm going to ask > again. Can't say I remember seeing this question the first time round. Apologies for missing it. >

Re: Multiple primary keys

2007-08-13 Thread Russell Keith-Magee
On 8/14/07, Lars Stavholm <[EMAIL PROTECTED]> wrote: > > Hi all, > > first of all: django rocks! I'm a database application developer Glad you like it! Welcome to the community. > I know that this has been discussed on this list, but what I would > like to know now is: is there any effort going

Re: DRY? I have a field lists to manage in 4 places

2007-08-13 Thread Russell Keith-Magee
On 8/14/07, sime <[EMAIL PROTECTED]> wrote: > > Warning, devils advocate post. It's meant to be constructive > criticism. > > I have my fields listed in HTML, in forms.py (newforms), in models.py, > and in my database (post-syncdb). Four places no less. What you have described is three different

Re: Multiple primary keys

2007-08-14 Thread Russell Keith-Magee
On 8/14/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > Periodically, I wonder if it's worth implementing this anyway, just for > fun, and then saying if you have multiple primary keys, you can't use > those models in the admin. No need to ban _all_ multiple primary key models from admin -

Re: Doctests and fixtures

2007-08-14 Thread Russell Keith-Magee
On 8/14/07, eXt <[EMAIL PROTECTED]> wrote: > > But how to load fixture for doctest? Do I have to load it from > doctest's code? There is also initial_data fixture but I don't want to > use it for this purpose. Yes, you need to call management.load_data manually. The code looks something like: fr

Re: Adding permissions in a fixture

2007-08-14 Thread Russell Keith-Magee
On 8/14/07, Todd O'Bryan <[EMAIL PROTECTED]> wrote: > > The only permanent solution I can think of would be to introduce some > > sort of query language into the fixtures, which is a road I'd rather > > not travel down. Any other suggestions are welcome. > > That's something I hadn't thought of,

Re: Logout with TestClient

2007-08-15 Thread Russell Keith-Magee
On 8/16/07, eXt <[EMAIL PROTECTED]> wrote: > > Hi! > >TestClient has a login function (which is very useful :)), but > doesn't have a logout one. After browsing throught the code I > discovered that I can log a user out with a very simple call: > c.cookies = SimpleCookie(). Is this a proper wa

Re: accessing id attribute of a ForeignKey without additional DB queries

2007-08-15 Thread Russell Keith-Magee
On 8/16/07, kahless <[EMAIL PROTECTED]> wrote: > I have a simple 'Post' model which has a 'author' ForeignKey linking > to a 'User' object - is there a way to access post.author.id without > django triggering a database query ? > - i tried to use the db column name - post.author_id .. and it > wo

Re: Wrong return value when sending mail with test framework

2007-08-16 Thread Russell Keith-Magee
On 8/16/07, Michael <[EMAIL PROTECTED]> wrote: > > Adding: > return len(messages) > to the TestSMTPConnection's send_messages method fixes the issue, but > maybe there's a reason I'm not aware of for not doing so in the test > framework? No particular reason. I dummied up the interface, b

Re: Logout with TestClient

2007-08-16 Thread Russell Keith-Magee
On 8/16/07, eXt <[EMAIL PROTECTED]> wrote: > > Ok, I've got a logout method that should (IMHO) be added to client.py. > I can generate patch from it. But what form should have a test and a > documentation? * Test: add a test case to /tests/modeltests/test_client that validates that logout works.

Re: Clash of related_names among two tables

2007-08-16 Thread Russell Keith-Magee
On 8/16/07, Peter Melvyn <[EMAIL PROTECTED]> wrote: > > Hi all, > > please, could anybody confirm my experience with related_names. I > tried to find-out some information about it and found invalid model > example. > > If my understanding is correct, then it is not possible to have the > same rela

Re: management.flush, load_data etc. what to use instead?

2007-08-16 Thread Russell Keith-Magee
On 8/17/07, eXt <[EMAIL PROTECTED]> wrote: > >>> from django.core import management > >>> management.flush(verbosity=0, interactive=False) > >>> management.load_data(['test_data'], verbosity=0) Hi Jakub, Sorry for the inconvenience here - especially after I just gave you that piece of advice a

Re: updating models

2007-08-16 Thread Russell Keith-Magee
On 8/17/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > That mentions syncdb will never alter tables, because of ambiguity. > > So how do I do it? The problem you are referring to is schema evolution - evolving the database schema for a Django model over time. Search the archives and you wil

Re: Logout with TestClient

2007-08-17 Thread Russell Keith-Magee
On 8/17/07, eXt <[EMAIL PROTECTED]> wrote: > > Thanks for valuable hints. I submitted a ticket with a patch: > http://code.djangoproject.com/ticket/5189. Fantastic! I've just committed this as [5916]. Thanks for your work on this. Yours, Russ Magee %-) --~--~-~--~~~

Re: adodbapi with mssql 2000

2007-08-17 Thread Russell Keith-Magee
On 8/17/07, Michal PL <[EMAIL PROTECTED]> wrote: > > I'm new here so let me say hello and sorry for my English to > everybody. > > I got a problem with MS SQL 2000 and (probably) adodbapi library. When > django tries to get session information from django_session table it > asks for records with t

Re: Django project bad link

2007-08-17 Thread Russell Keith-Magee
On 8/18/07, Ramdas S <[EMAIL PROTECTED]> wrote: > http://www.djangoproject.com/documentation/models/ > > link is having problem This is known problem, and has been reported multiple times. http://code.djangoproject.com/ticket/4853 Yours, Russ Magee %-) --~--~-~--~~~

Re: clean method for auto generated forms (newforms)

2007-08-19 Thread Russell Keith-Magee
On 8/20/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > forms.models.form_for_instance(original_laborder, form=LabOrderForm) > > Is there a more django-esque to get a custom clean method for an auto- > generated form like this or is this the way it's supposed to go? There's actually two ways

Re: application and project coupling in unittests

2007-08-19 Thread Russell Keith-Magee
On 8/20/07, Viraj Alankar <[EMAIL PROTECTED]> wrote: > My question is why does my test in polls need to know anything about > the root url configuration of the project? This seems to couple my > poll-specific unittest to the project and it would be cleaner to not > need to specify the '/polls/' u

<    5   6   7   8   9   10   11   12   13   14   >