Re: prepopulate_from

2008-08-18 Thread Jorge Vargas
On Mon, Aug 11, 2008 at 1:26 AM, Donn <[EMAIL PROTECTED]> wrote: > > On Monday, 11 August 2008 08:56:13 Oleg Oltar wrote: >> I want to use text stored in field title to generate slugs. > In the svn (> 0.96) you have to use ModelAdmin like this: > > clas Toon(models.Model): > title =

Re: prepopulate_from

2008-08-18 Thread Greg Detre
Many thanks! This was really timely and helpful. In case someone's googling, I'm 99% sure that the book Oleg is referring to is Practical Django Projects by James Bennett. It's mostly excellent, but I haven't been so far found anywhere on the Apress site that has a) a list of errata b) code

Re: InlineModelAdmin min_num ?

2008-08-18 Thread Peter of the Norse
Perhaps you’re thinking of `extra`? On Aug 13, 2008, at 9:24 PM, mike wrote: > InlineModelAdmin has max_num , shouldn't it have a min_num or am I > missing something? > > Thanks, > -Mike -- Peter of the Norse --~--~-~--~~~---~--~~ You received this message

manager select_related()

2008-08-18 Thread saeb
Sorry to ask a stupid question, but following is my basic model structure. I want to create a custom manager for a class which has a foreignKey to another class. And to call that manager function in list display to display all the related properties. Am I doing it right? I don't see any

Re: PIL 1.1.6, jpeg decoder error, going insane...

2008-08-18 Thread farastray
I had the same issue with Fedora 8, but for some reason the changes you suggest didn't work for me.. However, I did find an obscure thread where the Fredrik Lundh suggested trying yum install python-imaging, and this solved all my problems! Cheers, Christian On Jun 26, 7:01 am, sparky <[EMAIL

Re: ImageField save issues (IOError: [Errno 37] No locks available)

2008-08-18 Thread Malcolm Tredinnick
On Mon, 2008-08-18 at 17:23 -0700, wnielson wrote: > For what its worth, I did manage a work around on the NFS side. In / > etc/export you need to have the `no_subtree_check` option enabled. > Apparently this has mild security implications (as stated in man > exports), but it does allow the

Re: ImageField save issues (IOError: [Errno 37] No locks available)

2008-08-18 Thread wnielson
For what its worth, I did manage a work around on the NFS side. In / etc/export you need to have the `no_subtree_check` option enabled. Apparently this has mild security implications (as stated in man exports), but it does allow the locking to work properly. Thanks for the insight Malcolm.

Re: ImageField save issues (IOError: [Errno 37] No locks available)

2008-08-18 Thread Malcolm Tredinnick
On Mon, 2008-08-18 at 16:42 -0700, wnielson wrote: > Thanks for the quick response. Yes, I did do some searching and ran > across the post about NFS (and yes I am using an NFS mount). However, > I can solve the problem by bypassing the `save` method like so: > > from django.core.files import

Re: ImageField save issues (IOError: [Errno 37] No locks available)

2008-08-18 Thread wnielson
Thanks for the quick response. Yes, I did do some searching and ran across the post about NFS (and yes I am using an NFS mount). However, I can solve the problem by bypassing the `save` method like so: from django.core.files import File f = open('my_filename.jpg', 'w') myfile = File(f)

Re: ImageField save issues (IOError: [Errno 37] No locks available)

2008-08-18 Thread Malcolm Tredinnick
On Mon, 2008-08-18 at 16:05 -0700, wnielson wrote: > I've been running into an issue while trying to upgrade my code to use > Django's new file handling system. When I try to use the `save` > method of a `ImageField` instance, I get an `IOError: [Errno 37] No > locks available`. The file gets

Re: ifequal doesn't evaluate expressions

2008-08-18 Thread zdmytriv
> However the implementation of such a > tag would be unlikely to need much patching in the future "... patching in the future" No comments... > so Malcolm's > advice about implementing it yourself would be acceptable, I'd have thought. No comments... Zinovii

ImageField save issues (IOError: [Errno 37] No locks available)

2008-08-18 Thread wnielson
I've been running into an issue while trying to upgrade my code to use Django's new file handling system. When I try to use the `save` method of a `ImageField` instance, I get an `IOError: [Errno 37] No locks available`. The file gets created but nothing is ever written to it. Here is a basic

Re: ifequal doesn't evaluate expressions

2008-08-18 Thread Steve Holden
zdmytriv wrote: > 2 Steve: > > >> That's no way to endear yourself to the Django community. The >> development team has some pretty good brains. >> > > I agree, I was too aggressive, sorry about that. Just can't believe > that bug like this can be on this level. > I'd argue that it

Re: ifequal doesn't evaluate expressions

2008-08-18 Thread zdmytriv
> That's one good reason why it's not needed in core. If you need it and > you understand the trade-offs and consequences, you can implement it > immediately with no break in the flow. Django's supported third-party > template tags since day 1 (and even earlier). :-) It's always bad idea to

Re: How to set can_delete to TabularInline

2008-08-18 Thread Marinho Brandao
ok, found here: http://code.djangoproject.com/browser/django/trunk/django/contrib/admin/options.py#L755 2008/8/18 Marinho Brandao <[EMAIL PROTECTED]>: > Hi all, > > (talking about Admin) > > somebody knows how to set a can_delete=True to a TabularInline-based class? > > looking into the code, I

How to set can_delete to TabularInline

2008-08-18 Thread Marinho Brandao
Hi all, (talking about Admin) somebody knows how to set a can_delete=True to a TabularInline-based class? looking into the code, I see the inline formsets are created in ModeAdmin.add_view and ModeAdmin.change_view, and not found a way to do that with no hack into them to set can_delete

Re: ifequal doesn't evaluate expressions

2008-08-18 Thread zdmytriv
2 Steve: > That's no way to endear yourself to the Django community. The > development team has some pretty good brains. I agree, I was too aggressive, sorry about that. Just can't believe that bug like this can be on this level. > > What about ifless? Is it going to be implemented in 1.0

Re: ifequal doesn't evaluate expressions

2008-08-18 Thread Malcolm Tredinnick
On Mon, 2008-08-18 at 13:37 -0700, zdmytriv wrote: > 2 Malcolm: > > > It makes a lot of sense when you think about what they can apply to. > > Equality is a natural operation for all sorts of object types. The > "less > > than" comparison only applies to things that have a natural > ordering. >

Re: ifequal doesn't evaluate expressions

2008-08-18 Thread zdmytriv
2 Malcolm: > It makes a lot of sense when you think about what they can apply to. > Equality is a natural operation for all sorts of object types. The "less > than" comparison only applies to things that have a natural ordering. > The first set is much larger than the second. > A normal use for

Re: inline model with FilePathField

2008-08-18 Thread tosh
On Aug 18, 2:09 pm, tosh <[EMAIL PROTECTED]> wrote: > maybe i'm missing something obvious but it seems that if i have an > inline model that uses the FilePathField a new object is added on > every save. > > simple example > > models: > class Video(models.Model): > title = models.CharField()

Re: lighttpd +fastcgi

2008-08-18 Thread Gonzalo Almeida
wow that was easy, thanks you very much malcolm Gon -- Linux user #466939 --~--~-~--~~~---~--~~ 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

FormWizard Problems

2008-08-18 Thread ocgstyles
I'm experiencing some strange behavior with the Form Wizard. During testing, sometimes I'll get to the last step, click Finish, and I'll get another form with no fields and finish button turns back into a next button. Its set up like this: # urls.py (r'^application/$', MyWizard([Appl1, Appl2,

Re: ImportError: cannot import name parse_lookup

2008-08-18 Thread Nicolas Couture
Using django-tagging r133 fixed the problem. Thank you! On Aug 18, 3:54 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Mon, 2008-08-18 at 12:33 -0700,NicolasCouturewrote: > > [...] > >     signals.post_save.connect(self._save, cls, True) > > AttributeError: 'object' object has no

Re: lighttpd +fastcgi

2008-08-18 Thread Malcolm Tredinnick
On Mon, 2008-08-18 at 16:47 -0300, Gonzalo Almeida wrote: > hello, > I have a problem with lighttpd + fastcgi, > I used have the newforms-admin branch and everything worked fine. > but when I started using the trunk version, the problems appeared. > when I access http://localhost/admin/, I try

Re: ImportError: cannot import name parse_lookup

2008-08-18 Thread Malcolm Tredinnick
On Mon, 2008-08-18 at 12:33 -0700, Nicolas Couture wrote: > [...] > signals.post_save.connect(self._save, cls, True) > AttributeError: 'object' object has no attribute 'connect' > > I am using django r7966. > > Would anyone be able to provide more input as to why this is breaking?

Workflow Building with NewForms, ModelForm

2008-08-18 Thread DoctorMO
Hello All, This is just a quick FYI to state what I'm currently working on and see if anyone has anything to add or good ideas (or even criticisms) Since django can do model forms which reflect a models fields and save the created object appropriately. I'm researching the possibility of

lighttpd +fastcgi

2008-08-18 Thread Gonzalo Almeida
hello, I have a problem with lighttpd + fastcgi, I used have the newforms-admin branch and everything worked fine. but when I started using the trunk version, the problems appeared. when I access http://localhost/admin/, I try to loggin in the admin. and it redirect me to

Re: ImportError: cannot import name parse_lookup

2008-08-18 Thread Nicolas Couture
On Jul 21, 2:25 pm, Fernando Rodríguez <[EMAIL PROTECTED]> wrote: > Hi, > > I'm implementing the coltrane blog app in "Practical Django Projects" > and when I try to syncdb I get this error and traceback. > > I'm using version 0.97 downloaded from svn. > > Any ideas? O:-) > > PS Here's the

inline model with FilePathField

2008-08-18 Thread tosh
maybe i'm missing something obvious but it seems that if i have an inline model that uses the FilePathField a new object is added on every save. simple example models: class Video(models.Model): title = models.CharField() filepath = models.FilePathField(path="/path") class

Re: Trouble with regex

2008-08-18 Thread Fernando Rodríguez
El lun, 18-08-2008 a las 13:10 -0500, Malcolm Tredinnick escribió: > It looks like you might be making an assumption that the patterns are > concatenated. This isn't correct. > > The patterns in resume_templates.urls will be applied to the suffixes of > the URLs matching resumes (after the

Re: Trouble with regex

2008-08-18 Thread Malcolm Tredinnick
On Mon, 2008-08-18 at 20:04 +0200, Fernando Rodríguez wrote: > El lun, 18-08-2008 a las 12:49 -0500, Norman Harman escribió: > > > > > I'm fairly certain the space indicates an urls came from an "include". > > The spaces are not really part of regex. > > OK > > > > > > In latter case

Re: Trouble with regex

2008-08-18 Thread Fernando Rodríguez
El lun, 18-08-2008 a las 10:35 -0700, Rajesh Dhawan escribió: > > You need to remove replace /jss/ there with jss/: > > (r'jss/(?P[-\w]+)/$', jss_list), > Ouch! O:-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: Trouble with regex

2008-08-18 Thread Fernando Rodríguez
El lun, 18-08-2008 a las 12:49 -0500, Norman Harman escribió: > > I'm fairly certain the space indicates an urls came from an "include". > The spaces are not really part of regex. OK > > In latter case career would be word > > > Your urls should be like this: >(r'^(?P[-\w]+)/$',

Re: Trouble with regex

2008-08-18 Thread Norman Harman
Fernando Rodríguez wrote: > Hi, > > I have the following regexes on my django app urls.py: > > urlpatterns = patterns('', > ># List of all resumes for a given Career >(r'(?P[-\w]+)/$', career_list), >

Re: how to display date nicely

2008-08-18 Thread Rajesh Dhawan
On Aug 18, 7:20 am, Will Rocisky <[EMAIL PROTECTED]> wrote: > actually I have to do it in views, not template > I need some pure python code Django's default filters are written in pure Python ;) You can just call the django.template.defaultfilters.date() method directly in your view -- just

Re: Trouble with regex

2008-08-18 Thread Rajesh Dhawan
Hi Fernando, > I have the following regexes on my django app urls.py: > > urlpatterns = patterns('', > ># List of all resumes for a given Career >(r'(?P[-\w]+)/$', career_list), > ># List of all resumes for a given jss >

Re: dynamic creation of model with geodjango ?

2008-08-18 Thread springmeyer
Guillame, Absolutely. GeoDjango can be used to read new or existing geographic datasources from dozens of formats. GeoDjango provides a ctypes interface to the foundational GDAL/OGR library, which is the open source industry standard for format translation. Look for the utility called

Re: modelforms: getting field object in clean_ method

2008-08-18 Thread Steve Holden
Aljosa Mohorovic wrote: > On Aug 18, 5:13 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> > wrote: >> "2 or more fields" is a signal that the clean() method on the form is >> the right place to do this. At that point, all the fields will have >> individually passed their validation (i.e. they will be

Re: Serving static content using Apache

2008-08-18 Thread Steve Holden
djandrow wrote: > Managed to get it working, thanks everyone. > > I guess the problem was CSS was missing from locationMatch > --~--~-~--~~~---~--~~ Good news. For what it's worth, when I am serving static content I tend to set whole directories to be served

Trouble with regex

2008-08-18 Thread Fernando Rodríguez
Hi, I have the following regexes on my django app urls.py: urlpatterns = patterns('', # List of all resumes for a given Career (r'(?P[-\w]+)/$', career_list), # List of all

Re: modelforms: getting field object in clean_ method

2008-08-18 Thread Aljosa Mohorovic
On Aug 18, 5:13 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > "2 or more fields" is a signal that the clean() method on the form is > the right place to do this. At that point, all the fields will have > individually passed their validation (i.e. they will be of the right > type) and any

Re: Get and set encryption in Model Forms

2008-08-18 Thread simong
On Aug 11, 1:42 am, jonknee <[EMAIL PROTECTED]> wrote: > On Aug 10, 11:29 am, simong <[EMAIL PROTECTED]> wrote: > > > The code executes correctly and writes the record to the database but > > doesn't encrypt the credit card number. > > You're not following the snippet you linked to, the view code

I posted a new template tag for forever-caching resources...

2008-08-18 Thread Jon Brisbin
...at djangosnippets: http://www.djangosnippets.org/snippets/991/ I wanted to be able to use the forever-caching capability of Google Web Toolkit with my own resources, so I wrote this template tag to handle any resource. If the file you want cacheable is a JS or CSS file, it will

Re: Model relationships

2008-08-18 Thread [EMAIL PROTECTED]
Thanks for your reply Malcolm. I'll take a look at related fields. --~--~-~--~~~---~--~~ 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

Re: modelforms: getting field object in clean_ method

2008-08-18 Thread Malcolm Tredinnick
On Mon, 2008-08-18 at 08:05 -0700, Aljosa Mohorovic wrote: > i currently use self.instance but i'm not sure if i can do that since > i didn't find an example using it in docs. There are a few parts of model forms that aren't (re-)documented in the docs. Reading the code and docstrings is a good

Re: Model relationships

2008-08-18 Thread Malcolm Tredinnick
On Mon, 2008-08-18 at 05:36 -0700, [EMAIL PROTECTED] wrote: > Incase my question wasn't clear enough, as I had trouble describing > it ... > > Can a different model access the manytomany table that django makes ? No, but you're probably thinking about this on the wrong level. Think about it in

Re: modelforms: getting field object in clean_ method

2008-08-18 Thread Aljosa Mohorovic
i currently use self.instance but i'm not sure if i can do that since i didn't find an example using it in docs. also, i'm looking for clean method example where i can raise validation errors for 2 or more fields based on single validation. something like: if custom_validation() == False: #

modelforms: getting field object in clean_ method

2008-08-18 Thread Aljosa Mohorovic
if i have a MainModel: class MainModel(models.Model): [...] mymodel = models.ForeignKey(MyModel) and MainModelForm: class MainModelForm(forms.ModelForm): def clean_somefield(self): # here i need to get mymodel for current form to validate something somewhere in views i have:

Re: Generic Views and ModelAdmin: too much code?

2008-08-18 Thread fabio natali
Dear Ivan, your help is priceless, thanks! Ivan Sagalaev wrote: [...] > In models.py you can get rid of repeating "Manufacturer" two extra times > by doing: > > class Manufacturer(models.Model): > name = models.CharField(max_length=30) > address =

Re: looping around lists

2008-08-18 Thread Tim Chase
> This problem's kinda hard to explain, but I'll try my best. I've got a > list variable : notes_list which looks like: {'note 1', 'note2' etc..} > > I'm using this variable within a forloop and I want it to cycle based > on the number of loop (notes_list.0 for the first loop, notes_list.1 > for

looping around lists

2008-08-18 Thread iceanfire
Hey, This problem's kinda hard to explain, but I'll try my best. I've got a list variable : notes_list which looks like: {'note 1', 'note2' etc..} I'm using this variable within a forloop and I want it to cycle based on the number of loop (notes_list.0 for the first loop, notes_list.1 for the

Re: ManyToManyField contains

2008-08-18 Thread [EMAIL PROTECTED]
It is returning a queryset. Check your code to make sure you're not converting it to a list or anything and check your models/managers to make sure you're not overriding stuff there. In the future, you can do this: MyUser = User.objects.get(username='thisUsername') theQuery =

Re: Model relationships

2008-08-18 Thread [EMAIL PROTECTED]
Incase my question wasn't clear enough, as I had trouble describing it ... Can a different model access the manytomany table that django makes ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group.

Re: ManyToManyField contains

2008-08-18 Thread Robert
Ah yes, I know this. For some reason, however, user.class_set.all() doesn't seem to be returning a queryset (I need to be using a queryset so I can feed it into a modelChoiceField). Is there any way that I can turn class_set.all() into a queryset? On Aug 18, 6:14 am, "Todd O'Bryan" <[EMAIL

Re: how to display date nicely

2008-08-18 Thread James Bennett
2008/8/18 Will Rocisky <[EMAIL PROTECTED]>: > actually I have to do it in views, not template > I need some pure python code All Python datetime objects support the 'strftime' method, which is what you want to use. Consult Python's documentation for the full details. -- "Bureaucrat Conrad,

BooleanField and RadioSelect

2008-08-18 Thread Pong
Hi, I try to use BooleanField with RadioSelect widget to get input option like this: Publish article: (o) Yes, publish now ( ) No, save changes and publish later I specify my BooleanField like this: CHOICES = ((True, "Yes, publish now"), (False, ("No, save changes and

Re: how to display date nicely

2008-08-18 Thread Will Rocisky
actually I have to do it in views, not template I need some pure python code On Aug 18, 5:14 pm, Jarek Zgoda <[EMAIL PROTECTED]> wrote: > Wiadomość napisana w dniu 2008-08-18, o godz. 13:08, przez Will Rocisky: > > > I have a datetime object '2008-15-06 11:12:13' > > I want to display it like

Re: Admin mass change screen

2008-08-18 Thread AndyB
I'm happily using this snippet that could be used for editing any column on the change list page: http://www.djangosnippets.org/snippets/568/ On Aug 17, 8:28 am, Donn <[EMAIL PROTECTED]> wrote: > Hi, > I have a model that I'd like to edit in a way that I can get to some of the > members going

Re: how to display date nicely

2008-08-18 Thread Dmitry Dzhus
Will Rocisky wrote: > I have a datetime object '2008-15-06 11:12:13' > I want to display it like 'June 6, 2008 at 11:12' {{ some_datevalue_object|date:"F j, Y at H:i" }} -- Happy Hacking. http://sphinx.net.ru む --~--~-~--~~~---~--~~ You received this message

Re: how to display date nicely

2008-08-18 Thread Jarek Zgoda
Wiadomość napisana w dniu 2008-08-18, o godz. 13:08, przez Will Rocisky: > I have a datetime object '2008-15-06 11:12:13' > I want to display it like 'June 6, 2008 at 11:12' You have to format it using strftime() or in template using built-in "date" filter. See

Re: how to display date nicely

2008-08-18 Thread Daniel Roseman
On Aug 18, 12:08 pm, Will Rocisky <[EMAIL PROTECTED]> wrote: > I have a datetime object '2008-15-06 11:12:13' > I want to display it like 'June 6, 2008 at 11:12' http://www.djangoproject.com/documentation/templates/#date -- DR --~--~-~--~~~---~--~~ You received

how to display date nicely

2008-08-18 Thread Will Rocisky
I have a datetime object '2008-15-06 11:12:13' I want to display it like 'June 6, 2008 at 11:12' --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Serving static content using Apache

2008-08-18 Thread djandrow
Managed to get it working, thanks everyone. I guess the problem was CSS was missing from locationMatch --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Serving static content using Apache

2008-08-18 Thread djandrow
I've added this, #css has been added to the end SetHandler None but still no luck, however if i look at the pages statically on the server rather than having apache serve them the CSS is used so now I know that the CSS works and i guess its in the right place, although the relative and

Re: ManyToManyField contains

2008-08-18 Thread Todd O'Bryan
I seem to keep making this mistake, even though I know better. contains only works for strings. In other words, it checks to see if a string field contains the substring you provide. You want to use the reverse relationship from the user, rather than a query: myUser =

Re: Admin mass change screen

2008-08-18 Thread Donn
On Monday, 18 August 2008 09:39:12 Matthias Kestenholz wrote: > But maybe I've got something for you if you want to reorder > items using a drag-n-drop interface. Thanks for that. I will go and look when I have a chance. \d --~--~-~--~~~---~--~~ You received this

Re: Customizing the error page

2008-08-18 Thread Gregor Müllegger
The django-command-extensions manipulate the debug page to add an interactive console. They provide a new management command for that: "runserver_plus" Maybe you can get some know-how from them:

Re: Admin mass change screen

2008-08-18 Thread Matthias Kestenholz
Hi, I don't know about the mass change screen, haven't thought too much about that yet. But maybe I've got something for you if you want to reorder items using a drag-n-drop interface. On Sun, Aug 17, 2008 at 8:38 PM, varikin <[EMAIL PROTECTED]> wrote: > > I am looking to do something very

Re: Admin mass change screen

2008-08-18 Thread Donn
On Sunday, 17 August 2008 20:38:06 varikin wrote: > I am planning on using jquery sort to reorder them > by dragging them on the change list. Cool, if you get that right, I'd like to hear about it! \d --~--~-~--~~~---~--~~ You received this message because you