> > If it's mostly paths that you need to change, check out:
>
> >http://rob.cogit8.org/blog/2008/Jun/20/django-and-relativity/
There's a much easier (IMO anyway) method that does not involve
messing with settings.py. If you just want to find out the directory
of the current application, you ca
> post_info_dict = {
> 'queryset': Post.objects.all(),
You probably don't want to evaluate your queryset here. Drop the .all
() and you'll be good.
mjl
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send e
> Caught an exception while rendering: 'module' object has no attribute
> 'rindex'
Sounds you are using foo.bar instead of 'foo.bar' somewhere (ie.
module instead of string).
mjl
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To pos
> 1. (r'^admin/', include(admin.site.urls)),
That looks like it.
> I tried putting include('admin.site.urls')) but it could not find
> 'admin.site.urls'
Do you have 'django.contrib.admin' in INSTALLED_APPS?
mjl
--
You received this message because you are subscribed to the Goog
Well for now you don't NEED to change anything. You'll get those pesky
deprecation warnings, but everything should continue to work fine for now,
so there's no need to rush things, you can change your code as you go along.
mjl
--
You received this message because you are subscribed to the Goog
Also, having a form to parse and validate the POST data is really the way
to go. Even if you never actually show the form to the user, for example in
an AJAX callback, deferring all that responsibility and just use
"form.is_valid()" and "form.cleaned_data" is a lot better than doing
parameter v
Also, you should really only do saves on a POST request, never on GETs.
mjl
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/jIUH0iInCQ0J.
To post
>
> My problem is when want to display overall player statistics I get about
> 1200 DB-Queries.
> This is because for each player there will be 5 Queries due to
> matches_won, matches_draw, goals, matches_played functions.
>
First easy optimisation: keep Match.objects.select_related().filter
>
> Is this how you meant to set the instance variable or did you mean in
> another way?
>
> def __init__(self, *args, **kwargs):
> super(Player, self).__init__(*args, **kwargs)
> self.matches = Match.objects.select_related().filter( Q(opp1=self)
> | Q(opp2=self) )
Yes, t
Just put something between the {{ so the templating engine will not be
tempted to interpret it. {{ should do the trick, for example.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
https://groups.goog
Basically, you can't. M2m fields are saved after the model is saved, so you
either get objects that are not yet ready for that check (as you
experienced) or you will test the previous value of the m2m field, neither
of which is what you want.
You can modify the admin interface and do the valida
You might want to read the documentation
at https://docs.djangoproject.com/en/1.3/ref/contrib/staticfiles/ --
especially the big boxes labelled "Warning".
mjl
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on
My guess would be that you named your project directory the same as one of
your app directories, that causes all kind of weird import errors.
mjl
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
h
Are you sure your context is thread-safe, ie. it's rebuilt from scratch
every time you render an email and not re-used, stored in a global variable,
class variable, whatever? Your problem description very much sounds like
someone is fiddling with the context while the template is rendering.
Just remove the line with "python-format" from your translation since it
isn't a format string after all.
mjl
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/d
One possibility that springs to mind is shared memory, either the sysv
shmem variant or memory mapped files.
mjl
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/ms
How about just listening to pre_save or post_save signals on the User
model?
mjl
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/C65AzRxHDNwJ.
To
Probably you are not serving your static files any more as the built-in
staticfiles app only works in debug mode (that's a feature).
mjl
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
https:
Do you actually need both as views proper? The easiest thing would be to
factor out the fetching part of the kundendaten view, make that return just
a dictionary, then call that and update the context in the first view.
--
You received this message because you are subscribed to the Google Group
Don't overthink it.
If believe you are likely to run into cascading recursive updates, then
those cascades will happen no matter where you put the update. You will
need to deal with it some way or another (locking, careful ordering, better
data structures, whatever), but just moving things
Okay. You seem to be rather confused about the django approach to things
I'm afraid.
(a) You use raw sql instead of django's ORM mapper. That's okayish, but
then you're on your own for building your queries and have to manually do
validation and escaping and whatnot, which is, as you notice
>
> I tryed first this part with db models. but mssql doesnt work on it...
>
BTW, why? I see there's a django-mssql, that should allow you to connect
to the database. Doesn't it work with your version? I've never tried it
though, I just googled around a bit...
--
You received this messag
>
> further, i tried putting a sender argument in receiver, but the sender , i
> found (by set_trace) is Cart_cartitems, how can i import this 'shoppingcart.models.Cart_cartitems'> when its only a intermediary model
> that django's creating.
I think you want Cart.cartitems.through
>
> return getpass.getuser().decode(locale.getdefaultlocale()[1])
> TypeError: decode() argument 1 must be string, not None
>
It needs a valid locale to be set in the environment. Try setting
LC_ALL=en_US before running syncdb.
mjl
--
You received this message because you are su
Something like this (totally untested though)
Product.objects.exclude(pk__in=Product.subproducts.through.values_list(
'product_id', flat=True))
perhaps?
Cheers,
mjl
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe fr
Continent = form.cleaned_data['Continent']Continent =
dict(form.fields['Continent'])[Continent]
The obvious confusion stemming from the upper case variable aside, the
second line is total nonsense. Drop it and you'll be golden.
Cheers,
mjl
--
You received this message because you a
It's simply a question of what you want to model.
*GenericFK* means for each instance "I have a relationship with some
other (undefined) entity". *MultipleFK* means "I have relationships with
both well-known entities A and B". Totally different things.
Cheers,
mjl
--
You received
I'd guess it's the usual model-magic dealing with app_label, which causes
them not to appear under "app1" (because, well, you defined them somewhere
else). Try to set app_label manually in your model's Meta class.
Cheers,
mjl
--
You received this message because you are subscribed to
Well, that is what repeatable read is supposed to do -- once you do a
Foo.objects.all() (or whatever) query, re-running the query will give you
the same result. That's why it's called repeatable read. You have to either
start a new transaction to break that visibility barrier or not use
repea
> This is still about 50 times better than the form with Q objects and
> LEFT OUTER joins.
This is rather unusual. A join in the database should be quite a bit
faster than doing things manually, except if the joined tables produce
massive amounts of data. This suggests that you're missing
What problems did you encounter? It's easier to help you knowing what went
wrong.
mjl
--
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 group,
What problems did you encounter? It's easier to help you knowing what went
wrong.
mjl
--
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 group,
Sounds like a join with a table that doesn't have all the rows. Let me
guess: the tables have been filled by some other program and you are just
reading them from Django -- and you are missing a blank=True, null=True on a
ForeignKey in your Django models somewhere.
Cheers,
mjl
--
You probably want to use something like
https://docs.djangoproject.com/en/1.3/ref/models/querysets/#extra
to add custom sql expressions to your querysets.
mjl
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discus
1. Define a unicode method on Source that returns whatever you want to
display.
2. Missing comma in one-element tuple.
mjl
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
https://groups.google.
> I cannot simply copy the email to the username because the username must be
> less than 30 characters and, after looking into my database, many email
> addresses go over that.
Note that you can fix that quite easily by putting something like
this
for f in User._meta.fields:
if f.n
Let's see...
Since there is no aggregate on your outer select, the GROUP BY is
basically reduced to a DISTINCT, so we can just do a distinct() on the query
set. The JOINs come automatically as soon as you have ForeignKey fields
(just remember to do a select_related() to avoid excessive quer
37 matches
Mail list logo