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.
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 fol
the null=True.
Any idea why this 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 subs
" database. It does not even
change the file time on the .db file when the tests run.
Could someone better at Django internals 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 Grou
ere an easier 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 grou
eniences" 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 grou
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 rotating home page with
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 access the CAPTCHA set
s.google.com/group/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"
o 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 email to django-users@
n re-pack
the array with a for-loop.
Do 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.
Bump? String together the SQL myself?
On Jan 31, 3:40 pm, Phlip 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)
> t.save()
>
> I want the s
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 rec
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
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!
--
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
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
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
> 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
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.
> 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 t
> 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
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
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
> 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.
> > 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):
=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
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
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
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
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
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
I just tried it:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
# TODO restore'NAME': ':memory:',
'NAME': '/home/phlip/fun.db',
'USER': '',
> 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
> 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 Goo
> 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
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
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 post
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 rec
> 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
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
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
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
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
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
> 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
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
>
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"
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..
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
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
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
> > 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
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
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
> 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
> 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
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
> 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 clampi
> 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 rend
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 are
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 users
tput
The source appears below my sig (where 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
do with 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 becaus
> 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.
T
> 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 d
e one copied up to the 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
> * 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.
;s why the 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-us
local_dict[model_class.__name__] = model_class
del local_dict, appcache, 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"
.
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 subscribed to
#x27;s only one
- we sample the lambda source, to make the error message as
clear as possible; this works best 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/
orrect, we will pin down their behavior if we parse back the
intermediate value - 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
at, I have used this technique, copiously, on other
projects, and whenever that assertion failed it indeed saved us from
accidentally deploying a slow SQL statement to our server!
--
Phlip
http://zeekland.zeroplayer.com/Pigleg_Too/1
--
You received this message because you are subscribed to t
> 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 Googl
> 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?
ecades 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
iously - reload(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 emai
ort (or fail 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 fr
eval() a
string instead of serve an attribute?
self.assert_model_changes( blog, 'post.count()', 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 ha
> > 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 guide
> 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 django
> >>> (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 g
On Mar 5, 8:41 am, Peter Herndon 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/legibility
uh...
--
You
;list's) in fields,
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 obvi
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
> 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 t
> 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
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
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
1 - 100 of 149 matches
Mail list logo