Re: Admin: Hiding fields from certain user groups

2007-06-15 Thread Bryan Chow
We have done this before by creating a second model with a different fields definition in the Admin class, and then assigning the model to the same database table by specifying db_table in the Meta class. This allowed us to specify separate access permissions on each model, even though both models

Re: Case insensitive urls

2007-06-02 Thread Bryan Chow
URLs should be unambiguous, i.e any logical piece of content should have one and only one definitive URL, with any alternatives acting as a permanent redirect. http://simonwillison.net/2007/Feb/4/urls/ Therefore, rather than configuring urls.py to ignore case, a better solution would be to use mo

Re: Admin section: Possible to integrate image manipulation?

2006-08-21 Thread Bryan Chow
Hi Sean, Well, the main advantage is that PhotoField has already been written :) If PhotoField doesn't provide you with what you need, you could easily modify it, or use it as an example of how to create a custom field. Also, _post_save() has been deprecated since M-R was merged [1]. Regarding

Re: Creating a "mostly static" site with Django -- dumb idea?

2006-08-21 Thread Bryan Chow
Hi Sean, No worries, glad to hear that you find TemplatePages useful :) To answer your question, you can write a custom inclusion tag to insert snippets of dynamic content into your templates. http://www.djangoproject.com/documentation/templates_python/#inclusion-tags Alternately, you could use

Re: Creating a "mostly static" site with Django -- dumb idea?

2006-08-21 Thread Bryan Chow
Cool! Glad to have helped. Cheers, Bryan On 8/21/06, Derek Hoy <[EMAIL PROTECTED]> wrote: > Just put this up on a site I'm moving from static pages to Django, and > it's just what I needed- I'd been doing something horrible with > subdomains to get it working, and been thinking of doing somethi

Re: Admin section: Possible to integrate image manipulation?

2006-08-21 Thread Bryan Chow
On 8/21/06, Sean Schertell <[EMAIL PROTECTED]> wrote: > ... I need my client to be able to upload some images in > the admin section, then have Python do some resizing > and cropping behind the scenes ... Take a look at PhotoField. Sounds like it would provide exactly what you're looking for. ht

Re: Interacting with models from the CLI

2006-08-19 Thread Bryan Chow
See: http://groups.google.com/group/django-users/browse_thread/thread/51827a2a40e5262e Bryan :) On 8/19/06, Jon Atkinson <[EMAIL PROTECTED]> wrote: > Hi, > > I need to schedule some operations on my database to happen at a > certain time each day. I'm tackling this by using cron, so ideally I'

Re: Override value on save in admin

2006-08-17 Thread Bryan Chow
This was brought up a couple days ago: http://groups.google.com/group/django-users/browse_thread/thread/ca7091de1e961dff On 8/17/06, fyl <[EMAIL PROTECTED]> wrote: > Just entering data in the admin interface. I want to stuck the current > user in a field at save time if nothing has been specifie

Re: Django neophyte question.

2006-08-15 Thread Bryan Chow
On 8/14/06, Jeremy Dunck <[EMAIL PROTECTED]> wrote: > Heheh. Welcome indeed. 10 helpful answers in under 20 minutes. ;-) Impressive, but credit should also be given to Google Groups' laggy updates, resulting in 9 out of 10 helpful answerers (including me) being totally oblivious to the fact th

Re: getting and storing favicon.ico as an image

2006-08-15 Thread Bryan Chow
Look into Python's urllib and httplib. http://docs.python.org/lib/lib.html a wrote: > /favicon.ico > > i want to get the favicon.ico from the URL when a blog is added to the > aggregator > > and then display the image, > this is the usage scenario > > Please let me know how to do this in python

Re: Creating a "mostly static" site with Django -- dumb idea?

2006-08-15 Thread Bryan Chow
On 8/15/06, Sean Schertell <[EMAIL PROTECTED]> wrote: > Wow! Ask and ye shall receive! > > TemplatePages is *precisely* what I was looking for :-) > > I can't wait to get to the office and try it out. Yay! > > Sean Cool. Please let us know how it works out for you. Bryan :) --~--~-~--

Re: Creating a "mostly static" site with Django -- dumb idea?

2006-08-15 Thread Bryan Chow
On 8/15/06, Sean Schertell <[EMAIL PROTECTED]> wrote: > I'd really like to use Django templates and stay DRY by using the > same base template for my static pages as I do for any apps in the > site. On 8/15/06, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > ... you just need an easy way to serve

Re: Compress images on upload?

2006-08-15 Thread Bryan Chow
On 8/13/06, Jay Parlar <[EMAIL PROTECTED]> wrote: > > http://www.verdjn.com/wiki/PhotoField > > Beautiful, now it's worth my time ;-) > > Seriously, thanks a lot. > Jay P You're welcome, Jay! Please drop us a line and let us know if you have any questions, comments, or suggestions about the cod

Re: creating a super user

2006-08-14 Thread Bryan Chow
Hi Yun, Make sure that 'django.contrib.admin' is in INSTALLED_APPS in your project's settings.py file. Hope this helps. Bryan On 8/14/06, yun <[EMAIL PROTECTED]> wrote: > I'm currently working through the tutorial using the lastest > development verison of django, downloaded from subversion.

Re: Django neophyte question.

2006-08-14 Thread Bryan Chow
Hi Gloria, For the Django development server to be accessible externally, you must specify the IP address or 0.0.0.0, e.g. manage.py runserver 0.0.0.0: Hope this helps. Bryan On 8/14/06, Gloria <[EMAIL PROTECTED]> wrote: > Hi. I am a Python geek who has been in the CherryPy/PythonPaste w

Re: Can i have a field to be set as current user id automatically in admin ?

2006-08-14 Thread Bryan Chow
I believe that this is currently not supported in admin. Some users have worked around this limitation by stashing the User object in thread local storage. http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser http://lukeplant.me.uk/blog.php?id=1107301634 Bryan On 8/14/06, yi huang

Re: DateField(blank=True), null?

2006-08-13 Thread Bryan Chow
Hi Ray, You can set null=True on your DateField to allow null values in the database. Foe example: thedate = models.DateField(null=True, blank=True) Cheers, Bryan On 8/13/06, Rares Vernica <[EMAIL PROTECTED]> wrote: > Hi, > > I have a DateField with blank=True and after I complete and sub

Re: Size of text field in admin

2006-08-13 Thread Bryan Chow
On 8/13/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Currently, in the admin interface, the size of a text field is > defaulted at 50 for char vars and 10 for integer types. > > I would like to change this in the model and have it propegate through > to the admin interface. Is there a way t

Re: Compress images on upload?

2006-08-13 Thread Bryan Chow
Optional parameter for JPEG quality added :) http://www.verdjn.com/wiki/PhotoField On 8/12/06, Bryan Chow <[EMAIL PROTECTED]> wrote: > Hi Jay, > > Here's a custom field that automatically resizes the uploaded image > using PIL. You should be able to modify save_fi

Re: Getting properties of parent objects into a template

2006-08-13 Thread Bryan Chow
Hi David, Not sure what you mean by "parent object". If author is a ForeignKey in your blog_entry model, and author has a field called full_name, then you should be able to use {{ blog_entry.author.full_name }}. Otherwise, you could just place author in the context that's passed to your template

Re: Installing

2006-08-12 Thread Bryan Chow
More information please. What steps have you taken to install Django? Have you read the installation guide? There are some tips for installing Django on Windows in the comments. http://www.djangoproject.com/documentation/install/ Bryan On 8/12/06, Dennis <[EMAIL PROTECTED]> wrote: > hello to a

Re: Compress images on upload?

2006-08-12 Thread Bryan Chow
Hi Jay, Here's a custom field that automatically resizes the uploaded image using PIL. You should be able to modify save_file() to adjust the JPEG compression level on pil_obj.save() In fact we might add this as an optional parameter in the next version. http://www.verdjn.com/wiki/PhotoField B

Re: access MEDIA_URL in templates

2006-08-12 Thread Bryan Chow
+1 for James' excellent tutorial. Here's the context processor that I use in most of my projects: http://www.verdjn.com/wiki/Siteroot http://www.verdjn.com/browser/verdjnlib/context_processors/__init__.py --~--~-~--~~~---~--~~ You received this message because you

Re: stripogram as middleware or templatetag

2006-08-11 Thread Bryan Chow
What exactly are you trying to achieve with Strip-o-Gram? Have you considered using Django's built-in STRIPTAGS or REMOVETAGS filters instead? http://www.djangoproject.com/documentation/templates/#removetags Bryan On 8/11/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi All, > > I though

Re: imbricated tags

2006-08-11 Thread Bryan Chow
Hi Olivier, What is the error message? You're missing a % in line 9. Bryan. On 8/11/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I just tried two loops "for" imbricated, it does'nt seems to work. It > gives an error at the second "endfor" when we use "forloop.first" > between the two. >

Re: admin interface

2006-08-09 Thread Bryan Chow
On 8/9/06, a <[EMAIL PROTECTED]> wrote: > i like the admin interface and want to modify it for my needs, do you > have pointers on how to go about it On 8/9/06, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > apart from cosmetic stuff which is explained in the relevant doc, it > is easier to roll

Re: How can i modify default add method for a model?

2006-08-08 Thread Bryan Chow
Not sure I understand exactly what you're looking for, but have you looked at the manipulators documentation? http://www.djangoproject.com/documentation/forms/ Bryan On 8/8/06, ElGranAzul <[EMAIL PROTECTED]> wrote: > Hi all... > > I'm very newbie to django and python, and i'm testing it. > > I

Re: Off Topic: Why does IE hate me?

2006-08-03 Thread Bryan Chow
This should get you started. The following styles override your styles (i.e. you can just paste them at the bottom of your CSS file.) #allcontent { width: 780px; } #header { margin: 10px 0; } #main { float: left; width: 545px; margin: 0 0 10px 0; } #sidebar { float: right; width: 170px;

Re: One-One relationship

2006-06-30 Thread Bryan Chow
You can import User from django.contrib.auth.models The save method of the Person class needs to create a User object programatically, e.g. User.objects.create_user(username, email, password) Then you can call super(Person, self).save() This should give you enough to figure out the rest, but if

Re: One-One relationship

2006-06-29 Thread Bryan Chow
1. Override the save() method in your person class to create a user object if one does not yet exist. 2. Try "True" with a capital T. 3. Should be solved by point 1. Hope this helps :) Bryan --~--~-~--~~~---~--~~ You received this message because you are subsc

Re: mailing list management

2006-06-28 Thread Bryan Chow
Kinda. We have been using a developed-from-scratch mailing list system using Django. Web management interface plus support for email commands using procmail into Python scripts. Still a work in progress but it's in production. Pretty simple stuff. Bryan --~--~-~--~~~

Re: How to extend Django template objects?

2006-04-20 Thread Bryan Chow
Hi Adrian, Thanks for the reply, and for the suggestion. I've been working with Ian Clelland, who submitted this patch a few days ago to address the issue: http://code.djangoproject.com/ticket/1650 There is definitely lots of interest over here for this functionality to become part of Django, a

How to extend Django template objects?

2006-04-14 Thread Bryan Chow
Is there a "correct" way to extend a Django template that doesn't exist on the filesystem? I couldn't find any mention of this in the documentation. I'm creating template objects programmatically, and I want one of these objects to extend another, just as a template on the filesystem can {% exten

Re: extend User in m-r

2006-04-06 Thread Bryan Chow
You can extend the user model in m-r using a ForeignKey with edit_inline, num_in_admin=1, max_num_in_admin=1, and unique=True. This is what my dev team uses to add additional fields to users. Conceptually, a OneToOneField would probably make more sense, but it seems that OneToOneField is still be

Re: Admin in mr

2006-04-02 Thread Bryan Chow
verbose_name is not required. Are you using the latest revision of m-r? --~--~-~--~~~---~--~~ 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 uns