Thank you Marius; the video is worth the watch and thought provoking
Phlip
On Thursday, August 9, 2018 at 2:42:13 PM UTC+2, Phlip Pretorius wrote:
>
> I want to build a one-to-many recursive foreign key on a table in Django.
>
> The concept is something like this:
>
> T
=
I get the following error message:
no such column: komadm_apps_decisionindex.IndexPredecessor_idno such
column:
Any help will be welcome.
Regards,
Phlip
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from t
Thank you Andréas and Jason
That solved my problem
Regards,
Phlip
On Monday, August 6, 2018 at 3:02:01 PM UTC+2, Andréas Kühne wrote:
>
> Hi Philip,
>
> The field is required because you haven't allowed it to be blank - and
> django admin requires fields to have the follo
his is happening? I have deleted the complete Django project
and started from scratch only to find the same scenario; when I click save,
I get the following message.
Any advice will be welcomed.
Regards,
Phlip
--
You received this message because you are subscribed to the Google Groups
&
ternals than me package this system
up and contrib it?
--
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-users@googlegroups.com.
To unsubscribe from this g
ier way, or has someone already done
this?
(1.2, BTW - the obese database prevents an upgrade to Django 1.3!)
--
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 em
as
the .order_by() builder. It insisted on parsing my string instead of
simply appending it.
> --
> 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
On Feb 20, 2:19 pm, galago wrote:
> What is the best way, to select X random rows from DB? I know that
> method: .all().order_by('?')[:X] is not good idea.
> What methods do you use?
order_by('RAND()')
That might use the same seed each time.
To create, for example, a
On Feb 21, 12:47 pm, Cody Django wrote:
> Thanks -- I didn't know about mock objects, and this is good to know.
> But this doesn't feel like this is the solution I'm looking for. It's
> a large project, and your proposal would require extensive patching.
Does your project
oup/django-users/browse_thread/thread/f23b2bdf24ff7a26/110d3e5c9e69ca63
I will, of course, start with extra(), and see where that takes me!
--
Phlip
http://zeekland.zeroplayer.com/
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post
andler to trivially
pass it, without real user input.
To test the captcha, mock it to pass or fail.
--
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
QuerySet aggregations and annotations offer some way to push that
query into the database?
--
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 dj
Bump? String together the SQL myself?
On Jan 31, 3:40 pm, Phlip <phlip2...@gmail.com> wrote:
> Djangoists:
>
> Given a model Tree with many Leaves, I want to write this:
>
> t = Tree(data=42)
> t.leaves.add(leafy_data=43)
> t.leaves.add(leafy_data=44)
>
to optimize the database
calls. If not, that's okay to.
Google doesn't say Django can do this.
My specific problem is I have a dozen trees with a couple thousand
leaves each, and simply writing them all causes a bottleneck.
--
Phlip
http://c2.com/cgi/wiki?ZeekLand
--
You received
On Nov 8, 8:12 am, Phlip <phlip2...@gmail.com> 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
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!
--
Phlip
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
e 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://zeekland.zeroplayer.com/
--
You received this message bec
On Oct 26, 10:24 am, Phlip <phlip2...@gmail.com> 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
> 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
b)
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. Unless we need to go deeper.
Thank
> 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
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 the result set y
> 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
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
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,
> 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
> > 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):
]
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 'manager'.
How do I (redundantly!) give the two model records the same
boi
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
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 you
b ci:'what I did' # run all the tests then integrate
Also, read the book "Release It!", if you think you know how to battle-
harden a website for production!
--
Phlip
http://zeekland.zeroplayer.com/
--
You received this message because you are subscribed to the Google Groups
&qu
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 email to
On Oct 21, 10:54 pm, Russell Keith-Magee <russ...@keith-magee.com>
wrote:
> On Fri, Oct 22, 2010 at 12:37 PM, Phlip <phlip2...@gmail.com> wrote:
> > I just tried it:
>
> > DATABASES = {
> > 'default': {
> > 'ENGINE': 'django.db.backends.
I just tried it:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
# TODO restore'NAME': ':memory:',
'NAME': '/home/phlip/fun.db',
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
}
}
Yes that's in my
> 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
> 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.
> 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
> 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
we can't do 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 th
to 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
> 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
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
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
> 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
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.zeroplayer.com/
--
You
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 group, send em
d 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 Groups
&q
...
--
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-users+unsubscr...@google
On Jul 30, 3:28 am, Phlip <phlip2...@gmail.com> 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 ha
> 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
forgot to mention Django 1.1.2
On Jul 29, 5:18 pm, Phlip <phlip2...@gmail.com> wrote:
> Django aficionados:
>
> Here's my test code:
>
> from django.test.client import Client
> self.client = Client()
> from django.core.files.base import Content
, 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" group.
To post to this group,
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,
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
test cases!
--
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 group, send email to
django-users+unsubscr
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 this group, send email to
dj
> > 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
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 email to django-us...@googleg
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 group, send email to
d
> 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
> 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,
= 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?
& Happy April 20th, y'all! Pic not related.
--
Phlip
> If you posted some specifics of what you are actually seeing, someone might
> be able to help. I mean, actually copy-paste the traceback into your post
> (or put it someplace like dpaste.com and point to it).
I am not asking "oo help I can't get my template working". That part's
done - by
> Uusually the first line in the traceback tells you pretty explicitly
> where the error is. Without the traceback, it's hard to say where your
> problem lies.
One of the templates is "basket.html", and "basket.html" does not
appear in the transcript.
All the lines are only django's internal
Djangoists:
When code below a template throws an error, we get an insanely
detailed stack trace of all the lines AROUND the template.
How do I tell what lines INSIDE the templates caused the error?
--
Phlip
http://c2.com/cgi/wiki?ZeekLand
--
You received this message because you
ilent warning. The fixtures= line also has this bug.
--
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.com.
To unsubscribe from this group, send email to
Djangoists:
(Under version 1.1.1) loaddata (and the fixtures= line in tests)
silently fails if the data cannot load.
How do I access the error message?
--
Phlip
http://c2.com/cgi/wiki?ZeekLand
--
You received this message because you are subscribed to the Google Groups
"Django
E_NAME] =
store.session_key
session = self.client.session
session.update(dictionary)
session.save()
# and now remember to re-login!
--
Phlip
http://c2.com/cgi/wiki?ZeekLand
--
You received this message because you are subscribed to the Google Groups
"Django u
I am aware archivers might trim
it).
Warning: Per my other thread, calling EXPLAIN on an a SQLite3
connection seems to scramble it. Not sure why, but I don't care,
because one should not use SQLite3 in production.
--
Phlip
http://c2.com/cgi/wiki?ZeekLand
def assert_compliant_sql(self,
th Django - is ...
cursor.execute('EXPLAIN ' + query)
...seems to scramble a sqlite3 database. If I take the EXPLAIN out I
don't get unrelated test failures (tho the new assertion naturally
does not work!).
I will make it work for MySQL!
--
Phlip
--
You received this message because you are subscribed to t
> def setUp(self):
> user = User.objects.create_user(USER, '@nowhere.com', PASS)
That's what fixtures are for!
--
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.
> The test_settings and dev_settings should point to a PASSWORDLESS
> database with localhost-only permissions. The production_settings file
> should not be committed. It's the one copied up to the server.
Come to think of it, what I'm screaming about here is three separate
things:
- developer
he server.
All sub-settings files should start with from settings import * to
pull in the common settings, and should override them if they need to.
One important override is test_settings should use sqlite3 :memory:
database.
--
Phlip
http://c2.com/cgi/wiki?ZeekLand
--
You received this messag
> * Similarly, connection.cursor() will only work in the single
> database case. connections[qs.db].cursor()
Aaaand that's not working either. (No connections, no qs.db.)
I must take a break until someone unravels all this, because I don't
know enough about the architecture inside QuerySet...
> AttributeError: 'BaseQuery' object has no attribute 'get_compiler'
qs._as_sql() returns a tuple of a SELECT statement, and a (),
presumably with wildcards; I will start there.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this
> qs.query.get_compiler(qs.db).as_sql()
That gives this error message with the usual zero Google hits for that
error message:
AttributeError: 'BaseQuery' object has no attribute 'get_compiler'
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
documentation
assumed you started there.
--
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.com.
To unsubscribe from this group, send email to
django-users+unsubs
he, os
''')
os.system('ipython -i -nobanner .ipython')
--
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
.
How can we fix the first problem? How can this (otherwise useful)
shell use a minimal or invisible import rubric, to grab, say, a bunch
of models so they are all ready & available for use?
--
Phlip
http://penbird.deviantart.com/
--
You received this message because you are subscr
if the lambda's on its own
line
- every assert needs a deny; I will write deny_latest as soon as
a need appears.
--
Phlip
http://zeekland.zeroplayer.com/Pigleg_Too/1
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to
ue - the actual SELECT statement, and then interrogate
it.
Oh, yeah, and such a test is also perform...ing. Well. Because it
doesn't build records or read them.
I will see when I have time to code that up...
--
Phlip
http://c2.com/cgi/wiki?MoreliaViridis
--
You received this message because you a
ing a slow SQL statement to our server!
--
Phlip
http://zeekland.zeroplayer.com/Pigleg_Too/1
--
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 th
> I want to be able to answer your question, forever. Is there a way,
> from a developer test, to query "what SQL statement does this QuerySet
> generate"?
Oh, duh, it's QuerySet.query, as a string.
Brand X makes that one inconceivably hard, due to poor factoring...
> --
"SELECT * WHERE id not in (SELECT
id WHERE ...)" might just snocker the database worse than two SELECTs.
You never know; that's why I'd like to see an EXPLAIN on it!
--
Phlip
http://c2.com/cgi/wiki?ZeekLand
--
You received this message because you are subscribed to the Google Groups
> Just create another queryset that excludes everything in your first
> queryset:
>
> negated_queryset = User.objects.exclude(id__in=queryset.values("id"))
QuerySets are already so easy to plug-n-play... Ain't there a way to
do it without whacking the database twice?
--
ades do we have to wait until editors support
testing as aggressively as debugging?
--
Phlip
http://penbird.deviantart.com/art/Uncle-Wiggily-Wants-You-156969773
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group
(instance) does nothing to the instance we already
have, and its internals are still dirty...
--
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.
to prevent) assigning
a .__dict__ like that?
--
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 group,
41, 42,
lambda:
blog.write_one_post('yack yack yack') )
The code shows how to .reload() in Django, because (unless I'm wrong),
Django models don't have a method to reload themselves from their data
stores.
Another little question: If anyone can suggest a code cleanup, I'm
there!
--
> > And if the PEP8 told you to ... just jump off a cliff... would you?
>
> Sounds like you might benefit from actually reading it:
This thread arc is about me lamenting the positive value of style
guides, even those with wrong line-items.
Nobody here has said to get creative with any style
> In this case, it's not just a team style guide - it's PEP8, which clearly
> says:
And if the PEP8 told you to ... just jump off a cliff... would you?
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to
> >>> (I also disagree with leaving out the spaces around =, but obviously
> >>> obeying a team style guide supersedes improving it...)
>
> >> ... the goal of clarity/legibility
>
> > uh...
>
> ;) I meant *having* a style guide was consistent with said goal.
right - following an aesthetic style
On Mar 5, 8:41 am, Peter Herndon <tphern...@gmail.com> wrote:
> On Mar 4, 2010, at 7:37 PM, Phlip wrote:
> > (I also disagree with leaving out the spaces around =, but obviously
> > obeying a team style guide supersedes improving it...)
>
> ... the goal of clarity
the =[] event is free to be "overloaded" by its type.
So id=[] would resolve to id__in=[], id=Scalar to id__exact=Scalar,
and the explicit versions are available if you suspect that
overloading is fragile.
(I also disagree with leaving out the spaces around =, but obviously
obeying a team
Peter Herndon wrote:
> Won't the "in" filter do exactly what you need?
>
> http://docs.djangoproject.com/en/1.1/ref/models/querysets/#in
Why do you need even __in? Given...
Entry.objects.filter(id__in=[1, 3, 4])
...couldn't id=[] overload if the target is a list?
> The only condescension I've seen in this thread is from you. And, to
> be fair, if I wanted to be condescending I'd have simply pointed you
> at Tony Hoare's explanation of null values
That's why I said NullObject, in the first post.
--
You received this message because you are subscribed to
> Just create your own Manager and override the default (named 'objects') in
> your models. Have 'get' behave any way you like.
>
> http://docs.djangoproject.com/en/1.1/topics/db/managers/
>
> Shawn
Ding!
http://docs.djangoproject.com/en/1.1/topics/db/managers/#adding-extra-manager-methods
luv
3"[: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...@googlegroups.com.
To unsubscribe from th
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 received this message be
1 - 100 of 149 matches
Mail list logo