Permalinks/get_absolute_url when an object has multiple URLs?

2010-03-09 Thread Ceph
Some of our more common models are shared throughout our app ecosystem and we frequently run into a problem with get_absolute_url/permalink/ etc of generating required URLs, in particular looking at user A's interaction with a model vs user B's that may occur in a completely separate part of the

select_related and 1-to-many relations

2009-04-06 Thread Ceph
I have the following models: class User(models.Model): pass class Item(Models.Mode): created = models.DateTime(default=datetime.now) user = models.ForeignKey(User, related_name="items") class Meta: ordering = ("-created",) get_latest_by = "created" So a user

Counting queries and query execution time

2009-03-31 Thread Ceph
Under settings.DEBUG=True, django.db.connection.queries is an array of all queries executed. Obviously storing every query in text is a memory hog. Would it still thrash as much if I wrote my own wrapper around a DB connection class via settings.DATABASE_ENGINE that implemented its own

Re: truncate string after x characters

2007-08-20 Thread Ceph
{{ post.subject|slice:":15"|escape }} does the job. On Aug 20, 6:55 am, patrickk <[EMAIL PROTECTED]> wrote: > thanks. > > since truncatewords and truncatewords_html are predefined filters, I > guess that truncate should also be one (just my opinion). > > patrick > > On 20 Aug., 12:33, Malcolm

Serving large files through HttpResponse

2007-08-20 Thread Ceph
I'm serving rather large, static files through Django. I'd rather not use renaming trickery to serve them, but I don't know what the best way to serve them through HttpResponse is. I used to use this: response = HttpResponse(iter(open(file_path, "rb"))) return response in my view. That stopped

Re: Komodo and Django - code completion / code intellisensing

2007-05-25 Thread Ceph
5 and is in my path (from the CMD > i can start pyton any where) > > any other suggestions? > > thanks again for helping > > oli > > On May 10, 3:12 pm, Ceph <[EMAIL PROTECTED]> wrote: > > > Hello, > > > Go to Edit > Preferences. Expand the &qu

Re: Komodo and Django - code completion / code intellisensing

2007-05-10 Thread Ceph
Hello, Go to Edit > Preferences. Expand the "Languages" group by clicking the [+] symbol. Click "Python". Click the little "Add..." button under "Additional Python Import Directories". Add the directory ABOVE your project and you should have intellisense enabled. On May 9, 12:01 pm, oliver

newforms custom field errors?

2007-02-02 Thread Ceph
Would it be possible to allow custom error messages per field in newforms? E.g., class MyForm(forms.Form): username = forms.CharField(label="User Name", error="Please enter your user name.") "This field is required." doesn't work well if you are displaying your errors on top of your form

newforms: MultipleChoiceField with CheckboxSelectMultiple

2006-12-09 Thread Ceph
I'm toying around with converting my forms over to newforms and have come across a problem which may be just user error. I have a form: class AddForm(Form): flags = MultipleChoiceField(choices=[("A", "Aquatic"), ("C", "Canopy")]) I have a view, which for the moment, is just trying to

Using template tags to fill blocks in parent templates?

2006-11-11 Thread Ceph
I've run into a problem trying to use template tags in a child template where the tag tries to fill block content in the child template or the parent template. This is how it is set up: base.html: {% block nav %}{% endblock %} child.html {% extends "base.html" %} {% load navigation %} {%

Re: Firefox Quirks

2006-10-29 Thread Ceph
Do you have any sort of Google Toolbar or any addons (or Firefox itself) that are set to remember form field information? The reason the Django (admin, presumably?) code will highlight is based on field names, so if your text field ends up with name="email", the toolbar will recognize it. In

Using query sets to get a filtered list across models

2006-10-29 Thread Ceph
ationships using related_names, but I'm not positive. Are there any documents out there that outline more than simple relationship cases? ~Ceph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users&

Adding a custom field for ManyToMany

2006-10-12 Thread Ceph
I seem to recall some documentation somewhere, but it appears I was hallucinating because I can't find it again. Is there a way to add custom field in a Django ManyToMany relationship? Example has two models, Article and Category. An Article has a ManyToMany relationship to Categories. However,