On Sun, Jul 26, 2009 at 3:55 PM, Rams3377 wrote:
>
>
> In Django 1.0.2, what is the best way to perform a user submitted
> search? For instance if someone wanted to search through a profile
> which has several parameters that the user may or may not fill out.
> What is the
On Thu, Jul 9, 2009 at 4:49 PM, Wiiboy wrote:
>
> The columns are actually categories. The left column is sports, etc.
> So I can't make it a grid like that.
>
If each column is a discrete category, why not just filter the
object/model by category for each column? You're
Why not do this:
class Polygon(models.Model):
sides = models.IntegerField()
side_length = models.IntegerField()
def perimeter(self):
return sides * side_length
(Forgive the syntax. I'm a bit rusty.) This doesn't help with
irregular polygons, but with your example, it
first % escapes the second % sign, and thus allows for the actual
symbol to display. This is because Python uses % to include variables,
etc., into a string. So it's not a bug at all.
Erik Vorhes
--~--~-~--~~~---~--~~
You received this message because you are subscribe
Or check out James Bennett's comment_utils:
http://code.google.com/p/django-comment-utils/
It has what you need.
On Fri, Apr 25, 2008 at 9:52 PM, realfun <[EMAIL PROTECTED]> wrote:
> I am writing a simple Django App, the model is like this:
> class MyPosts(models.Model):
>
> content =
Put your CSS files in your media directory. If your media url is
"http://yoursite/media/;, then you could do something like and you should see your intended
style.
On Thu, Apr 24, 2008 at 10:01 PM, gmacgregor <[EMAIL PROTECTED]> wrote:
>
>
> On Apr 24, 10:49 pm, Rodney Topor <[EMAIL
There's nothing wrong with parceling out models across different apps.
And unless you're planning on distributing each app separately, don't
worry about cross-app dependencies.
In this case, I'd encourage you to--since you'll probably want to do
more than just book-related stuff with your
I'm (currently) a low-budget developer, so I'll do mock-ups on graph
paper, edit images in Acorn, and then hand code in BBEdit (which I got
a great deal on, before TextMate was as robust & awesome as it is
now). A good solution for the cost-conscious, aside from TextMate, is
Coda. (If you're
This is more mundane, but ':' is called a colon.
On Tue, Apr 22, 2008 at 5:17 AM, Manuel Meyer <[EMAIL PROTECTED]> wrote:
>
> Hey,
>
> I wonder how to get a ':' (btw: what's its name in english?) in my
> url, so it is shown as : in the address and not as %3A .
>
> Like wikipedia does:
>
Or you can add something to your view to take care of this:
def your_view(request):
...
some_subset = Model.objects.all()[:10]
...
Add it to 'extra_context' and you won't need to do anything trickier than this:
{% for model in some_subset %}
some stuff
{% endfor %}
On Fri,
Also, there are things happening that will make this possible without
hacking at Django directly:
http://www.jacobian.org/writing/2008/mar/19/pycon/ (near the bottom of
the article)
Here's what will (probably) be able to happen:
INSTALLED_APPS = (
"some.app",
app("some.app",
In production environments, you need to use something like Apache or
Lighttpd (sp?) to serve media--it's not something you should be doing
directly through Django.
Check the URL for your image and compare it to MEDIA_URL in your
settings.py file (plus anything you're adding through
> {% for a in list %}
> a.foo a.bar
> {% endfor %}
If you really need something to happen other than an empty string, you
can always use the "if" tag:
{% for a in list %}
{% if a.foo %}{{ a.foo }}{% else %}Whatever exception text you
want{% endif %} {{ a.bar }}
{% endfor %}
You might be thinking of this flowchart:
http://www.djangobook.com/en/1.0/chapter03/#cn60
Erik
On Sat, Apr 12, 2008 at 7:00 AM, Tim Chase
<[EMAIL PROTECTED]> wrote:
>
> > As the subject says, I'd love to learn more about how django
> > works internally.
>
> One of the best pages I've found
Using a database doesn't by default make your site searchable. It's a
more efficient storage system (usually) than having a bunch of static
files.
SQLite is an easy way to develop, especially if you're running Python
2.5, but I usually move to a PostgreSQL backend for "production"
sites, since
Check out the documentation on URL configuration, if you need
something more customized than the default 404.html template. (You
don't need to write a special regex for 404 situations, but you could
just use, as the *absolute last* pattern something like r'^.*$' (I
think).
For the most part,
> I have a custom filter that outputs some html code. The problem is
> that it converts all "greater than" and "less than" symbols to
> appropriate and symbols. How is it possible to say to
> filter not to do this?
You're running into the autoescape tag, which is on by default in
It doesn't necessarily hurt to have apps inside the project folder,
but it does make it harder to extract and reuse them.
If I remember correctly, you don't need much, aside from settings.py,
urls.py, and __init__.py.
On Fri, Apr 11, 2008 at 1:09 PM, andy baxter
<[EMAIL PROTECTED]> wrote:
>
>
I'm not sure how this is more transparent. Don't you mean *less*
transparent for your user? Instead of a simple number (or more usable
user-defined slug), you're giving them a random string, which will be
almost impossible to remember and contains no discernibly useful
information. If you
That's because the table storing your information doesn't have an
"EventDate" field, and it can't be ordered by something that doesn't
exist. You'll need to update the table before it will work correctly.
On Mon, Mar 31, 2008 at 1:25 AM, Ryan Vanasse <[EMAIL PROTECTED]> wrote:
>
> I just
end of each. That's the discussion I wanted to have. I know I
> can get around this, but sometimes I am stubborn especially when I
> don't really see a downside to the generic objects receiving extra
> arguments.
>
> Maybe I am just being difficult.
>
>
>
> On Thu, Mar 27
This should help:
http://www.b-list.org/weblog/2006/nov/16/django-tips-get-most-out-generic-views/
Say you've got this in "yourproj.yourapp.views" (assuming there's a
ForeignKey on Thing2):
from django.views.generic import date_based
from yourproj.yourapp.models import Thing1
from
It looks like the issue is one of indentation. There's nothing for
"self" to refer to if the method isn't part of the class.
--And you're probably better off using __unicode__ than __str__
Try:
class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date =
In my app I have a model, "Review," that uses a different (ForeignKey)
citation form depending on the type of thing I'm reviewing. I'd like
to be able to call a different ForeignKey dynamically based on the
citation type but keep running into a bunch of errors.
Here's my current "Review" model
24 matches
Mail list logo