Hi,
Does this help you?
myslug=...
parents=[]
while myslug:
cat_crumb=Category.objects.get(slug=myslug) # I guess slug is unique
parents.append(cat_crumb)
myslug=cat_crumb.parent
But be careful, you might get infinite loops if the parent links
to a child. To avoid this you could write
strange. I´m using this for one of my applications and it works fine.
hers´s my setup:
/library/
__init__.py
admin.py
views.py
/models/
__init__.py
addon.py
camera.py
material.py
__init__.py (in the models-directory):
from library.models.material
alain D. schrieb:
> Being inside database transactions is a good reason to use database's
> full text index ... but the sake of simplicity, a full text index
> created by python code inside the models declaration (easily
> maintainable) would be nice ...
>
>
>
This is inside the model declarati
Thank you very much for your precise answer. I think I misunderstood a
lot and I will go through the tutorial again.
On 28 Okt., 15:04, bruno desthuilliers <[EMAIL PROTECTED]>
wrote:
> On 28 oct, 14:05,DanielStrasser<[EMAIL PROTECTED]> wrote:
>
> > > You have a circular reference between students
Hi,
short summary for all who didn't follow or don't remember (it's been a
while since the last reply...):
I have signals wired up for comments (email-notification on commenting).
Users are allowed to comment on three different models.
Where should the code live?
Am 29.09.2008 um 14:36 schrieb
Hello,
I have an interesting problem. One of the users of my ( test ) django
site reported that he cannot upload image banners to the site using
the custom admin. I've checked the logs, and found the following
exception logged:
Traceback (most recent call last):
File "/usr/lib/python2.4/site-p
Roodie wrote:
> Hello,
>
> I have an interesting problem. One of the users of my ( test ) django
> site reported that he cannot upload image banners to the site using
> the custom admin. I've checked the logs, and found the following
> exception logged:
>
> Traceback (most recent call last):
>
Hi all,
I found the solution. Someone (not me!) changed the
django.views.defaults.page_not_found(). The first line of the method
definition read
def page_not_found(request, template_name='404_default.html'):
instead of
def page_not_found(request, template_name='404.html'):
Thanks to all who a
Hi All,
Can anyone please send me a small date based generic view
application .
Thank You.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to
Metoo.
I also don't quite understand how can I use it easily.
On Oct 29, 10:02 am, "please smile" <[EMAIL PROTECTED]> wrote:
> Hi All,
> Can anyone please send me a small date based generic view
> application .
> Thank You.
--~--~-~--~~~---~--~~
Wiadomość napisana w dniu 2008-10-29, o godz. 10:02, przez please smile:
> Hi All,
> Can anyone please send me a small date based generic view
> application .
> Thank You.
There is good explanation of date-based generic views in Practical
Django Projects (Chapter 4). Also
hello,
I try to redirect a user who comments a post on my blog to the same
page,
to do that, i need to use the signal : 'comment_was_posted'
i have put the code below in my blog 'models.py' to be sure it has
been loaded,
but when i post a new message, i'm not redirected to google ...
from djang
hello
i am new in django.
i want to insert values into two tables from a single form.
i think ModelForm didnot work for this.
Can i use raw sql query to insert into tables. i am using mysql and
latest subversion of django.
please give me some sugessions.
--~--~-~--~~~
hi Thomas,
thanks for all the details, actually my post was not really clear on
what I have.
the category model looks like this:
class Category(models.Model):
name = models.CharField(max_length=100, unique=True)
slug = models.SlugField(max_length=100, unique=True)
p
Hi,
Are querysets threadsafe? i.e. If a query set object is shared across
requests, will it cause any issues? I ask because some of the code in
django/db/models/query.py looks like it might access the same
resources if called simultaneously from two threads.
Regards,
Will McGugan
http://www.wil
The custom admin templates I've put into my application templates/
admin folder are ignored when I'm using apache2 (http://
myapp.mydomain.org) but are running when I'm using runserver (http://
localhost:8000).
On the contrary, custom admin css and js are running when using
apache2 but aren't whe
Thank you both. I'm trying to create a view that converts the ReST
documentation to HTML and shows it integrated with my templates, but
with docutils it gives out a lot of errors. And with sphinx it just
generates plain complete html files with links beteween them :(
How could I do it?
Thank you
On Oct 29, 2008, at 6:01 PM, sam wrote:
>
> hello,
>
> I try to redirect a user who comments a post on my blog to the same
> page,
> to do that, i need to use the signal : 'comment_was_posted'
>
> i have put the code below in my blog 'models.py' to be sure it has
> been loaded,
> but when i post
Since a django application is a normal python module you
could create a signals.py and import it in your applications __init__.py
or whatever pleases you.
a django application can contain whatever new files modules you want.
It has to respect somethings so that django recognises it as an applicat
Ok, perhaps this is a pinax issue?
I would not have thought that it would have made a difference but I'll
try asking on the pinax list.
Thanks for your help
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django us
Is there anything like this for Django?
http://www.sitepoint.com/blogs/2008/10/24/rails-rumble-245000-lines-of-code-in-48-hours/
I know sprints exist for work on the Django core - but is anyone
interested in a Django web app session similar to the Rails one metioned
in this article?
Stephen
On Wed, Oct 29, 2008 at 5:59 AM, Mr. Z <[EMAIL PROTECTED]> wrote:
> Thank you both. I'm trying to create a view that converts the ReST
> documentation to HTML and shows it integrated with my templates, but
> with docutils it gives out a lot of errors. And with sphinx it just
> generates plain comp
On Oct 29, 10:26 am, limas <[EMAIL PROTECTED]> wrote:
> hello
>
> i am new in django.
> i want to insert values into two tables from a single form.
> i think ModelForm didnot work for this.
> Can i use raw sql query to insert into tables. i am using mysql and
> latest subversion of django.
>
> ple
I forgot to say that my problem is different from
http://docs.djangoproject.com/en/dev/howto/deployment/modpython/#id3 ,
as I want to use my custom css and js that lives in myproj/myapp/
static but not those that live ni django/contrib/admin/media.
What is more, I wouldn't want to change anything
The thing is, I don't want to tie the comments signals to a specific
application.
It's more of a project-wide thing.
So I did put the code into signals.py, stuffed it into my project root
(not in an app)
and imported it in my project's __init__.py.
Now I get this Error if I try to ./manage.p
thank u very much for ur reply..
i were just stuck in my project.It helps me realy...
thanks...
On 29 Oct, 16:42, Daniel Roseman <[EMAIL PROTECTED]>
wrote:
> On Oct 29, 10:26 am, limas <[EMAIL PROTECTED]> wrote:
>
> > hello
>
> > i am new in django.
> > i want to insert values into two ta
def get_parent(self):
if self.parent:
return [self.parent]
return []
def get_parent_tree(self):
asc = self.get_parent()
for p in asc:
asc.extend(p.get_parent())
return asc
This is what I use for generating a category crumb
Benjamin, i did't have to use singnals so far, but when something is needed
in various app (models), i create new app and put it there (e.g.
signals.py).
And you don't have to bother with cross imports exceptions, can change
everything in one place for each model etc.
Radovan
--
View this mess
I need to create a custom filter which displays some data from db
depending on its data type.
My code is something like,
from django.template.defaultfilters import linebreaks, urlize
def filterxx(data)
return linebreaks(urlize(data.value))
My data.value is
Asdfghjkl
alert('hole')
This
Exactly that. Here's what I put together:
class Catalogue(models.Model):
... everything above ...
# Added field to store reference to at-job number
at_job_number = models.IntegerField(editable=False)
def save(self, **kwargs):
self.create_at_job()# new method
The period for submitting tutorial proposals for Pycon 2009 (US) is open and
will continue through Friday, October 31th. This year features two
"pre-conference" days devoted to tutorials on Wednesday March 25 & Thursday
March 26 in Chicago. This allows for more classes than ever.
Tutorials are 3-h
> Thanks to all who answered, now I'll go looking for the person who
> messed with the development machine.
>
Everybody can make mistakes. The root of the problem is (or was)
that you don't see tracebacks if settings.DEBUG=False.
I see them in the apache error log. I use mod_wsgi.
Thomas
> Why do you want to use raw SQL? What's wrong with using the normal
> Django ORM?
One reason that I use in my own code is to snapshot multiple
values efficiently, a'la:
INSERT INTO stored_groups
(statementitem_id, groupname, groupvalue)
SELECT si.id, g.groupname, gv.groupvalue
FROM
Let's say I want to override change_list.html for an app called 'cms'.
I create a /admin/cms/change_list.html
and then call back to the original admin template overriding just want
I want to change:
{% extends "admin/change_list.html" %}
{% block extrahead %}
...
{% endblock %}
However if I wa
On Oct 29, 1:14 pm, AndyB <[EMAIL PROTECTED]> wrote:
> Let's say I want to override change_list.html for an app called 'cms'.
>
> I create a /admin/cms/change_list.html
>
> and then call back to the original admin template overriding just want
> I want to change:
>
> {% extends "admin/change_list
Ok. Thank you James.
On 29 oct, 12:31, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On Wed, Oct 29, 2008 at 5:59 AM,Mr.Z<[EMAIL PROTECTED]> wrote:
> > Thank you both. I'm trying to create a view that converts the ReST
> > documentation to HTML and shows it integrated with my templates, but
> > wi
I have an Account model:
class Account(models.Model):
accountname = models.CharField(max_length=50, unique=True)
owner = models.ForeignKey(User)
admins = models.ManyToManyField(User, related_name='admins',
blank=True)
accounts = models.ManyToManyField(User,
relate
I can see why it would fail - but I still wonder whether the current
behaviour is ideal. I would say that it's more likely someone would
want to override a template project wide and I can't see a neat way to
do this.
--~--~-~--~~~---~--~~
You received this message b
AndyB wrote:
> I can see why it would fail - but I still wonder whether the current
> behaviour is ideal. I would say that it's more likely someone would
> want to override a template project wide and I can't see a neat way to
> do this.
>
The easiest way would surely be to add another templat
I have a very simple "watchlist" app which allows people to keep an
eye on their favorite bits of content on the site... forum topics,
cars, articles, etc. Not much to it--it simply stores the object and
who's watching it:
class Watch(models.Model):
subscriber = models.ForeignKey(User, verbos
On Oct 28, 2:47 pm, Robert Dailey <[EMAIL PROTECTED]> wrote:
> On Oct 28, 11:17 am, Steve Holden <[EMAIL PROTECTED]> wrote:
>
>
>
> > Robert Dailey wrote:
> > > On Oct 28, 10:29 am, Steve Holden <[EMAIL PROTECTED]> wrote:
>
> > >> Robert Dailey wrote:
>
> > >>> Hi,
>
> > >>> I currently have the f
i have this problem
is there anybody hwo know the solution.
please tell me.
--~--~-~--~~~---~--~~
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
Hi,
has someone written a generic query builder?
The view should take a model class as argument and create
a HTML form for creating a query.
Foreignkey relationships should be followed...
Integer and date fields should be queryable with ranges...
Last: Ordering of the result should be possible,
On Wed, Oct 29, 2008 at 11:05 AM, noureddine <[EMAIL PROTECTED]> wrote:
>
> i have this problem
> is there anybody hwo know the solution.
> please tell me.
>
You've specified the wrong import, or the wrong pythonpath, or have a
corrupt installation, or ...? Without some specifics of what you are
Hi,
i want to know what the best practice is for following problem.
I use the built in user authentication framework. I've already made the login
authenticate against our AD. Works fine (see
http://www.djangosnippets.org/snippets/901/)
In our company, usernames are specified with a period betw
Wiadomość napisana w dniu 2008-10-29, o godz. 16:39, przez Benedict
Verheyen:
> I tried to override the 2 forms in my models.py file
>
> class MyUserCreationForm(UserCreationForm):
>username = forms.RegexField(label=_("Username"), max_length=30,
> regex=r'[EMAIL PROTECTED]',
>help
Jarek Zgoda wrote:
> You have to unregister the admin class for User model before
> registering your own.
Thanks, that seems to solve the register error.
However, the other question remains, is the way i'm going about to
change the allowed characters ok?
Thanks,
Benedict
--~--~-~--~
On Wed, Oct 29, 2008 at 8:26 AM, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
>
> I have a very simple "watchlist" app which allows people to keep an
> eye on their favorite bits of content on the site... forum topics,
> cars, articles, etc. Not much to it--it simply stores the object and
> who's
Graham,
Thanks once again.
> There is still the risk of conflicts as Python module is using a
> reentrant version of library and PHP isn't.
>
OK, that makes sense. I guess we need to recompile PHP5, then.
Regards,
Giles
--
Giles Thomas
MD & CTO, Resolver Systems Ltd.
[EMAIL PROTECTED]
On 29.10.2008 12:49 Uhr, Benjamin Buch wrote:
> The thing is, I don't want to tie the comments signals to a specific
> application.
> It's more of a project-wide thing.
>
> So I did put the code into signals.py, stuffed it into my project root
> (not in an app)
> and imported it in my project's __
Hi Radovan,
thanks for your reply!
Am 29.10.2008 um 13:07 schrieb urukay:
> Benjamin, i did't have to use singnals so far, but when something is
> needed
> in various app (models), i create new app and put it there (e.g.
> signals.py).
> And you don't have to bother with cross imports excepti
Hi Adi,
Radov proposed the same, I just answered to his reply...
It works like you two guys said!
Danke!
benjamin
Am 29.10.2008 um 17:04 schrieb Adi Jörg Sieker:
>
> On 29.10.2008 12:49 Uhr, Benjamin Buch wrote:
>>
>>
>> Why do I have to set an environment variable for this?
>> Django never c
Thanks Brian. The Observer in notification doesn't help me (I'd rather
keep my existing observer). The more I look at it, the more
notification looks like a nice piece of work. I just don't know how
much I'll end up reworking it for my purposes.
--~--~-~--~~~---~--~--
Hi everybody!
I have to create a summary page for one of my models. With "summary
page" I mean a table where each item of my model is listed along with
its properties/values.
Some of those properties/values are fields of the db itself, while
other values are calculated on the fly (maybe with a s
I add a staff user with no additional permission to my admin
interface, hoping that they would be able to use the interface for
searching, but unfortunately since they do not have permissions to
edit anything they seem unable to search either. At the moment, I
would actually prefer to use this int
You need a save_model() method in your corresponding admin class:
def save_model(self, request, obj, form, change):
obj.user = request.user
obj.save()
http://docs.djangoproject.com/en/dev/ref/contrib/admin/#modeladmin-methods
--~--~-~--~~~---~--~
I just found this:
http://www.djangoproject.com/documentation/databrowse/
but other input is welcome.
Thanks,
Sean
On Oct 29, 9:43 am, Sean <[EMAIL PROTECTED]> wrote:
> I add a staff user with no additional permission to my admin
> interface, hoping that they would be able to use the interfac
Hi!
I am new to Django and just discovered an issue when trying to filter
querysets with multi-value relations.
Let's say I have a Article and Tag model where an Article can have
many Tags. I have a use case where a bunch of get parameters filters
the list of articles based on Article model fiel
Hi Fabio,
> I have to create a summary page for one of my models. With "summary
> page" I mean a table where each item of my model is listed along with
> its properties/values.
>
> Some of those properties/values are fields of the db itself, while
> other values are calculated on the fly (maybe w
Wiadomość napisana w dniu 2008-10-29, o godz. 16:57, przez Benedict
Verheyen:
>> You have to unregister the admin class for User model before
>> registering your own.
>
> Thanks, that seems to solve the register error.
> However, the other question remains, is the way i'm going about to
> chang
Hi Paddy,
> I have an Account model:
>
> class Account(models.Model):
>
> accountname = models.CharField(max_length=50, unique=True)
> owner = models.ForeignKey(User)
> admins = models.ManyToManyField(User, related_name='admins',
> blank=True)
> accounts = models.M
On Oct 29, 8:35 am, shabda <[EMAIL PROTECTED]> wrote:
> I need to create a custom filter which displays some data from db
> depending on its data type.
>
> My code is something like,
>
> from django.template.defaultfilters import linebreaks, urlize
>
> def filterxx(data)
> return linebreaks
Robert Dailey wrote:
> On Oct 28, 2:47 pm, Robert Dailey <[EMAIL PROTECTED]> wrote:
>
>> On Oct 28, 11:17 am, Steve Holden <[EMAIL PROTECTED]> wrote:
>> [...]
>>
>> I'm have some more questions for you if you don't mind. When I add a
>> note, now there is a combo box with a list of users to cho
On 29 Oct 2008, at 15:06 , Paddy Joy wrote:
> Is there an easy way of doing this or do I need to create a custom
> form that contains the fields of both models and then separate the
> data in my view?
>
> Paddy
What's wrong with creating two different Forms (one for the account,
one for the use
Brian,
Thanks for the reply!
On Oct 28, 4:57 pm, Brian Gershon <[EMAIL PROTECTED]> wrote:
> I just ran into this same issue. I eventually figured out that adding
> TEST_DATABASE_NAME to settings.py (to prevent Django from using the
> default memory database for sqlite) works around the issue.
this solution doesn't fix it for me.
i have my db in /var/www/myproject/databasefile and i've just simply
`chmod 777` the parent directory
On Oct 17, 1:22 pm, Emilio <[EMAIL PROTECTED]> wrote:
> I found the solution:
>
> http://django.freelancernepal.com/errors/django-says-unable-to-open-d...
>
Rajesh Dhawan wrote:
> Hi Fabio,
>
> > I have to create a summary page for one of my models. With "summary
> > page" I mean a table where each item of my model is listed along with
> > its properties/values.
[...]
Rajesh, your explanation is very clear and full of details. Thank you
so much! I'l
I have a ManyToMany field that works as a raw_id_fields item. It is an
intermediary ManyToMany model class using the through='ClassName'
feature.
The admin.py shows that ManyToMany model using an Inline admin class.
The Inline class has the raw_id_fields and extras attributes. Here is
an example
On Wed, Oct 29, 2008 at 4:35 PM, AndrewD <[EMAIL PROTECTED]> wrote:
>
> # models.py
> class Membership(models.Model):
> person = models.ForeignKey(Person)
> group = models.ForeignKey(Group)
>
> # admin.py
> class MembershipInline(admin.TabularInline):
> model = Membership
>
Although Data Browser is interesting. I was hoping for something much
closer to the admin interface, but for viewing and searching. It would
seem like DRY would suggest that using the admin interface for read-
only access would actually be the right way to do this, simply making
someone staff, and
Hello,
I want to do something like the following:
my_query_set = my_table.objects.filter(field1 = some_val and
field2 = another_val)
or
my_query_set = my_model.objects.filter(field1 = some_val or
field1 = another_val)
I couldn't find anything in the docs that describes ho
I looked around but didn't find anything obvious or simple. This is a live
Django app with data in MySQL which I want to migrate to PostgreSQL.
Suggestions? (Before I do my own thing :))
-Naitik
--~--~-~--~~~---~--~~
You received this message because you are subsc
Hi, All,
I just want to pass a special character by using url to the proper
view. For example,
"http://127.0.0.1/sampleview/?obj=xxx"; , but seems django cannot
handle such pattern.
Does any one know this, or are there any relevant doc I can learn for
this. Your precious suggestion would be hi
On Thu, Oct 30, 2008 at 8:31 AM, megrez80 <[EMAIL PROTECTED]> wrote:
> I want to do something like the following:
>
> my_query_set = my_table.objects.filter(field1 = some_val and
> field2 = another_val)
>
> or
> my_query_set = my_model.objects.filter(field1 = some_val or
> fiel
Hey guys,
I am a newbie to Django, and I am having trouble. Need help! This is
the Traceback:
Environment:
Request Method: POST
Request URL: http://127.0.0.1:8000/register/
Django Version: 1.0-final-SVN-unknown
Python Version: 2.5.2
Installed Applications:
['django.contrib.auth',
'django.contr
On Wed, Oct 29, 2008 at 10:38 PM, Tsinga <[EMAIL PROTECTED]> wrote:
>
> Hey guys,
>
> I am a newbie to Django, and I am having trouble. Need help! This is
> the Traceback:
>
> Environment:
>
> Request Method: POST
> Request URL: http://127.0.0.1:8000/register/
> Django Version: 1.0-final-SVN-unkno
I am working with a new book (Learning Website Development with
Django) from Ayman Hourieh.
I am going through the application presented in that book.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" g
Masklinn wrote:
> On 29 Oct 2008, at 15:06 , Paddy Joy wrote:
>> Is there an easy way of doing this or do I need to create a custom
>> form that contains the fields of both models and then separate the
>> data in my view?
>>
>> Paddy
>
> What's wrong with creating two different Forms (one for the
Tsinga wrote:
> I am working with a new book (Learning Website Development with
> Django) from Ayman Hourieh.
> I am going through the application presented in that book.
>
If you want people who *don't* have the book to help you, you should
provide a little more information. I realise that may
On Wed, Oct 29, 2008 at 11:05 PM, Tsinga <[EMAIL PROTECTED]> wrote:
>
> I am working with a new book (Learning Website Development with
> Django) from Ayman Hourieh.
> I am going through the application presented in that book.
>
The change you are having trouble with (clean_data renamed to cleane
I searched and replaced clean_data with cleaned_data!
It's working now!
Great.. Thanks!!!
--~--~-~--~~~---~--~~
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@googl
Anyone know a good way to transform latin 1 foreign characters from
MySQL into UTF-8 for insertion into Postgres? I feel like I'm missing
something obvious.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django user
I'm converting a simple database-backed web form to Django. Each form
submit inserts a row into a database.
To avoid multiple posts inserting duplicate rows I calculate a checksum
on selected fields in the form and insert the checksum value into the
database along with the form data itself. Th
Masklinn wrote:
> On 29 Oct 2008, at 15:06 , Paddy Joy wrote:
> > Is there an easy way of doing this or do I need to create a custom
> > form that contains the fields of both models and then separate the
> > data in my view?
> >
> > Paddy
>
> What's wrong with creating two different Forms (one for
So if these built in filters are marking my strings safe, inspite of
unsafe data being passed in, should they not handle escaping as well?
Rajesh Dhawan wrote:
> On Oct 29, 8:35 am, shabda <[EMAIL PROTECTED]> wrote:
> > I need to create a custom filter which displays some data from db
> > dependi
Any one can help me out.
Thanks.
On Oct 29, 11:41 am, laspal <[EMAIL PROTECTED]> wrote:
> Hi,
> I am trying to create Excel file usingpyExceleratorbut my problem is
> I am not able
> to attach file to response.
>
> code :
> workbook = Workbook()
> worksheet = workbook.add_sheet('My Test S
86 matches
Mail list logo