Re: Migrating wrapped function-based generic view to class-based generic view

2012-03-22 Thread saxon75
nage with this structure. Is this really the thing I ought to be doing here? It really seems like having to do this reduces the utility of the generic view to the point where I'd be better off just breaking DRY and rewriting all custom views. On Mar 20, 11:15 pm, saxon75 wrote: > Hi a

Migrating wrapped function-based generic view to class-based generic view

2012-03-20 Thread saxon75
Hi all, I have a site built on Django 1.2 that makes use of wrapped generic views, and I'm wondering what the right way to migrate them to the new class-based views in 1.3 is. Here's an example: urlpatterns = patterns('', (r'^(?P\S+)/$', views.node_section_all), ) def node_section_all(requ

Literal Brace Symbols in Templates

2010-03-24 Thread saxon75
I apologize if this is blindingly obvious, but suppose I want to have a template actually print the literal string "{{ url }}" in the page. How would I go about doing that? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, s

Re: Using urlencode with the url tag

2010-03-18 Thread saxon75
Yes, that's it exactly. Thanks! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For mo

Re: Form validation changes since 1.1.1? (Autocomplete errors)

2010-03-16 Thread saxon75
I guess I should try a little harder before asking for help. Turns out that I also needed to define the slug field in the model with "blank=True." Sorry for the spam. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send

Re: Form validation changes since 1.1.1? (Autocomplete errors)

2010-03-16 Thread saxon75
I should also note that in the AddArticleForm class, the slug field has the "required" attribute set to False, like so: slug = forms.CharField(max_length=25, required=False) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Re: Form validation changes since 1.1.1? (Autocomplete errors)

2010-03-16 Thread saxon75
Ah, small mistake: my current Django revision is r12794, not r11794. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+

Form validation changes since 1.1.1? (Autocomplete errors)

2010-03-16 Thread saxon75
I upgraded this morning from Django 1.1.1 (r11312, I think) to the most recent HEAD revision (r11794) and it appears that some changes have been made to the form validation scheme again. I have a blog app wherein I want the application to be able to automatically generate slugs from post titles.

Form validation changes since 1.1.1? (Autocomplete errors)

2010-03-16 Thread saxon75
I upgraded this morning from Django 1.1.1 (r11312, I think) to the most recent HEAD revision (r11794) and it appears that some changes have been made to the form validation scheme again. I have a blog app wherein I want the application to be able to automatically generate slugs from post titles.

Using urlencode with the url tag

2010-03-15 Thread saxon75
I'm trying to generate a link where the URL of the current page gets passed in the querystring of the link. Like so: . I would have thought that I could do this relatively easily with template tags, so I've tried this: <% url arg1, arg2 as the_url %> http://www.example.com?variable={{ the_url|ur

Re: Odd ModelForm problem

2009-06-24 Thread saxon75
I see. Well, I guess I don't know why it worked before either. I made the following change and that seems to have cleared up the problem: This: if not form.slug: form.slug = slugify(form.title) if form.is_valid(): article = form.save(commit=False) is now: if form.is_valid(): article =

Odd ModelForm problem

2009-06-23 Thread saxon75
I'm having a strange problem with my site wherein a ModelForm doesn't appear to recognize that it has an attribute that it ought to. I should preface this by saying that I recently moved my codebase to a new server--everything had been working fine on the old server and I haven't made any changes

Re: select_related + annotate = bug?

2009-02-27 Thread saxon75
Sweet! Thanks! --~--~-~--~~~---~--~~ 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 unsubscribe from this group, send email to django-users+unsu

select_related + annotate = bug?

2009-02-27 Thread saxon75
I'm having a somewhat odd error occurring when I try to use select_related() and annotate() in the same queryset. The application I'm working on is a blog-type app where posts can be a variety of types--article, book review, film review, etc. I use multi- table inheritance with a single base cla

Eager Fetching

2009-02-25 Thread saxon75
I'm having an issue where my templates are taking a really long time to load, and it looks like the problem is that a lot of database calls are made inside the template. This seems like it would be easy enough to fix, but I have kind of an odd setup with my model relationships that seems to be ad

Re: Multi-Table Inheritance and Templates

2008-06-18 Thread saxon75
Thanks for your response! I actually do something similar to what you describe when I'm displaying a single node and it works great. The problem I'm having is when I want to grab many nodes and display all of them on the same page. So, I suppose what I could do is either iterate over the QueryS

Multi-Table Inheritance and Templates

2008-06-18 Thread saxon75
I'm working on a blog/CMS type application where I use a number of different models for different content types. Each of the content types (article, book review, film review, etc.) is sub-classed from a central "Node" model. What I'd like to be able to do is display a list of all nodes on a page

CMS application: auto-setting the post author

2008-06-16 Thread saxon75
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): author = models.ForeignKey(User) created = models.DateTimeField() title

Multi-Table Inheritance Question

2008-06-06 Thread saxon75
I'm kind of new to both Django and Python, so bear with me if the answer here is really obvious. I'm working on a blog/CMS project wherein I want to have different types of posts--for example, normal articles, film reviews, book reviews, etc.--where each type of post will have certain common fiel