I totally agree with Glenn.
Every day I suffer of the lack of example in the Python doc.
It would be great that Django does it better.
Olivier.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group
Ticket #1621
--~--~-~--~~~---~--~~
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, send email to [EMAIL PROTECTED]
F
Hi,
On Tue, 2006-04-11 at 09:24 -0500, Adrian Holovaty wrote:
> That's not possible with the Django ORM, but you can drop into raw SQL
> quite easily. See this page for an example:
> http://www.djangoproject.com/documentation/models/custom_methods/
Thanks Adrian, this is exactly what I was looki
Hi,
On Tue, 2006-04-11 at 21:20 -0400, Max Battcher wrote:
> if sometag.article_set.count() == 0:
> pass # your code here
This will test if one tag has an empty article_set. AFAICT, the question
is on how to find all tags which have an empty article_set. Yes, you
could do it this way, but it
nkeric wrote:
>class ArticleType:
>name = ...
>
>class Article:
>title = ...
>article_type = meta.ForeignKey(ArticleType)
>
>class Game:
>name = ...
>articles = meta.ManyToManyField(Article)
>
>how can I retrive the articles of a certain article type of a given
>game?
>
>
>
hi all,
I've done some search, however, I guess I should ask for your helps
here:
I have the following models: (pseudo code)
class ArticleType:
name = ...
class Article:
title = ...
article_type = meta.ForeignKey(ArticleType)
class Game:
name = ...
articles = meta.ManyToMa
kopikopiko wrote:
>
> I run a standalone python programme (called kron) which looks for new
> events in the table and spawns a thread to process them:
This is exactly why you have the problem. It looks like you have a
connection, which is shared across several threads. It's a no-no. This
behav
Hi Eugene,
I'm not getting the error on a web page as such. The project is to
create a scheduling engine in python which uses Django for its
interface. The error comes out of the python programme run from DOS.
Essentially I'm using the Django web interface to maintain a list of
events:
class Ec_
if sometag.article_set.count() == 0:
pass # your code here
On 4/11/06, Brian Elliott <[EMAIL PROTECTED]> wrote:
>
> Suppose I have the following two model objects:
>
> class Tag(models.Model):
> name = models.CharField(maxlength=10)
>
> class Article(models.Model):
> tags = mo
kopikopiko wrote:
> Thanks very much for your answers.
>
> I svn'ed up to 2654 but am still seeing errors. The errors happen more
> frequently after the upgrade. What I'm getting back is:
>
> File "C:\Django\hodie\kron.py", line 109, in ?db_save(this_inst)
> File "C:\Django\hodie\kron.py
Suppose I have the following two model objects:
class Tag(models.Model):
name = models.CharField(maxlength=10)
class Article(models.Model):
tags = models.ManyToManyField(Tag)
Each Article can be associated with multiple Tags and vice versa.
How can I query the Tag model to o
Thanks very much for your answers.
I svn'ed up to 2654 but am still seeing errors. The errors happen more
frequently after the upgrade. What I'm getting back is:
File "C:\Django\hodie\kron.py", line 109, in ?db_save(this_inst)
File "C:\Django\hodie\kron.py", line 14, in db_saveobj.sa
Thank you both for your answer. What I had in mind was read-only views,
so all the update limitations are not a problem at all. Also, I am less
interested in wrappers over native DBMS views. What I'd like is a
programmer-friendly API for views, transparent to the underlying DBMS,
similar to how Mo
Apologies if this is simple, but...
I have a simple 2 object app with which I'm having what appears to be a
foreign key lookup problem.
--- archie.py
class Vendor(meta.Model):
class META:
admin=meta.Admin()
name = meta.CharField("Name", maxlength=100
On Tue, Apr 11, 2006 at 04:16:09PM -0400, Max Battcher wrote:
> "pass" is the Python "do nothing" command, which is often used as an
> indicator to "fill in the blanks" with your own specific code (because
> Python doesn't allow empty functions it is often seen in psuedo-code).
yes... yes... I kn
[EMAIL PROTECTED] napisa³(a):
> I am working with an app that has time issues (99% it is a Time Zone
> problem). I've seen some bizzar behaviour with Django that I need help
> with.
>
> With this model field:
> updated = meta.DateTimeField(auto_now=True)
> The time saved in my database through d
On 4/11/06, Glenn Tenney <[EMAIL PROTECTED]> wrote:
>
> On Tue, Apr 11, 2006 at 02:24:04PM -0400, Max Battcher wrote:
> > You are free to raise your own exception in the path that fails to
> > call super().delete() in M-R.
>
> Then perhaps the docs etc. should instead show "raise "
> instead of "p
On Tue, Apr 11, 2006 at 06:19:49PM -, arthur debert wrote:
> the thing is, if there's anything in django's knowledge to avoid the
> save / delete it DOES raise an error. (such as trying to delete an non
> existant object or trying to save a model that does not pass
> validation). my guess here
On Tue, Apr 11, 2006 at 02:24:04PM -0400, Max Battcher wrote:
> You are free to raise your own exception in the path that fails to
> call super().delete() in M-R.
Then perhaps the docs etc. should instead show "raise "
instead of "pass"... When one shows as an example to use "pass",
it misleads
On 4/11/06, Siah <[EMAIL PROTECTED]> wrote:
> I had the same problem and chose to ignore it. I think it might be a
> bug with Django.
I've had so many headaches from time-zone related issues across
multiple systems. Time-Zones are just inherently frustrating and when
you are trying to syncronize
John,
I had the same problem and chose to ignore it. I think it might be a
bug with Django.
Regards,
Sia
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to d
On 4/11/06, Glenn Tenney <[EMAIL PROTECTED]> wrote:
>
> On Tue, Apr 11, 2006 at 05:01:39PM -, arthur debert wrote:
> > more on this here:
> > http://code.djangoproject.com/wiki/RemovingTheMagic#Addedamorepowerfulwayofoverridingmodelmethodsremovedhardcoded_pre_save_post_saveetc.
>
>
> Everythin
Hi Glenn.
the thing is, if there's anything in django's knowledge to avoid the
save / delete it DOES raise an error. (such as trying to delete an non
existant object or trying to save a model that does not pass
validation). my guess here is if you need anything else in you logic
that django does
The 's' in Users was a typo.
The problem seems to have solved itself... I tried the exact same
procedure again on an updated version of M-R (while typing the message
a new revision became available).
Thanks!
Rudolph
--~--~-~--~~~---~--~~
You received this messa
On Tue, Apr 11, 2006 at 05:01:39PM -, arthur debert wrote:
> more on this here:
> http://code.djangoproject.com/wiki/RemovingTheMagic#Addedamorepowerfulwayofoverridingmodelmethodsremovedhardcoded_pre_save_post_saveetc.
Everything that I read there shows that you can choose to save or
not-sav
Hi Norbert,
this is not possible on trunk , if you are using magic-removal, you can
do it like this:
def delete(self):
if conditionIsMet == True:
super(ModelName, self).delete() # Call the "real" delete()
method.
else:
# Don't delete.
pass
more
Can I use _pre_delete() in a model to stop the deletion from
occurring?
I've checked the documentation, but couldn't find anything relevant.
Someone also raised this question on the save_delete_hooks
documentation, with no response.
Maybe throw some exception?
Has someone done this before o
Thanks, that was my problem. :)
> def __repr__(self):
> return self.get_user().get_full_name()
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-u
I know where you're coming from, but my understanding is this isn't a
policy issue, its a technology issue. The firewall we use (from a major
vendor) does not support the necessary WebDAV extensions that
subversion uses. So changing this would be difficult at a minimum, as
this is a large company
On 4/11/06, va:patrick.kranzlmueller <[EMAIL PROTECTED]> wrote:
> shouldn´t slugify resp. the SlugField convert umlauts?
You'll probably want to check out this discussion on the developers
list:
http://groups.google.com/group/django-developers/browse_thread/thread/cecdf42cb3430601
and weigh in o
shouldn´t slugify resp. the SlugField convert umlauts?
additionally: does anyone have an idea on how to convert umlauts "on
the fly"?
we´re having a tag-cloud where words have umlauts. still, we´d like
to have the tags in the URL.
thanks,
patrick
--~--~-~--~~~---~
Hi,
when your uncollapse the first time then the right list show only one
entry (in fact it is a dropdown at this stage).
If you save without performing any other operation before, then only
the shown entry will saved in the database (others entries will be LOST
!).
I you move one or more entry
Seems I was wrong about the leak not being present on OSX.
After further testing on OSX I have found that the behaviour is in fact
the same as on Windows, and I can see the memory leak. I think I was
fooled by how slow django seems to run on OSX compared with Windows.
1000 posts to a generic crea
On 4/10/06, Russell Cloran <[EMAIL PROTECTED]> wrote:
> I have a model (A) which has a foreign key to another (B). I wish to
> construct a query for all B which have an empty a_set.
>
> This is possible with SQL, using something like:
>
> SELECT b.id FROM b LEFT OUTER JOIN a ON b.id=a.b_id WHERE b
On 4/8/06, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
> It's annoying but relatively harmless. It's not your code, it's a
> problem in the saferef code. This has been mentioned on the list a few
> times recently.
The problem should be gone now. "svn update" your code, and all will be well.
Ad
I should have mentioned, the host that I am considering also has mysql,
and mod_python.
What I usually do is develop an app on my home linux box, then transfer
that app to the remote host. Of course I have to create the same
database, with the same name on the host.
So far, I have only worked wi
On 4/11/06, Fawad Halim <[EMAIL PROTECTED]> wrote:
> Awesome. Good to know I'm not going crazy. Would anyone mind me adding
> this to the RemovingTheMagic page (until the issue is resolved)? It might
> save others hours of digging inside the Django code.
Note that the issue was resolved yesterday
On Mon, April 10, 2006 16:53, Luke Plant wrote:
>
> On Monday 10 April 2006 14:37, Fawad Halim wrote:
>
>
>> I was trying to port an existing (0.91) app to the m-r branch, and
>> found that apparently, the m-r branch requires the models to reside in
>> models.py directly under the app directory
>
On 4/11/06, Rudolph <[EMAIL PROTECTED]> wrote:
> I tried in M-R, in Python shell:
>
> from django.contrib.auth.models import User
> Users.objects.create_user('joe', '[EMAIL PROTECTED]', 'secret')
Other than the fact that you're using "Users" instead of "User" on the
second line, that should work.
Ah, it was user-error. I was bulk-inserting some data with predefined foreign key ids, but I forgot to create the table that those foreign keys reference, and I didn't set "null=True" in the model. So, the select_related was joining a table that had no records -- thus returning an empty list when
walterbyrd wrote:
>Or is there anything else required to run django created apps on a
>shared host?
>
>
It depends on more than just mod_python. Basically for Django you should
have mod_python or FastCGI (or, theoretically, any WSGI-compliant
server), PostgreSQL or MySQL or SQLite. Shell acce
Hi,
I tried in M-R, in Python shell:
from django.contrib.auth.models import User
Users.objects.create_user('joe', '[EMAIL PROTECTED]', 'secret')
it raises:
Traceback (most recent call last):
File "", line 1, in ?
File
"/usr/lib/python2.3/site-packages/django/contrib/auth/models.py", line
4
Here it is:
{% ifequal user.username 'admin' %}
{% submit_row %}
{% else %}
{% if original.admin %}
{% for a in original.admin.all %}
{% ifequal user.username a.user.username %}
{% submit_row %}
{% endifequal %}
{% endfor %}
{% endif %}
{% endifequal %}
Maybe I
tonemcd wrote:
> Now this is getting silly ;)
>
> But, there is one thing I'd like to add. By adding the logic into the
> view and adding a new attribute, 'alreadyvoted', to my existing model,
> I've managed to make the template very light. This is very different
> from the sort of thing you woul
tonemcd wrote:
> Now this is getting silly ;)
>
> But, there is one thing I'd like to add. By adding the logic into the
> view and adding a new attribute, 'alreadyvoted', to my existing model,
> I've managed to make the template very light. This is very different
> from the sort of thing you woul
Me again.
Now I know that the object data in context is {{ original }}
How can I test in my the template that user object is a member of the
original.admin set ?
Olivier.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google G
I think that changed in magic removal. I used get_status() in 0.91 but that showed the same results.chrisOn 4/11/06, Kenneth Gonsalves <
[EMAIL PROTECTED]> wrote:On Tue, April 11, 2006 2:48 pm, Christian Schneider said:
> def __repr__(self):> return "%s (%s - %s)" % (self.name, self.typ
On Tue, April 11, 2006 2:48 pm, Christian Schneider said:
> def __repr__(self):
> return "%s (%s - %s)" % (self.name, self.type, self.status)
shouldnt that be self.get_status()?
--
regards
kg
--~--~-~--~~~---~--~~
You received this message because
Found it. It's not altogether trivial so I thought I'd post it. In the
middle template (index.html in my example) it is imperative to have the
extnds tag on the very first line. I had a html comment line at the top
which caused the parent connection to fail, an empty line has the same
effect. This
On 04/11/06 05:53, Norbert wrote:
> Hello,
>
> I'm just starting out in really trying to get a Django app on its
> feet, even though I've played with it on and off for a couple weeks.
>
> Here's where my first cryptic error begins.
> I tried extend users.User in the most basic fashion I could
That's rather embarassing :) The example I wrote up was a short version
of my template setup so I didn't bother testing and it obviously works
as expected. Going to delve deeper into my templates then,sorry about
jumping to conclusions.
--~--~-~--~~~---~--~~
You r
Hi,I'm afraid I can't answer the question but rather will add another one in the same vain.I found that changing a foreign key field exhibits the same behaviour and also think that's very confusing. Changing values directly in a model are immediately reflected in the model but setting a foreign key
Hello Django experts,
I'm trying to hack admin/change_form.html (do I need to hack the
corresponding view too?) to make Save options (submit_row tag in
admin/change_form.html) disappear if one of the user related to the
object being saved is different than the logged in user.
The problem is that
Norbert wrote:
> raise wrapped
> TemplateSyntaxError: Caught an exception while rendering.
Try to put TEMPLATE_DEBUG=False in settings.py, maybe that will give you a
better error report.
--
Nebojša Đorđević - nesh
Studio Quattro - Niš - SCG
http://studioquattro.biz/
http://djnesh.blogspot.
Of course! Sometimes it's too easy to forget that not everything is as
hot-swappable and dynamic as django!
Many thanks,
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group,
55 matches
Mail list logo