Re: Query with GeoDjango

2012-06-30 Thread Ethan Jucovy
On Sat, Jun 30, 2012 at 8:31 PM, Odagi wrote: > It's working! Thanks a lot. > Is There a problem with mixing regular models fields with geomodels ones? > No, there's no problem, as long as you remember to use a GeoManager on every model that ever does geospatial queries

Re: Query with GeoDjango

2012-06-30 Thread Ethan Jucovy
On Sat, Jun 30, 2012 at 8:19 PM, Nikolas Stevenson-Molnar < nik.mol...@consbio.org> wrote: > Try a double underscore between distance and lte. > The single underscore is correct: https://docs.djangoproject.com/en/dev/ref/contrib/gis/geoquerysets/#distance-lte But, you need to use a `objects =

Re: Is GeoDjango Too Much For This?

2012-03-02 Thread Ethan Jucovy
On Mon, Feb 27, 2012 at 11:42 PM, DF wrote: > I'm on a Mac. The Django GeoDjango installation instructions are > somewhat obtuse and there aren't alternative sites I've found with > more straightforward instructions. It's lame that these are confusing > but, well, they

Re: Is GeoDjango Too Much For This?

2012-02-27 Thread Ethan Jucovy
On Sat, Feb 25, 2012 at 7:50 PM, DF wrote: > GeoDjango though, to be honest, sounds frightening and extremely > advanced. I've been reviewing the installation requirements and, at > least according to how these were written, is intense and ripe for > many errors. What

Re: Is GeoDjango Too Much For This?

2012-02-25 Thread Ethan Jucovy
Whoops, quick correction: On Sat, Feb 25, 2012 at 5:03 PM, Ethan Jucovy <ethan.juc...@gmail.com>wrote: > * You'll want to add a line ``objects = GeoManager`` on each model that > you will want to perform geospatial queries against. > That should be ``objects = GeoManager()``

Re: Is GeoDjango Too Much For This?

2012-02-25 Thread Ethan Jucovy
Others have answered your other questions well, so just addressing this one: On Thu, Feb 23, 2012 at 8:13 PM, DF wrote: > Essentially, I'm looking to see what benefits GeoDjango would give > this project over using just the Google Maps API. If I've already > started a

Re: ANN: django-kolibri - a concept for Asynchronous Processors/Workflow management for django.

2011-06-22 Thread Ethan Jucovy
On Tue, Jun 21, 2011 at 5:09 PM, Thomas Weholt wrote: > Proof of concept. Need comments. Released under a modified BSD-license. > > http://pypi.python.org/pypi/Kolibri/0.1.0a > > or better > > https://bitbucket.org/weholt/django-kolibri > > There's a blogpost with two

Re: When to use a model property vs. method?

2011-06-18 Thread Ethan Jucovy
On Sat, Jun 18, 2011 at 10:01 AM, Masklinn <maskl...@masklinn.net> wrote: > On 2011-06-18, at 15:05 , Ethan Jucovy wrote: > > I tend to avoid @property -- it adds conceptual overhead for code > > readers (hiding the fact that a function call is taking place) for littl

Re: When to use a model property vs. method?

2011-06-18 Thread Ethan Jucovy
On Thu, Jun 16, 2011 at 2:07 PM, Micky Hulse wrote: > Hello, > > Just curious what the rule-of-thumb is for when it comes to using > model methods vs. properties. For example: > > [code] > > @property > def is_modified(self): >if self.modified > self.created: >

Re: ANN: django-supervisor: easy integration between django and supervisord

2011-06-08 Thread Ethan Jucovy
This is really excellent - thanks for releasing it. -Ethan On Tue, Jun 7, 2011 at 10:51 PM, Ryan Kelly wrote: > > Hi All, > > > I've just released a little experiment in combining the process > management awesomeness of supervisord with the convenience of Django's > management

Re: Get child model class

2011-05-06 Thread Ethan Jucovy
Is your CF base class an abstract base class[1]? If it's not, then your database actually has separate tables for CF, CFI and CFT .. and when you access a `doc.cf` you're really getting the CF model instance, *not* the derived class instance. IIRC if you make CF an abstract base class then this

Re: Adding custom filter to stand-alone template

2011-05-04 Thread Ethan Jucovy
On Wed, May 4, 2011 at 7:19 PM, Ethan Jucovy <ethan.juc...@gmail.com> wrote: > This also feels a little hacky, but IMHO cleaner than messing with >> builtins. > > Looking at django/template/__init__.py -- it does seem like INSTALLED_APPS and django.template.builtins ar

Re: Adding custom filter to stand-alone template

2011-05-04 Thread Ethan Jucovy
On Wed, May 4, 2011 at 6:41 PM, Up2L8 wrote: > I'm trying to use the Template library outside of a normal Django > webapp and am having difficulty figuring out the right way to register > a custom filter. > The current implementation works, but I don't like accessing the

Re: Django/Comet?

2011-01-16 Thread Ethan Jucovy
Thanks Shawn, this is very helpful. It's good to hear Orbited is being actively developed again. I'm not already using RabbitMQ for anything, so I'm going to take the opposite approach: start out doing some test projects with Hookbox, and then try porting them to Orbited. I'm completely new to

Re: Django/Comet?

2011-01-15 Thread Ethan Jucovy
On Fri, Jan 14, 2011 at 6:28 AM, Shawn Milochik wrote: > I asked about this back in October but nobody replied. I think it's been > long enough for a bump. ;o) > > I searched the list online and haven't seen any recent discussions about > this, so I figured I'd check in. Last

Re: update a record without typing too much

2010-02-26 Thread Ethan Jucovy
On Fri, Feb 26, 2010 at 12:11 PM, Phlip wrote: > Djangoids: > > Consider this pattern: > >    product.brand = brand >    product.in_stock = True >    product.save() > > Because business-layer code does that all the time, can we DRY the > code up a little? > > def up(model,

Re: Design Question - Extending a model

2010-01-11 Thread Ethan Jucovy
My instinct is that you may be trying to be too generic. Without knowing more details, a "generic Entry" sounds a lot like .. a database record. :) Django's model.Model base class already does a great job at being easily extensible. Is there a specific minimal-but-interesting set of database

Re: Possibility of recursive rendering

2010-01-10 Thread Ethan Jucovy
I think the easiest thing to do write two templates and use the {% include %} tag like so: # templates/number_of_comments.html There are {{paragraph.comment_set.all.count}} comments. # templates/display_all_paragraphs.html {% for paragraph in paragraph_set %} Paragraph: {{paragraph.name}} {%

Re: very noob : DRY violation in views.py

2009-12-19 Thread Ethan Jucovy
Lately I have really liked using custom template tags for these sorts of queries. Once you get the hang of writing them, it's very quick to build a little library of queries in custom tags for your application. These are *very* convenient to use because you don't have to modify views.py -- or

Re: Comments & redirection

2009-11-05 Thread Ethan Jucovy
On Thu, Nov 5, 2009 at 2:30 PM, David wrote: > Is it possible to redirect upon successful comment submission to the > previous page when using Djangos built in render_comment_form ? > I'm not sure if there's a more direct way, but you can override the "comment_done"

Re: Marking usernames as not for use dynamically

2009-11-02 Thread Ethan Jucovy
I haven't tried this, but it looks like you can use `django.core.urlresolvers.resolve(path_string)` to figure out if a view exists with a given path. http://docs.djangoproject.com/en/dev/topics/http/urls/#django.core.urlresolvers.resolve

Re: Best Practices: How to best implement Rating-Stars in Django Templates

2009-10-31 Thread Ethan Jucovy
Hey, I actually just did 5-star ratings for a project I'm working on, and have been trying to figure out if I have anything reusable worth releasing as a package (and trying to find the time to figure that out..) I'll outline what I did and what I used to do it. I used django-ratings[1,2] for

Re: static models methods

2009-10-26 Thread Ethan Jucovy
I don't know what the error means, but this looks like the sort of thing you might want to put on a custom Manager instead -- then you could say `Settore.objects.get_default()`. http://docs.djangoproject.com/en/dev/topics/db/managers/#topics-db-managers (I have a feeling the error wouldn't

Re: [django-registration] urls in templates

2009-10-25 Thread Ethan Jucovy
Look in django-registration's registration/urls.py to find the names. IIRC it's like "auth_login" and "registration_register" (both with no parameters). egj On Sun, Oct 25, 2009 at 8:09 PM, Sławek Tuleja wrote: > > Hi > I am using django-registration. In my base.html

Re: Advice on checking optionally installed applications/features

2009-10-24 Thread Ethan Jucovy
On Sat, Oct 24, 2009 at 10:00 AM, Mark (Nosrednakram) < nosrednak...@gmail.com> wrote: > def using_reversion(): >try: >import reversion >return True >except ImportError: >return False >except: >pass > I'd still leave out the `bare except` entirely so

Re: Advice on checking optionally installed applications/features

2009-10-23 Thread Ethan Jucovy
On Fri, Oct 23, 2009 at 1:09 PM, Mark (Nosrednakram) wrote: > > Hello Django Users, > > I sometimes have reversion installed and sometimes have a > CACHE_BACKEND defined and came up with the following solution for > determining if I should register a model or use cache

Re: Preview model before saving it

2009-10-22 Thread Ethan Jucovy
Do you need one-time previews ("are you sure you want to save this?") or real drafts that can be viewed more than once? If you just need an intermediate preview step for the user who's submitting the data, you can do it without saving any data on the backend -- write a "preview" view that

Re: Middleware to replace @login_required

2009-10-15 Thread Ethan Jucovy
On Thu, Oct 15, 2009 at 12:24 PM, Shawn Milochik wrote: > > Middleware question: > > If 100% of an apps views require a logged-in user except for the login > page, does it makes sense to have middleware check the URL and > redirect to the login page rather than putting the

Re: re-using field definitions

2009-09-24 Thread Ethan Jucovy
On Thu, Sep 24, 2009 at 9:37 AM, Chris Withers wrote: > > Hi All, > > I tried this: > > from django.db import models > > signins = models.IntegerField( >     default=0, >     db_index=True, >     verbose_name='Total Signins' >     ) > > class User(models.Model): >