spew reporting on each installed index?
--
Phlip
http://zeekland.zeroplayer.com/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@goog
t...
But note the fixture system (if that's what's doing it) makes
verbosity=1 useless for anything else. Long term, shouldn't The
Committee consider bumping them to 2?
> > --
> > Phlip
> > http://zeekland.zeroplayer.com/
--~--~-~--~~
Djangoists:
Given a bunch of unittests, how to convert them to some kind of
literate or doc-stringed report?
The goal is to show off all our tests!
--
Phlip
http://c2.com/cgi/wiki?ZeekLand
--~--~-~--~~~---~--~~
You received this message because you are
-who), so I'm open to any suggestions how to profile the
system. The code is INSERTing once per test case, not transacting.
If the basic Django apps were extruded by 1.0.x, do they need an
upgrade?
--
Phlip
http://c2.com/cgi/wiki?ZeekLand
--~--~-~--~~~---~--~-
the block you write testage, like a test case.
There's a ruby-python hybrid of Cuke available, but I would rather not inflict
too much Ruby on my current shop. So how easy would something like this be to
clone?
And has anyone already started, or would like to collaborate on it?
--
e session object and call .save() on it, I
can't because it's not a dict, I'm not logged in yet, etc.) I tried
all that stuff and couldn't affect the bug.
Any tips?
--
Phlip
--
You received this message because you are subscribed to the Google Groups
"Django users"
res=[] should start in the current app.
Django intends to be testable and modular, but your tests should not
all break just because you suddenly plugged in a new module that came
with a fixture that preempted your fixture.
> --
> Phlip
> http://c2.com/cgi/wiki?ZeekLand
--
You receiv
like
you said, the fix is discipline to name all test fixtures "test_foo"
or something, and to remember to stay out of each others' namespace...
--
Phlip
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this gro
> Yours,
> Russ Magee %-)
Yours wouldn't happen to know an answer for this, right?
http://groups.google.com/group/django-users/browse_thread/thread/a91f161f386f10da/2eaccb410c4c0692
I literally don't know how to develop without TDD, and the inability
to call any but the most trivial GET actions
Karen Tracey wrote:
> http://code.djangoproject.com/ticket/10899
Thanks - I missed that one. Yes it's ugly, yes you can hide it in setUp
(), and yes it bypasses the problems in the earlier works-around I
looked at.
--
Phlip
http://code.djangoproject.com/ticket/10899
--
You recei
Plutocrat.objects.all(): p.delete()
Is there a way to do that in one method call? and could such a method
call only send one SQL command?
--
Phlip
http://c2.com/cgi/wiki?MoreliaViridis
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
Doug Blank wrote:
> > Plutocrat.objects.all().delete()
>
> I found that quite slow. If you want to stay DB agnostic, I came up with this:
>
> from django.db import connection, transaction
> models = [Person, User, ...]
> cursor = connection.cursor()
> flush_tables = []
> for model i
g how to add the same data thru the Admin. But this would
seem to be a systemic problem with fixtures, so I was curious if they
had a systemic solution.
--
Phlip
http://c2.com/cgi/wiki?MoreliaViridis
--
You received this message because you are subscribed to the Google Groups
"Django us
can wait while programmers fix their (hardcoded) PKs
and try again.
That argument would also work at test time, because the unit tests are
expected to always get all PKs right, so the --gentle would be always
turned on, and would be a kind of assertion.
--
Phlip
http://zeekland.zerop
On Aug 14 2008, 5:39 am, "Hajo Smulders"
wrote:
> I need to set the HTTP_REFERER in the request.META data of a test client so
> that i can unit test a view.
> How do I do this? ie: How do i fake an HTTP header on a test client?
Bump? I just hit this problem, and the above question is the only
tr
Djangoids:
Given a large application with many apps (could have been called
Packages), how to rip out a list of all of them?
My initial guess, in the subject line, naturally did not work.
--
Phlip
http://c2.com/cgi/wiki?MoreliaViridis
--
You received this message because you are
> > Given a large application with many apps (could have been called
> > Packages), how to rip out a list of all of them?
>
> Aren't they listed in settings.py?
Hmm. I could have just done python shell -> INSTALLED_APPS
instead, I used find .. -name tests.py, and then some cuts and greps.
Silly m
On Dec 9, 3:10 pm, Russell Keith-Magee wrote:
> Ok; using some non-pk value for PK references is certainly one way to
> handle this. There is an issue around how to resolve a hash into an
> actual pk value, but that shouldn't be impossible.
In Rails, a YAML (JSON) fixture like this...
norber
gs.py:
TEST_RUNNER='doj.test.xmlrunner.run_tests'
However, the above module has no run_tests() method.
Is there some way to adapt it? Or is there some other way to get
structured output for formatting?
(I'm charged with building a test server, if anyone hasn't noticed
yet
On Dec 9, 4:52 pm, Russell Keith-Magee wrote:
> If you want to use an XML test runner instead of the default
> Text-based runner, take a copy of django.test.simple.run_tests() and
> modify to suit your requirements.
>
> I will admit that this isn't a great solution
It is because it's easy after
On Dec 9, 4:25 pm, Russell Keith-Magee wrote:
> > In general, Django "encourages" screwing with the Admin, then
> > extruding sample records, while RoR "encourages" writing very terse,
> > very templated YAML files as test code source.
>
> What rubbish.
Just a netiquette note - I stopped reading
> python manage.py test --xml
just a note; django-test-extensions broke --verbosity. Google
Codesearch sez the fix is in there, but pip didn't have it. I'm now
patching this up internally.
other than that the package works great!
Oh, except the assertions need embellished diagnostics...
--
> > I just want to add 2 new fields to the model. If I upload the new
> > models.py would the app work as before?
>
> Yes, but you'll have to manually adjust your database to have the new
> fields.
What does manage.py syncdb do?
--
You received this message because you are subscribed to the Goog
it seems I guessed right!
But this sophistry won't help anyone when they have to run ALTER
TABLE... (-:
--
Phlip
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.c
> >>> c = Client()
> >>> c.get('/customers/details/', {'name': 'fred', 'age': 7},
>
> ... HTTP_X_REQUESTED_WITH='XMLHttpRequest')
Thanks!
Now how do I test an action that must use SSL? (I want a 304 bounce
message if the user tries to use plain text.)
I couldn't find a HTTPS or similar hea
diagnostic or '' ) )
diagnostic = diagnostic.strip()
self.assert_equal( reference, sample, diagnostic )
Can anyone improve it? Did I overlook any dict manipulations that
could simplify it? And if two hash values are themselves hashes, it
could recurse, right?
& H
> for key, value in reference.items():
> if value == sample.get(key, value or True):
if value == sample.get(key, not(value)):
D'oh! C-:
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, s
> Hi jararaca
> Can u brief me the solution.Even i am not able to access test
> database ,some how it fetch production database itself
Hear galloping, think horses not zebras.
are y'all running your test batch like this?
python manage.py test --settings=test_settings.py
does tes
old-fashioned way, after they are created?
--
Phlip
http://c2.com/cgi/wiki?ZeekLand
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this gro
emote_name's in with
the kwargs?
If not, what's some clean way to construct everything all at once?
--
Phlip
http://c2.com/cgi/wiki?ZeekLand
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send emai
> > But what about 'ForeignKey's? May we pass their 'remote_name's in with
> > the kwargs?
>
> Foreign Keys - yes. Reverse Foreign Keys - no.
Point: All kwargs takes is the fields on this object.
> In the case of a foreign key, just pass in the object instance that
> you want your object to be re
mewhat
fruity if it's off by default!
--
Phlip
http://zeekland.zeroplayer.com/Hat_Trick/2
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from
se.
So am I mishandling the exec...globals() part? Is there a better way
to register a handler?
Help me bring squirrel-like speed to test cases!
--
Phlip
http://c2.com/cgi/wiki?ZeekLand
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
T
Djangoists:
Given a form, I can expand a template with {{ form.my_field.label }}
which inserts the string of label into my HTML.
How do I call label_tag? It seems to decorate the label string with
and similar HTML-correctness.
{{ form.my_field.label_tag }} did not work.
--
Phlip
http://c2
On Jun 7, 4:48 am, tazimk wrote:
> Also how should I implement the same thing using jquery library ?
Isn't that how the online examples all work?
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us..
he other absorbs new form data, as usual.
However, when I print request.method, I get GET.
Is this a bug in Client? or in (ahem) my comprehension?
--
Phlip
http://c2.com/cgi/wiki?ZeekLand
--
You received this message because you are subscribed to the Google Groups
"Django users"
forgot to mention Django 1.1.2
On Jul 29, 5:18 pm, Phlip wrote:
> Django aficionados:
>
> Here's my test code:
>
> from django.test.client import Client
> self.client = Client()
> from django.core.files.base import ContentFile
>
> What's the value of `self.url`? One possibility is that it doesn't end
> with a slash
Ends with a slash. I'm now checking the response goodies, like
response.status, to see if any other redirections happen!
--
You received this message because you are subscribed to the Google Groups
"Django u
On Jul 30, 3:28 am, Phlip wrote:
> > What's the value of `self.url`? One possibility is that it doesn't end
> > with a slash
>
> Ends with a slash. I'm now checking the response goodies, like
> response.status, to see if any other redirections happen!
Yup
rlooked something obvious...
--
Phlip
http://bit.ly/ZeekLand
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django
rom a child record; it might follow that notation.
Could I trouble you for its home page? Googling for [django queryset
join] gives zillions of newbs trying simple queries...
--
Phlip
http://c2.com/cgi/wiki?ZeekLand
--
You received this message because you are subscribed to the Google Grou
errors to print a simple exception trace to STDOUT,
instead of going through all that baloney?
--
Phlip
http://c2.com/cgi/wiki?SamuraiPrinciple <-- re: django.db!
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this grou
whose first comment appears in the date range:
SELECT * FROM blog
INNER JOIN comment ON comment.blog_id = blog.id
WHERE MIN(comment.date) BETWEEN '2010-09-12' AND '2010-09-14'
GROUP BY(blog.id)
Can I get that without dropping to raw SQL?
--
Phlip
http://zeekland.zero
> Maybe this is what you want:
>
> http://docs.djangoproject.com/en/1.2/topics/db/aggregation/#filtering...
Outrageous, thanks. I seem to have reconstructed the rational
for .annotate(), which I didn't understand until now!
--
You received this message because you are subscribed to the Google Gr
Curiously, if I add another constraint to the dates, it must go into
the Min() itself:
Blog.objects.annotate(min_date=
Min('comment__date', comment__status='sane')).all()
Otherwise the date range check is disjoint from the sanity check
(important for modern commenters!), and lots of rec
A web platform which I will refer to as "Rails" lets you print out all
the equivalents of the matchers and modules in the tree of urls.py
files using "rake routes".
Does Django have such a command? Or how could one be written?
--
Phlip
http://bit.ly/ZeekLand
--
You r
> 2. Add 'django.contrib.admindocs' to your INSTALLED_APPS.
Tx! But I will rip the innards of that out, because I'm targeting the
test side (as usual!), and because we have no admin yet...
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post
be available on some
session or file-scope variable.)
How to write an url() call in urls.py that handles part of a path, and
then dispatches to the next part of the path, if any?
--
Phlip
http://bit.ly/ZeekLand
--
You received this message because you are subscribed to the Google Groups
it like you said. C-:
The point is a REST path that can go arbitrarily shallow or deep
without excessive code.
What I looked for was a lambda here (simplified):
url( 'nest', lambda *a,**k: doit(a, k) )
but that terminates the lookup on the last item (rest), instead of
calling the la
> REST, however, has a fairly rigid one-URL-one-action structure which is
> ideally suited to Django's URL dispatch. The only way to get what you
> want is to layer another dispatching service atop Django's. I don't
> think you can do it with urlconfs alone.
knp. The point of urlconf is to adapt a
> You can't do something like this?
> url('^((\w+)/(\d+)/)+$', 'myview', ...)
Ah, I started with ^(.*)$ , and put the split on the inside. I will go
with your + pattern, because it checks for trivial errors at the
correct level.
--
You received this message because you are subscribed to the Goo
> url('^((\w+)/(\d+)/)+$', 'myview', ...)
Actually, no, that's only giving the last two matches:
(u'areas/2/', u'areas', u'2')
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
> Well, like I said, I haven't tested that particular regex. But it
> should be possible to write a regex that does work.
it turns out your regex works fine:
print re.search(r'^((\w+)/(\d+)/)+$', 'fries/4/frobs/9/areas/
2/').group(1)
Django uses groups() instead of group(1), for whatever reason
I just tried it:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
# TODO restore'NAME': ':memory:',
'NAME': '/home/phlip/fun.db',
'USER': '',
On Oct 21, 10:54 pm, Russell Keith-Magee
wrote:
> On Fri, Oct 22, 2010 at 12:37 PM, Phlip wrote:
> > I just tried it:
>
> > DATABASES = {
> > 'default': {
> > 'ENGINE': 'django.db.backends.sqlite3',
> > # TODO restore
test case, shouldn't that work at the same speed as manual creation?
How on earth could it be slower??
--
Phlip
http://zeekland.zeroplayer.com/
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send ema
ile allows for short command lines:
fab run # build a sample database from your test fixtures & launch
a server
fab shell # use iPython for the best shell.
fab ci:'what I did' # run all the tests then integrate
Also, read the book "Release It!", if you think you
Google leads me to this:
from django.db import connection
print connection.queries
It can't see the queries the test runner used to set up the database.
So, how to log every SQL command to a log file? (Like RoR can?)
--
Phlip
--
You received this message because yo
When I switch to TransactionTestCase - meaning a test case that does
not use the transaction-rollback trick - the test time goes to 2.5s.
This sucks. The test cases WITH transaction-rollback around each test
case are SLOWER than test cases that just rebuild the DB by hand each
time.
--
You recei
=True, null=True)
manager = [my alias manager here]
class Person(models.Model, MyModel):
name = models.CharField(max_length=255)
class Place(models.Model, MyModel):
street = models.CharField(max_length=255)
And now the model can't see the fields 'alias' or 'ma
> > class MyModel(models.Model):
> > alias = models.ForeignKey('self', blank=True, null=True)
> > manager = [my alias manager here]
> > def getAlias:
> > [whatever I need]
>
> > class Person(MyModel):
> > name = models.CharField(max_length=255)
>
> > class Place(MyModel):
> You could turn on logging through your DB
Hey! Thinking outside the box is MY job!!
grumble grumble grumble thanks grumble...
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
Does anyone have a QuerySet for that?
( BTW please don't try to talk me out of it; I've been doing SQL since
1989 and am fully aware of all the alternatives there. C-; )
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, sen
On Oct 26, 2:42 am, Tom Evans wrote:
> I'm curious, why can't I talk you into
> Student.objects.all().order_by('-score')[0] ?
>
> It is clearly a superior query :/
> >> ( BTW please don't try to talk me out of it; I've been doing SQL since
> >> 1989 and am fully aware of all the alternatives the
> st=Student.objects.filter(marks__in=Student.objects.all().aggregate(Max('ma
> rks')))
Aha - a marks__in may point to an aggregate subquery.
In conclusion, screw my SQL server's optimizer. It deserves to suffer!
(I can't seem to find a self-join to do what I need either...)
--
You received t
Tom Evans wrote:
> Phlip, I'm going to try and make a non-stupid comment now :)
http://xkcd.com/386/
> If you already know precisely the query you want to use, and you can't
> coerce django's ORM to produce it, can you simply use Manager.raw()[1]
> to generate t
> I hope the auditors are only forcing you to do this with records that
> aren't referenced as part of relationships, otherwise your database is
> going to get hammered updating all the foreign keys.
The design spec (which is ours, not any "CPA auditor's"), say to
duplicate the living crap out of
lf._db)
max_pids =
max_pids.values('name').annotate(Max('pid')).values('pid')
return qs.filter(pid__in=max_pids)
Now we can write any ORM statement we can think of, and (if those
lines continue to pass tests) then we only see the top horizon of the
data.
> Things.objects.filter(id__in=Things.objects.values('name').annotate(max_id=
> Max('id')).values_list('max_id',
> flat=True))
I didn't do values_list because I guessed that the inner query would
run and produce an array, then the outer query would run.
My way, with values() on both sides of the
On Oct 26, 10:24 am, Phlip wrote:
> > This sounds like what django-reversion[1] does :)
>
> > [1]:http://github.com/etianen/django-reversion#readme
>
> We have to cover the situation where some clients might still have
> rev(n-1), while some are up-to-date with rev(n
print self.kozmik_order # does not re-read the record
>From here, to be more useful, we need to think of details like records
without names (shameful!). Models with CamelCase already work -
kozmik_LineItem.
Any ideas how to improve this towards a true Squirrel?
--
Phlip
http://zeek
Tx! But!
> http://github.com/dnerdy/factory_boy
How does this do aggregation?
> Also, there is a more general python
> solution:http://farmdev.com/projects/fixture/ that supports django.
That one's a little _too_ general. But it supports aggregation
(association, etc.)..
--
You received this
I just need the usual features - to log the actual error, and stick it
in the programmer's face during a test run.
But when I Google for this subject, I get ten thousand newbies asking
why they got some other error, and self.handle_uncaught_exception
appears in their stack trace!
--
On Nov 8, 8:12 am, Phlip wrote:
> I just need the usual features - to log the actual error, and stick it
> in the programmer's face during a test run.
>
> But when I Google for this subject, I get ten thousand newbies asking
> why they got some other error, and self.handl
> Now how do I test an action that must use SSL? (I want a 304 bounce
> message if the user tries to use plain text.)
This looks promising!
class SSLAwareClient(Client):
def __init__(self, *args, **kwargs):
super(SSLAwareClient, self).__init__(*args, **kwargs)
self.ssl = False
redirects to the login page. Fair enough, but
tests have to run security-free (unless your administrators and
premium users like bugs). So what do I set into the "session", and how
do I add that to the .get(), to test a protected page?
Watch this space!
--
Phlip
http://twitter.
9632495b9ab78a54ff53a0d1145e2b9e8eb2af6')
self.client.login(username='admin', password='admin') # <--
the money line
self.get('/shop-admin/') # TODO get should demand a 200
Some of you might see fit to put that User into a reusable (but test-
only) JSON file... t
should be wide.
Django cultists should test their web pages with client.get(), then
drop their response.content strings into assert_xml(), to spot check
that their templates populated the correct data values. These "view
tests" are orders of magnitude faster and more convenient than,
elow my sig is a link to a book on view testing w/o screen scraping,
for anyone who wants to follow up on these theories. Lots of wicked
HTML (and XPath) in it, but no Django! C-:
--
Phlip
http://zeroplayer.com/tfui/TestFirstUserInterfaces.pdf
--
You received this message because you are subscr
t is a state of mind! Constantly test, with fab test,
constantly pull in case your colleagues are up to something, and
constantly run fab int:'what I did' each time the code gets any tiny
bit better.
--
Phlip
http://browsershots.org/http://zeekland.zeroplayer.com/Uncle_Wiggilys_Travels
llustrate the alarm colors...;
What does trac integration give bitten? In theory continuously passing
builds should be orthogonal to your requirements list...
--
Phlip
http://browsershots.org/http://zeekland.zeroplayer.com/Uncle_Wiggilys_Travels/1
--
You received this message because you are
s. The test runner should instead
push the JSON contents directly into the database as bulk import
statements.
The final benefit of ":memory:" is SQLite3 is very fast when it does
not save anything to disk, so it's the fastest backend possible for
test.
--
Phlip
http://penbird.t
40facb6998f778cb
The complete user's manual, with illustrations, is here:
http://c2.com/cgi/wiki?MoreliaViridis
Good hunting!
--
Phlip
http://penbird.tumblr.com/
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this g
temporary debug statements should instead be permanent
assert_equal() statements.
Tested code is, perforce, highly decoupled, so that tests can easily
reach any situation. So Test-Driven Development tends to obviate
questions about design - the best design is the one that works under
pressure from both te
On Feb 4, 10:29 am, David Parker wrote:
> Right on. I haven't gotten much into testing Django yet. My previous
> experience is with Rails (RSpec/Shoulda/Cucumber) and Java (JUnit). I
> plan on actually driving my app with TDD, but I was curious to know
> which "way" most developers in the Djan
://www.pylucid.de/root/index.html
The versions are Python 2.6.4 and Django 1.0.4. Further details
available on request - I wouldn't know where to start describing our
packages & setup.
--
Phlip
http://penbird.tumblr.com/
--
You received this message because you are subscribed to t
> It appears you have not run manage.py syncdb after adding
> 'django.contrib.redirects' to INSTALLED_APPS.
Even when testing into sqlite3 :memory:? I thought that obviated all
syncdb considerations...
--
You received this message because you are subscribed to the Google Groups
"Django users" g
> It appears you have not run manage.py syncdb after adding
> 'django.contrib.redirects' to INSTALLED_APPS.
>
> Karen
Ah, I don't know if I have that in there yet (yes, it's hard to
check), but I DO have this...
'django.contrib.redirects.middleware.RedirectFallbackMiddleware'
...in test_setti
gives no clue what record it sought. Hence my bio patch.)
So, is this already in there somewhere? Maybe in a version > 1.0.4? Or
would anyone like to add a cleaner version of it to the HEAD? Or does
it totally suck in some way I can't realize?
--
Phlip
http://penbird.tumblr.com/
--
> per my other appropriations
oppropriations
friggin' spell checker!
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-user
trying to add a --skip feature to django-test-extensions, and it
defers to ./django/test/simple.py's run_tests(), which has no argument
that knocks out applications.
So before I go hacking Django's core, is there a back-door (or a patch
or module out there) that I'm overlooking?
--
how about the RoR site serve authentications to the Django site over
Oauth?
unless if, as Tim's answer suggests, users don't want to log in twice?
and shouldn't the salt and hash pattern appear inside the auth contrib?
--
You received this message because you are subscribed to the Google Groups
I would start with unit tests that attack known passwords, entered
into the View, and compare them with their hashed results extracted
from the DB.
--
Phlip
http://penbird.tumblr.com/post/398311631/avatar-redux
--
You received this message because you are subscribed to the Google Groups
"D
it in Django instead, and
link it to the old system. (And use TDD to write it all.)
Eventually a new system will emerge, completely obscuring the old one.
And, yes, Django can do webservices and such, just like platforms with
much bigger advertising budgets.
--
Phlip
http://c2.com/cgi/wi
> Err... What's an "enterprise application", actually ???
An app written for a company large enough to run an in-house
programming team. Their job consists of figuring out how to connect
diverse systems that never expected to be connected!
--
You received this message because you are subscribed
e way that bypasses "eval()", and other tawdry
assaults on an object's private data?
--
Phlip
http://penbird.tumblr.com/
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to dja
On Feb 26, 2:35 pm, "ge...@aquarianhouse.com"
wrote:
> maybe like this?:
>
> def up(model, **kw):
> m.objects.filter(pk=model.pk).update(**kw)
too kewt. .update only works on a recordset-in-progress, and
so .update saves the record in one line.
But... it can't change model at the same time
ct (v 1.1.1) of Django to support my magic
_default keyword.
What's the absolute shortest stretch of code which pops a NullObject
into my foo if the record 'bar' is not found?
--
Phlip
http://c2.com/cgi/wiki?ZeekLand
--
You received this message because you are subscribed to the
method to use .get().
So to squeeze my attempt into one line, we get foo =
(list(Foo.objects.filter(name='bar')) + [Foo()])[0], which is way too
much typing.
Doesn't anyone in Django-land have experience with the platforms that
make this problem incredibly easy?
--
Phlip
--
You
Oh, look! "123"[:7] ! The string doesn't have 7 characters! Gee,
shouldn't that throw an exception?
--
Phlip
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googl
1 - 100 of 149 matches
Mail list logo