Re: Dynamic OR statements

2009-01-05 Thread Ronny Haryanto
On Mon, Jan 5, 2009 at 11:59 PM, Ronny Haryanto wrote: > On Mon, Jan 5, 2009 at 11:52 PM, Bluemilkshake > wrote: >> for category in category_list: >>results = results.filter(categories__slug = category.slug) > > How about results.filter(category__in=category_li

Re: Dynamic OR statements

2009-01-05 Thread Ronny Haryanto
On Mon, Jan 5, 2009 at 11:52 PM, Bluemilkshake wrote: > for category in category_list: >results = results.filter(categories__slug = category.slug) How about results.filter(category__in=category_list)? Ronny --~--~-~--~~~---~--~~ You received this message bec

Re: Filtering parents by child attributes

2009-01-04 Thread Ronny Haryanto
On Fri, Jan 2, 2009 at 11:57 PM, Mathieu Steele wrote: > Here is an example of the data model for the type of filter I would > like to do: > > class Student > name > > class Absence > foreign key Student > date > > Is there a way to filter Students with no absences? > > somethin

model instance version numbering, or concurrent model editing

2008-12-11 Thread Ronny Haryanto
G'day all, Let say I have a wiki-like Django app. I wanted to allow many people edit a wiki page without any locking, yet have the system prevent two people saving page updates at almost the same time (one of the updates would be lost, overwritten by the other one). This is what I have in mind.

Re: missing admin documentation

2008-12-09 Thread Ronny Haryanto
On Wed, Dec 10, 2008 at 12:50 AM, aparajita <[EMAIL PROTECTED]> wrote: > I am using django release 1.0.2, nothing modified. My admin interface > works fine, but the documentation link never appears. I have > 'django.middleware.doc.XViewMiddleware' in the list of middleware, I > have my IP address

Re: How do wire Userprofile to UserAdmin ?

2008-12-09 Thread Ronny Haryanto
On Tue, Dec 9, 2008 at 8:58 PM, mahesh <[EMAIL PROTECTED]> wrote: > How do wire Userprofile to UserAdmin ? Here's one way to do it: # admin.py from django.contrib import admin from django.contrib.auth.admin import UserAdmin from django.contrib.auth.models import User from myproj.myapp.models im

Re: Development server crash with no error message

2008-12-09 Thread Ronny Haryanto
On Tue, Dec 9, 2008 at 4:50 AM, Andrew Fong <[EMAIL PROTECTED]> wrote: > > When I'm poking around in my Django app, my development server > (manage.py runserver) will sometimes quit without raising an exception > or leaving any messages. I am not tinkering around with the code or > doing anything

Re: login problem

2008-12-06 Thread Ronny Haryanto
On Sat, Dec 6, 2008 at 2:42 PM, vierda <[EMAIL PROTECTED]> wrote: > today I try to make login page with follow example code in > djangoproject (user authentication chapter), code as following below : > > def my_view(request): > username = request.POST['username'] > password = request.POST['pas

Re: Django 1.0 tutorial

2008-11-27 Thread Ronny Haryanto
On Fri, Nov 28, 2008 at 9:31 AM, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Thu, 2008-11-27 at 07:33 -0800, Benjamin Wohlwend wrote: > [...] > >> but suggesting on an official >> Django mailing list to pirate a book written by one of the Django core >> devs is stretching it a bit, don't y

Re: How to create a form with dynamic number of fields?

2008-11-18 Thread Ronny Haryanto
On Sun, Nov 16, 2008 at 12:14 PM, Low Kian Seong <[EMAIL PROTECTED]> wrote: > Could anyone here please let me know of the logic or example of doing > a form with dynamic number of fields (ie. a field with a 'Add more > field' button). I know how to do it using javascript. However it's the > logic

Re: Intercepting return from new ForeignKey popups? (RelatedObjectLookups.js)

2008-11-18 Thread Ronny Haryanto
On Sun, Nov 16, 2008 at 11:50 PM, Ben Gerdemann <[EMAIL PROTECTED]> wrote: > I've got everything working correctly except for one problem. When > adding a new foreign key by clicking on the "+" the hidden field is > correctly updated with the primary key of the new object, but the > autocomplete f

Re: Adding a "subtotal" row to the Admin change list page?

2008-11-11 Thread Ronny Haryanto
On Wed, Nov 12, 2008 at 9:39 AM, Eric <[EMAIL PROTECTED]> wrote: > Hi folks, I am using the default Admin pages for my site, and I have a > modification/customization question. > > I am wondering what the best approach would be to modify the admin > change list page so that there can be a new row

Re: Change date format in admin

2008-11-11 Thread Ronny Haryanto
On Tue, Nov 11, 2008 at 4:20 PM, Alex Rades <[EMAIL PROTECTED]> wrote: > Is there a way to do it? Here in europe we really use DD-MM- Yes. Look for DATE_FORMAT in: http://docs.djangoproject.com/en/dev/ref/settings/ See also http://code.djangoproject.com/ticket/2203 if you have USE_I18N = Tr

Re: django admin - list filter - issues with model fields having name ending in 'y'

2008-11-05 Thread Ronny Haryanto
On Wed, Nov 5, 2008 at 6:30 PM, ammo <[EMAIL PROTECTED]> wrote: > I have a 'Country' model and I have set its 'verbose_plural_name' to > 'Countries'. This displays fine in the site administration page > (earlier it showed Countrys there). Not sure if this has any relation to your problem, but sho

Re: Select only two posts from a database list and show them on a HTML page

2008-11-05 Thread Ronny Haryanto
On Wed, Nov 5, 2008 at 8:23 PM, JoeJ <[EMAIL PROTECTED]> wrote: > I would guess that this version: > messages = Message.objects.order_by('-created')[:2] > > would be more memory efficient than the: > messages = Message.objects.all() > (and then using |slice:":2" to cut out the top 2) > > a

Re: Select only two posts from a database list and show them on a HTML page

2008-11-05 Thread Ronny Haryanto
On Wed, Nov 5, 2008 at 6:34 PM, Bobo <[EMAIL PROTECTED]> wrote: > In my Django project I've on the front page a table where I wish to > load the two newest messages. Then I've a link to a message archive > where all messages are listed. > > My problem is that I don't know how to "filter" my list a

Re: change the DEBUG in settings.py base on the remoteaddr

2008-11-05 Thread Ronny Haryanto
On Wed, Nov 5, 2008 at 5:41 PM, kele <[EMAIL PROTECTED]> wrote: > > the debug flag in settings.py . > > what i want to do is to only change the DEBUG varialbe to True when > just the specific remote address( ip) to send the request . > cause i do not hope all my users can read the err msg while i

Re: Filter on multiple fields and/or multiple values...

2008-10-29 Thread Ronny Haryanto
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

Re: Limit choices by object, not model

2008-10-16 Thread Ronny Haryanto
On Fri, Oct 17, 2008 at 12:23 AM, AmanKow <[EMAIL PROTECTED]> wrote: > I need to limit choices dynamically by an object, not a class: > When adding or changing a > participation object, either in the admin or via model forms, I need > to limit the choices for cert type to those offered by the

Re: icontains case-sensitive on MySQL

2008-10-16 Thread Ronny Haryanto
On Fri, Oct 17, 2008 at 12:55 AM, AndyB <[EMAIL PROTECTED]> wrote: > I've googled and the only problems seem to be with people trying to do > case-sensite lookups. > > What could be going wrong here?: > b.filter(name__icontains='Saff') > [] b.filter(name__icontains='saff') > [] Could yo

Re: Best Practices in Implementing Mini-Content Boxes Across the Site

2008-10-13 Thread Ronny Haryanto
On Mon, Oct 13, 2008 at 3:38 PM, raeldc <[EMAIL PROTECTED]> wrote: > One of the things I'm wondering about is how to implement mini-content > boxes. It is known to Joomla as modules, in Drupal as blocks, to > others they are called widgets or side bars. In CMS systems, I can > assign a content-box

Re: Generating widget based on class type for a Custom Form

2008-10-07 Thread Ronny Haryanto
On Tue, Oct 7, 2008 at 7:31 PM, Leon Yeh | New Avenue.net <[EMAIL PROTECTED]> wrote: > Hi Ronny, terima kasih... :-) Sama-sama :-) > I am trying to generate different output for css styling purpose. > > For example for select widget I need to generate > > > and for other controls, I need to g

Re: Generating widget based on class type for a Custom Form

2008-10-06 Thread Ronny Haryanto
On Tue, Oct 7, 2008 at 7:09 AM, Leon Yeh | New Avenue.net <[EMAIL PROTECTED]> wrote: > I need to generate a different output based if it is a select input type > or it is a text field. > > This code does not work. I am trying to do something like this: > > {% for field in form %} > {% ifequal fiel

Re: DjangoCon video

2008-09-11 Thread Ronny Haryanto
On Thu, Sep 11, 2008 at 5:28 PM, Petar Marić <[EMAIL PROTECTED]> wrote: > Unfortunately I was unable to participate on DjangoCon because of my > Master thesis. Will there be a video of some/all the talks? I saw this at http://twitter.com/djangocon/statuses/917078011: "DjangoCon videos will be

Re: Newbie Question - Regex Field to deal with Feet/Inches

2008-09-04 Thread Ronny Haryanto
On Fri, Sep 5, 2008 at 1:53 AM, bkev <[EMAIL PROTECTED]> wrote: > > Ronny, > > Thank you so very much for your input; it has helped this newbie user > a great deal. The one outstanding problem I'm having here (and it's > the last field in my model...) is that I'd actually like to use a > FloatFiel

Re: name 'admin' is not defined

2008-09-02 Thread Ronny Haryanto
On Wed, Sep 3, 2008 at 12:56 AM, Weber Sites <[EMAIL PROTECTED]> wrote: > I'm trying to follow the Tutorial02 and once i uncomment the admin > lines in urls.py i get : > > ImproperlyConfigured at /mysite/ > Error while importing URLconf 'mysite.urls': name 'admin' is not defined This probably sou

Re: Newbie Question - Regex Field to deal with Feet/Inches

2008-08-30 Thread Ronny Haryanto
On Fri, Aug 29, 2008 at 2:54 AM, bkev <[EMAIL PROTECTED]> wrote: > > Ronny, > > This is fabulous...thank you so very much. If you don't mind me > asking, can you give me an example of how you implemented this method > in your Class? In my case, I've defined the field as a DecimalField > type, but

Re: About Site in django

2008-08-27 Thread Ronny Haryanto
On Thu, Aug 28, 2008 at 8:27 AM, PENPEN <[EMAIL PROTECTED]> wrote: > I have a question on the site concept. > While reading the source code, I found that there is the site related > statement in django.contrib.auth.views.login: > >if Site._meta.installed: >current_site = Site.objects.g

Re: Newbie Question - Regex Field to deal with Feet/Inches

2008-08-27 Thread Ronny Haryanto
On Wed, Aug 27, 2008 at 3:13 AM, bkev <[EMAIL PROTECTED]> wrote: > I'm working on a site that has several imperial measurements (feet and > inches) and I'd like to implement a field in my model that uses a > regular expression like: > ^(\d{1,5})\'((\s?)(-?)(\s?)([0-9]|(1[0-1]))\")?$ > to parse of

Re: Browser timeout on long processes

2008-08-20 Thread Ronny Haryanto
On Wed, Aug 20, 2008 at 4:16 PM, coulix <[EMAIL PROTECTED]> wrote: > Yes, if you can check the Restfull book from Oreilly there is a good > example on using > a queue system to submit lengthy job. You submit the work and it gives > you back an url > that you can check 'repeatedly' to see the progr

Re: How to tiger mail

2008-08-19 Thread Ronny Haryanto
2008/8/20 laspal <[EMAIL PROTECTED]>: > Can anyone give a link for doing corn job. Cron is Unix-based scheduler, it's not part of or related to Django. You most likely need to use a system external to Django to achieve what you want. One of such systems is cron. There are plenty of info regardin

Re: single list items in templates

2008-07-17 Thread Ronny Haryanto
On Thu, Jul 17, 2008 at 2:03 AM, Tim Chase <[EMAIL PROTECTED]> wrote: > >> I have a list: data = ['apple', 'orange', 'banana'] >> in my template: {{ data }} will output: ['apple', orange, banana] >> but {{ data[0] }} will throw an error > > > {{ data.0 }} should do the trick. Or {{ data|first }}.

Re: CMS application: auto-setting the post author

2008-06-16 Thread Ronny Haryanto
On Tue, Jun 17, 2008 at 9:02 AM, saxon75 <[EMAIL PROTECTED]> wrote: > I'm working on a CMS application and had a question about > automatically setting certain model fields. > > Suppose I have the following model (this is simplified from the actual > application): > > class Item(models.Model): >

Re: CMS application: auto-setting the post author

2008-06-16 Thread Ronny Haryanto
On Tue, Jun 17, 2008 at 9:02 AM, saxon75 <[EMAIL PROTECTED]> wrote: > > I'm working on a CMS application and had a question about > automatically setting certain model fields. > > Suppose I have the following model (this is simplified from the actual > application): > > class Item(models.Model): >

Re: How to handle all DoesNotExist?

2008-06-14 Thread Ronny Haryanto
On Sun, Jun 15, 2008 at 1:40 AM, Szymon <[EMAIL PROTECTED]> wrote: > What I need to import to handle DoesNotExist in process_exception? > Because DoesNotExist is part of every single model, so I can't import > it from model, because I don't know which model raises exception. from django.db import

Re: Help for strategy to load dynamic content by domain (not subdomains)

2008-06-10 Thread Ronny Haryanto
On Wed, Jun 11, 2008 at 10:00 AM, ge <[EMAIL PROTECTED]> wrote: > I have what I hope is a simple question here. I do have a working > solution, but I'd like to know if anyone has any thoughts on cleaner > or perhaps more proper way to do this. > > For simplicities sake, lets assume I am trying to

Re: load external xml and css with varibles?

2008-05-21 Thread Ronny Haryanto
On Wed, May 21, 2008 at 5:58 PM, sebey <[EMAIL PROTECTED]> wrote: > I know css does not not have any variables but I was thinking that > python/django could look though the css file and have > background-color:{{insert python varible here}} Django's templating is not restricted to HTML only. You

Re: Dynamic lookup

2008-05-17 Thread Ronny Haryanto
On Sat, May 17, 2008 at 6:11 PM, mwebs <[EMAIL PROTECTED]> wrote: > I am using something like this: > > model.objects.filter(field = variable) > > Is it possible to pass the field that is used for the lookup > dynamically, so that field is also a variable ? It's python kwargs (keyword arguments).

Re: Getting back to the same page after completing a task in another page

2008-05-11 Thread Ronny Haryanto
On Sun, May 11, 2008 at 11:55 AM, M.Ganesh <[EMAIL PROTECTED]> wrote: > I am displaying a list of records in a page. I have a link in that page > which will take me to a form for adding one more record. How do I come > back to the previous page after adding a record? If the "previous page" is alw

Re: Change password only for administrators

2008-05-07 Thread Ronny Haryanto
On Wed, May 7, 2008 at 4:21 PM, Alessandro Ronchi <[EMAIL PROTECTED]> wrote: > I want to make the change of the password possible only for administrators > and > not the whole staff. Is it possible? How I can do that? How do you currently allow staff to change password? Ronny --~--~-

Re: Access Control List

2008-05-01 Thread Ronny Haryanto
On Fri, May 2, 2008 at 10:04 AM, Rit Lim <[EMAIL PROTECTED]> wrote: > "Mary may change news stories, but only the ones she created > herself..." > > How do I go about doing that? I was told I need to write an ACL. > However, I'm not sure how to do it. > > Anyone has some sample code? The doc

Re: get for errors as string and not as HTML

2008-04-29 Thread Ronny Haryanto
On Wed, Apr 30, 2008 at 12:03 PM, Mike Chambers <[EMAIL PROTECTED]> wrote: > > Name > {{ form.user_name }} {{ form.user_name.errors }} > > Is there any way to just get the raw error string? You should be able to treat form.user_name.errors as

Re: passing form to base template

2008-04-28 Thread Ronny Haryanto
On Tue, Apr 29, 2008 at 9:33 AM, skunkwerk <[EMAIL PROTECTED]> wrote: > I've got two forms included in my base template, from which a few > others inherit. Currently I'm passing a newly-constructed form to > each of the inherited templates in the functions using > render_to_response, like so:

Re: Best practice for databases and distributed development with Django

2008-04-02 Thread Ronny Haryanto
On Thu, Apr 3, 2008 at 7:36 AM, Julien <[EMAIL PROTECTED]> wrote: > We're using SVN between several developers to work on the same project > and it's working quite well. But it's not as simple concerning the > database. > > Each of us has a local database to muck around with, and if one of us

Re: some help with urls

2008-03-31 Thread Ronny Haryanto
Try: r'^test/fullpath/(?P[\w/]+) Ronny On Mon, Mar 31, 2008 at 4:08 PM, Rishabh Manocha <[EMAIL PROTECTED]> wrote: > > Hey guys, > > I'm trying to setup my urls.py file and am having trouble getting the > args to be passed correctly to my view. I basically have something > link this: >