ON DELETE CASCADE behaviour on M2M?

2011-01-17 Thread Victor Hooi
Hi, I know that Django's default behaviour on ForeignKey is ON DELETE CASCADE (unless you set on_delete to PROTECT). However, I wasn't sure how this extended to ManyToManyFields. I've just tested with one of my own applications - I have an "Article" object, with m2m to a "Journalist" object.

Re: listpage question

2011-01-17 Thread Vovk Donets
2011/1/18 Bobby Roberts > let's say i have two simple models > > > model a > id=IntegerField... > description = CharField... > > > model b > id=IntegerField... > modelavalue=IntegerField... (a value form modela.id) > description=CharField... > > > ok in the /admin listing

listpage question

2011-01-17 Thread Bobby Roberts
let's say i have two simple models model a id=IntegerField... description = CharField... model b id=IntegerField... modelavalue=IntegerField... (a value form modela.id) description=CharField... ok in the /admin listing page for model B, how can i return modela.description for

Re: Problem with overriding the default Django admin page.

2011-01-17 Thread Mike Dewhirst
On 18/01/2011 1:59pm, Mike Dewhirst wrote: This is what I do ... in settings.py # this is the directory containing settings.py PROJECT_DIR = os.path.realpath(os.path.dirname(__file__)) # if templates are not found here look in app_name/templates TEMPLATE_DIRS = (os.path.join(PROJECT_DIR,

Re: Problem with overriding the default Django admin page.

2011-01-17 Thread Mike Dewhirst
This is what I do ... in settings.py # this is the directory containing settings.py PROJECT_DIR = os.path.realpath(os.path.dirname(__file__)) # if templates are not found here look in app_name/templates TEMPLATE_DIRS = (os.path.join(PROJECT_DIR, 'templates/'),) This makes my

Re: Problem with overriding the default Django admin page.

2011-01-17 Thread Vovk Donets
2011/1/18 Chen Xu > I did try this, and I tried again, but it still doesn't work. > Do I need to do something extra like quit the server, and restart again? By > the way I did try this too. > > Now, I am totally lost. > > Django dev server restarts itself, but sometimes you

Re: Problem with overriding the default Django admin page.

2011-01-17 Thread Chen Xu
I did try this, and I tried again, but it still doesn't work. Do I need to do something extra like quit the server, and restart again? By the way I did try this too. Now, I am totally lost. Thanks On Mon, Jan 17, 2011 at 3:17 AM, Vovk Donets wrote: > You must specify

Migrating custom view to class-based generic views ; Using staticfiles assets in CSS files?

2011-01-17 Thread Victor Hooi
Hi, I'm currently migrating one of my apps to use the new contrib.staticfiles module in Django 1.3. >From the documentation I can see there's two ways of referring to static files: http://docs.djangoproject.com/en/dev/howto/static-files/ 1. Use {{ STATIC_URL}} 2. Use {% load static %},

Re: Hyphens in Django app/project names?

2011-01-17 Thread Victor Hooi
Russ, Aha, excellent, thanks for clearing that up =). I can see you point - django-registration has a module called "registration", django-extensions has a module called "django_extensions", and django-staticfiles has one called "staticfiles". So it seems like I either go for a single-word

Re: Dates BC

2011-01-17 Thread Christophe Pettus
On Jan 17, 2011, at 2:00 PM, Ben Dembroski wrote: > I'm a relative newbie to both Python and Django, and in the middle of > my first Django project. My client is asking me to store and process > dates -- including dates BC. Unless you have a strong need to do date arithmetic on the dates, or

Dates BC

2011-01-17 Thread Ben Dembroski
Hi all, I was planning on making a formal introduction to the group when I had a chance. I'm afraid I come seek help instead. I'm a relative newbie to both Python and Django, and in the middle of my first Django project. My client is asking me to store and process dates -- including dates BC.

Using class based views to autoassign certain values?

2011-01-17 Thread Sontek
When I try to add new Attendee with a class based view I get the error matriculation_attendee.event_id may not be NULL with this code: class Event(models.Model): """ Model representing an event """ place = models.ForeignKey(Place, blank=True, null=True) slug =

Re: South introspection doesn't get registrered

2011-01-17 Thread Ian Clelland
On Mon, Jan 17, 2011 at 9:18 AM, OryBand wrote: > Hello. > > I am using a simple custom Model: > > from django.db.models import ImageField > class ImageWithThumbsField(ImageField): >    def __init__(self, verbose_name=None, name=None, width_field=None, > height_field=None,

Re: Odd problem with static files and Lighttpd

2011-01-17 Thread sdonk
Changed the permission and all works good! Thanks. On Jan 17, 1:56 pm, "Cal Leeming [Simplicity Media Ltd]" wrote: > Hi Alex, > > Have you checked to make sure that /home/osmtools/mymedia has read-able > permissions for the lighttpd user? > > Cal > > On Mon,

Applications Developer contract in Austin, TX

2011-01-17 Thread AlexLBasso
I am recruiting for a 9 month contract (with contract extension potential) for a company in North Austin. I am seeking an Applications Developer very familiar with the JavaScript toolkit. The position requires specific experience with Python, Dojo, and JQuery. In this role, you would be

Re: error CSRF token missing or incorrect on POST reciever

2011-01-17 Thread crazedpsyc
I fixed it with the not recommended method, but/so any help fixing it the other way would be appreciated -- 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

Re: override save()

2011-01-17 Thread Vovk Donets
if self.posrx is not the model field then this is the cause. *Vovk Donets* python/django developer skype: suunbeeam icq: 232490857 mail:donets.vladi...@gmail.com -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: error CSRF token missing or incorrect on POST reciever

2011-01-17 Thread crazedpsyc
Ok I did as much of that as I could. I could not return render_to_response('template.html', c) because I have a dict of other values I must send, such as the form and the results. Now I get: "Reason given for failure: No CSRF or session cookie. " probably because of that one thing --

Re: Odd problem with static files and Lighttpd

2011-01-17 Thread John Finlay
What do the lighttpd logs say? On 1/17/11 2:41 AM, sdonk wrote: Hi to everybody, I'm facing with a curious problem with Lighttpd and static files serving. Media admin is served by Lighttpd, but mymedia is not served by Lighttpd. This is a snippet of my lighttpd.conf alias.url = (

Re: error CSRF token missing or incorrect on POST reciever

2011-01-17 Thread crazedpsyc
I'll look at that article, 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@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For

Re: a chicken and egg - help please?

2011-01-17 Thread Vovk Donets
> > additional to this the categories per video need to be detailed as well > (category the video belongs to is a ManyToMany) > If i understand you correctly then If you want some aditional information to be putted on the ManyToMany relationship then u need to use "through" parametr and one more

Re: jquery problem

2011-01-17 Thread Tony Lambropoulos
When I say I am only using the table-formset page, I mean thats the only template. I am using the js file, jquery.formset.js it comes with. Sorry about my vagueness. On Mon, Jan 17, 2011 at 8:14 PM, Tony Lambropoulos wrote: > This is the project I have started with: >

Re: jquery problem

2011-01-17 Thread Tony Lambropoulos
This is the project I have started with: http://code.google.com/p/django-dynamic-formset/ I've deleted everything except the table-formset page, thats the only one I am using. This is how I have my scripts entered into the template file. ... This is the exact same format as the original

Re: jquery problem

2011-01-17 Thread Vovk Donets
2011/1/17 Tony > I did what you've recommended, I put in the jquery.js file that I used > while testing outside of django. There was still no success. Thus > far I cant get any other plugin to work beside the one it dynamic > formset one I started with. I even deleted

Re: jquery problem

2011-01-17 Thread Tony
I did what you've recommended, I put in the jquery.js file that I used while testing outside of django. There was still no success. Thus far I cant get any other plugin to work beside the one it dynamic formset one I started with. I even deleted that file temporarily to see if it was "blocking"

Fwd: PostGISAdapter error

2011-01-17 Thread Robinson B. Heath
It has been a couple of weeks without a reply. Is there somewhere else I should post this or am I on my own? Begin forwarded message: > From: "Robinson B. Heath" > Date: January 4, 2011 11:41:48 PM CST > To: django-users@googlegroups.com > Subject: PostGISAdapter

Re: [django] error CSRF token missing or incorrect on POST reciever

2011-01-17 Thread Jirka Vejrazka
Hmm, have you checked documentation [1] at all? The token is not the only thing, you need to enable a middleware too (a few things are needed basically). Cheers Jirka [1] http://docs.djangoproject.com/en/dev/ref/contrib/csrf/ -- You received this message because you are subscribed

a chicken and egg - help please?

2011-01-17 Thread MikeKJ
models are: from django.db import models from userprofile.models import Lecturer, UserProfile from django.contrib.auth.models import User from django.conf import settings from django.utils.translation import ugettext_lazy as _ from django import forms class Category(models.Model): name =

South introspection doesn't get registrered

2011-01-17 Thread OryBand
Hello. I am using a simple custom Model: from django.db.models import ImageField class ImageWithThumbsField(ImageField): def __init__(self, verbose_name=None, name=None, width_field=None, height_field=None, sizes=None, **kwargs): self.verbose_name=verbose_name self.name=name

[django] error CSRF token missing or incorrect on POST reciever

2011-01-17 Thread crazedpsyc
I tried to make a quick search box for my site-in-progress and expected it to be as simple as keeping the database updated. Unfortunately I ran into the following error as soon as I POSTed a query: [QUOTE] Forbidden (403) CSRF verification failed. Request aborted. Help Reason given for failure:

Re: override save()

2011-01-17 Thread Santiago Caracol
> Since these attributes > are "ordinary" attributes, they aren't saved to the database, so they > aren't loaded from it neither. It seems that this was the problem. Thank you. Santiago -- You received this message because you are subscribed to the Google Groups "Django users" group. To post

Re: override save()

2011-01-17 Thread bruno desthuilliers
On 17 jan, 15:36, Santiago Caracol wrote: > Sorry the formatting of the code went wrong. Here it is again: > > # > > class ContentClassifier(models.Model): > >     # >     def save(self, *args, **kwargs): >      

Re: following ManyToManyField related objects

2011-01-17 Thread Daniel Roseman
On Monday, January 17, 2011 3:33:36 PM UTC, ranadave wrote: > > Hi, > > Thanks for the reply. I am using an old version of Django so maybe they > got rid of it. > > What I have found out is that the object is found if I explicitly define a > through table. > > ie: > > zzz =

Re: following ManyToManyField related objects

2011-01-17 Thread ranadave
Hi, Thanks for the reply. I am using an old version of Django so maybe they got rid of it. What I have found out is that the object is found if I explicitly define a through table. ie: zzz = models.ManyToManyField('xxx', through = 'zzz.xxx_linked', related_name = 'xxx_of_zzz', blank =

Re: override save()

2011-01-17 Thread Daniel Roseman
On Monday, January 17, 2011 2:24:39 PM UTC, Santiago Caracol wrote: > > Hello, > > I have got a model called ContentClassifier which uses regular > expressions to classify the content of messages. It has a method > compile() that compiles an instance's regular expressions into > self.posrx.

Re: override save()

2011-01-17 Thread Santiago Caracol
Sorry the formatting of the code went wrong. Here it is again: # class ContentClassifier(models.Model): # def save(self, *args, **kwargs): self.compile() super(ContentClassifier, self).save(*args, **kwargs) #

override save()

2011-01-17 Thread Santiago Caracol
Hello, I have got a model called ContentClassifier which uses regular expressions to classify the content of messages. It has a method compile() that compiles an instance's regular expressions into self.posrx. When the classify method calls compile, i.e. when each ContentClassifier compiles its

Re: sitemap() got an unexpected keyword argument 'template_name'

2011-01-17 Thread spenoir
Thanks Shawn, thats a good solution but just seems unnecessary and the docs are misleading. adam On Jan 14, 6:51 pm, Shawn Milochik wrote: > On Jan 14, 2011, at 12:19 PM, spenoir wrote: > > > I pretty sure I've set up my sitemaps correctly but I get this error > > when I

Re: Query Set involving Model Method

2011-01-17 Thread rmschne
Much thanks to all. I could not get something like: gs=DinnerHost.objects.all().filter(complete()=True to work. probably think fingers on my side to get the nomenclature write; but I suspect not possible. While I liked the idea of computing a new field "complete" in the database which is

Re: jQuery UI Stylesheet

2011-01-17 Thread Torbjorn
Does any of the link to the static files work? Can you point your browser to: {{ STATIC_URL }}jqueryui/css/style.css (exchange STATIC_URL of course)? Can you point it to {{ STATIC_URL }}jqueryui/css/ui-lightness/jquery- ui-1.8.8.custom.css {{ STATIC_URL }}jqueryui/js/jquery-1.4.4.min.js {{

Re: django url question

2011-01-17 Thread Matias Aguirre
The '?' should be quoted as '%3F' (urllib.urlquote('?')) or it will be treated as a query parameter (check request.GET in your view ;)) Matías Excerpts from yanghq's message of Mon Jan 17 05:59:23 -0200 2011: > hi, > > In urls.py a pattern like this: > (r'^test/(?P\w{3,4})/(?P.*)$',

Re: Odd problem with static files and Lighttpd

2011-01-17 Thread Cal Leeming [Simplicity Media Ltd]
Hi Alex, Have you checked to make sure that /home/osmtools/mymedia has read-able permissions for the lighttpd user? Cal On Mon, Jan 17, 2011 at 10:41 AM, sdonk wrote: > Hi to everybody, > I'm facing with a curious problem with Lighttpd and static files > serving.

Using arbitrary queries to populate InlineModelAdmin instances

2011-01-17 Thread Dan Farina
Hello list, I have a use case where I want to show a few other objects as inline editable fields, but have been stymied by the fact that there exists no direct foreign key relationship between them. Here is an example: Outermost_Model -> Inner_Model -> Django User Model, where '->' is a foreign

Odd problem with static files and Lighttpd

2011-01-17 Thread sdonk
Hi to everybody, I'm facing with a curious problem with Lighttpd and static files serving. Media admin is served by Lighttpd, but mymedia is not served by Lighttpd. This is a snippet of my lighttpd.conf alias.url = ( "/mymedia/" => "/home/osmtools/mymedia/", "/media/" =>

django url question

2011-01-17 Thread yanghq
hi, In urls.py a pattern like this: (r'^test/(?P\w{3,4})/(?P.*)$', 'djprj.test.views.info'), In views.py,info defined as follows: def info(request,protocol='',url=''): when I access "test/http/bbs.test.com/viewforum.php?f=12" url is bbs.test.com/viewforum.php,"?f=12" is

Re: Current Django 1.3 Alpha 2 Documentation as PDF

2011-01-17 Thread Sam Walters
at the very least use mysqldump on you db or a table before you play with the code. though depending on what you are doing backup should be even more structured than ad-hoc sql dumps. http://www.thegeekstuff.com/2008/09/backup-and-restore-mysql-database-using-mysqldump/ On Mon, Jan 17, 2011 at

Re: Current Django 1.3 Alpha 2 Documentation as PDF

2011-01-17 Thread Vovk Donets
2011/1/17 ckar...@googlemail.com > Sry for the wrong url. It's now > http://g2007.ch/media/static/uploads/django.pdf > > Great work, many thanks! -- *Vovk Donets* python/django developer skype: suunbeeam icq: 232490857 mail:donets.vladi...@gmail.com www:

Re: Current Django 1.3 Alpha 2 Documentation as PDF

2011-01-17 Thread ckar...@googlemail.com
Sry for the wrong url. It's now http://g2007.ch/media/static/uploads/django.pdf On 13 Jan., 19:53, "ckar...@googlemail.com" wrote: > Better use this url:http://riesenhirni.de/media/static/uploads/django.pdf > > On 13 Jan., 19:47, "ckar...@googlemail.com"

Re: Execute code after the model with m2m is completely saved

2011-01-17 Thread Vovk Donets
2011/1/17 Martin Tiršel > I found two ways how to do it: > > *) m2m_changed signal - this is the best way > > *) save_model(self, request, obj, form, change) method for ModelAdmin - obj > has current relations, form contains the new relations > > Martin > > The third way

Re: Thinking to change my db schema

2011-01-17 Thread Dan Fairs
Hi, > The problem is with date, frequency and ends. With this info I can > know all the dates in which transactions occurs and use it to fill a > cashflow table. Doing things this way involves creating a lot of > structures(dictionaries, lists and tuples) and iterating them a lot. > Maybe there

Re: Problem with overriding the default Django admin page.

2011-01-17 Thread Vovk Donets
You must specify in the TEMPLATE_DIRS path to the dir where templates were placed, not abs path file So TEMPLATE_DIRS = ( "/Users/xuchen81/Django/mysite/", ) should work, coz' "In order to override one or more of them, first create an admin directory in your project's templates directory.

Re: Execute code after the model with m2m is completely saved

2011-01-17 Thread Martin Tiršel
I found two ways how to do it: *) m2m_changed signal - this is the best way *) save_model(self, request, obj, form, change) method for ModelAdmin - obj has current relations, form contains the new relations Martin On Sun, 16 Jan 2011 19:33:09 +0100, Martin Tiršel

Re: m2m_changed signal called multiple times?

2011-01-17 Thread Martin Tiršel
Yes, I just got it: 2011-01-17 11:57:07,389 DEBUG pre_clear 2011-01-17 11:57:07,392 DEBUG post_clear 2011-01-17 11:57:07,393 DEBUG pre_add 2011-01-17 11:57:07,395 DEBUG post_add It is the first time I am working with signals and forget about action argument :( But why is there pre_clear and

Re: m2m_changed signal called multiple times?

2011-01-17 Thread bruno desthuilliers
On 17 jan, 11:09, Martin Tiršel wrote: (snip) > m2m_changed.connect(ready_to_resize, sender=Image.size.through,   > dispatch_uid="38fy3f73") > > I am using Django admin interface. I insert 2 sizes into ImageSize and now   > I am creating new Image record. I select both

Re: urgent, undo delete

2011-01-17 Thread Vovk Donets
.delete() performs SQL DELETE command on DB so there is no "undo" to this operation. On Jan 17, 10:18 am, gintare wrote: > > Is it possible to undo model.filter( field_gte = datemin ).delete() > > if it was the action, which happened from function in views.py, by > >

m2m_changed signal called multiple times?

2011-01-17 Thread Martin Tiršel
Hello, I have: * settings.py: ... import logging logging.basicConfig( level = logging.DEBUG, format = '%(asctime)s %(levelname)s %(message)s', filename = LOG_FILE, filemode = 'w' ) * models.py: class ImageSize(models.Model): ... class Image(models.Model): size =

Re: urgent, undo delete

2011-01-17 Thread ge...@aquarianhouse.com
you should have a backup of your data in the case where is no way to get the data back On Jan 17, 10:18 am, gintare wrote: > Is it possible to undo  model.filter( field_gte = datemin ).delete() > if it was the action, which happened from function in views.py, by >

urgent, undo delete

2011-01-17 Thread gintare
Is it possible to undo model.filter( field_gte = datemin ).delete() if it was the action, which happened from function in views.py, by accidentaly uncommenting the line regards, gintare statkute -- You received this message because you are subscribed to the Google Groups "Django users" group.

Re: Problem with overriding the default Django admin page.

2011-01-17 Thread robin nanola
try this, TEMPLATE_DIRS = ( "/Users/xuchen81/Django/mysite/admin", ) look here: http://docs.djangoproject.com/en/dev/ref/settings/?from=olddocs On Mon, Jan 17, 2011 at 4:25 PM, Chen Xu wrote: > Hi, Django group: > I am floowing the tutorial 1 on Django site, which is

Problem with overriding the default Django admin page.

2011-01-17 Thread Chen Xu
Hi, Django group: I am floowing the tutorial 1 on Django site, which is a poll application I have problem with overriding the admin page I copied admin/base_site.html from (django/contrib/admin/templates) to /Users/xuchen81/Django/mysite/admin/base_site.html and add this line

Re: jquery problem

2011-01-17 Thread sureronald
Confirm the plugin's jquery version requirement. Maybe the plugin requires another jquery version On Jan 17, 8:48 am, Tony Lambropoulos wrote: > Prashanth, > This has to do with django because they work outside of django. > > On Mon, Jan 17, 2011 at 6:12 AM, Prashanth