Re: Extending django.contrib.auth.views.login ?

2007-02-15 Thread whiteinge
Easily solved the problem once I realized the difference between HttpRequest and HttpResponse objects (doh!). In the event another nub is looking to make stuff happen post- successful login/logout here's the (now obvious) pseudo-code solution: def user_login(request): response = django.contr

Re: Use an application inside other application

2007-02-25 Thread whiteinge
There's a good writeup on template tags on B-List (with some copy-and- pasteable sample code). http://www.b-list.org/weblog/2006/06/07/django-tips-write-better-template-tags Cheers. - whiteinge On Feb 25, 5:57 am, Dirk Eschler <[EMAIL PROTECTED]> wrote: > On Sonntag, 25. Febru

Extending django.contrib.auth.views.login ?

2007-02-13 Thread whiteinge
On a semi-related note, I'd probably be able to muddle through this on my own using the Python console, but I don't know how to fake the 'request' variable in that environment; is this easy to do? Thanks very much, - whiteinge --~--~-~--~~~---~--~-

Re: How to delete template fragment cache?

2008-12-03 Thread Nathaniel Whiteinge
On Dec 3, 12:37 am, Bartek SQ9MEV <[EMAIL PROTECTED]> wrote: > I know I should use cache.delete('a'), but how can I get key for > particular fragment? The key is 'fragment_name:additional:arguments:seperated:by:colons'. > What is better idea? Use signals (I do not know too mouch about them > yet

Re: User in form wizard

2008-12-08 Thread Nathaniel Whiteinge
request, instance=instance) If that's more confusing than helpful, post your code and I'll give you a more specific example. :) - whiteinge .. [1] http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#the-save-method .. [2] http://docs.djangoproject.com/en/dev/ref/con

Re: The First Page

2009-01-12 Thread Nathaniel Whiteinge
On Jan 11, 9:53 pm, "pyramid...@gmail.com" wrote: > I am slightly confused with starting out > I just want to start with the initial index page You just need a line in your main urlconf (the one specified in your settings.py file) that maps directly to an HTML file in your templates directory. H

Re: Highlight current active page

2008-10-17 Thread Nathaniel Whiteinge
A slight variation that doesn't require repeating the whole navigation div in each base_SECTION.html template: # base.html {% block content %}...{% endblock %} {% block navigation %} Section 1 Section 2 {% endblock %} # base_section1.html {% extends "base.html" %} {% block active_secti

Re: How to get RadioSelect items one by one in a template

2008-10-20 Thread Nathaniel Whiteinge
ble with an unpatched Django. See the following tickets: .. [1] http://code.djangoproject.com/ticket/4785 .. [2] http://code.djangoproject.com/ticket/4592 .. [3] http://code.djangoproject.com/ticket/6458 - whiteinge --~--~-~--~~~---~--~~ You received this message because

API mismatch bug with CursorDebugWrapper?

2009-01-23 Thread Nathaniel Whiteinge
? Thanks. - whiteinge --~--~-~--~~~---~--~~ 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 dj

Re: API mismatch bug with CursorDebugWrapper?

2009-01-24 Thread Nathaniel Whiteinge
I was coming at it from the other direction and relying too much on the shell. Quandary solved. - whiteinge --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this grou

Re: Getting Logged in User with Test Client

2009-01-24 Thread Nathaniel Whiteinge
On Jan 23, 10:22 pm, Vbabiy wrote: > How can I get the user model when I use the client to login in to the > application? This method is a little ugly, but it works:: from django.contrib.auth.models import User def test_showAccountWithZeroTrackers(self): self.client.login(userna

Re: User Auth... is_group in a template?

2009-02-09 Thread Nathaniel Whiteinge
On Feb 9, 9:01 am, Alfonso wrote: > but is there a similar syntax for displaying HTML blocks depending on > the user group? Not builtin, no. But easy to add with a filter: http://www.djangosnippets.org/snippets/847/ --~--~-~--~~~---~--~~ You received this message

Re: Using login_required with direct_to_template?

2007-06-06 Thread Nathaniel Whiteinge
7;, (r'^someurl/', login_required(direct_to_template), { 'template': 'template.html', }), ) - whiteinge On Jun 6, 10:09 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > An explanation of what you expect to happen and what is actually >

Re: Django Users Portuguese

2007-06-07 Thread Nathaniel Whiteinge
Have you seen the existing `Django Brasil`__ group? It's got 165 members and seems pretty active. .. __: http://groups.google.com/group/django-brasil --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" g

Re: Custom Form Validation

2007-06-22 Thread Nathaniel Whiteinge
You're nearly there, you just need to return your cleaned value. Here's one of mine: if self.cleaned_data.get(field_name) > assets.get_usable_assets(): raise ValidationError(u'You only have %s points available for betting.' % assets.get_usable_assets()) return self.cleaned_data.get(f

Re: Custom Form Validation

2007-06-22 Thread Nathaniel Whiteinge
Sorry, accidentally hit the submit button. Here's your example finished (don't forget self in the def!): def clean_lines(self): if not format_is_correct( lines ): raise forms.ValidationError('Bug..') return self.cleaned_data.get(lines) Good luck! - whitein

Re: Attrs in models

2007-06-24 Thread Nathaniel Whiteinge
BaseYourForm) .. base class: http://www.djangoproject.com/documentation/newforms/#using-an-alternate-base-class .. fields argument: http://www.djangoproject.com/documentation/newforms/#using-a-subset-of-fields-on-the-form Cheers. - whiteinge On Jun 24, 12:47 pm, l5x <[EMAIL PROTECTED]> wrote: > Hell

Re: Attrs in models

2007-06-24 Thread Nathaniel Whiteinge
_for_model(YourModel, form=BaseYourForm) list_of_required = ['name', 'username'] form = YourForm(yourlistoffields=list_of_required) Cheers. - whiteinge On Jun 24, 2:46 pm, l5x <[EMAIL PROTECTED]> wrote: > And what if I need a class only in selected field

Re: Attrs in models

2007-06-24 Thread Nathaniel Whiteinge
ngo-users/msg/74aaef38380f2c31 Cheers. - whiteinge On Jun 24, 4:49 pm, l5x <[EMAIL PROTECTED]> wrote: > This is a great stuff and I'm really glad that you show me that, but I > still wonder if it is possible to do sth like that in a model ;-) > I mean: > > Model looks lik

Re: Method to find the admin url for an object

2007-06-27 Thread Nathaniel Whiteinge
Not sure if this is what you're looking for, or if there's an official way to to this, but I'm using this:: def get_admin_url(self): return "%s/%s/%s/%s/" % ("/admin", self._meta.app_label, self._meta.object_name.lower(), self.id) S

Re: Variables available to all templates

2007-06-29 Thread Nathaniel Whiteinge
p/django-developers/browse_thread/thread/e0a59d1eaa84c7b4/# - whiteinge On Jun 29, 12:13 pm, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote: > On 6/29/07, Kirk Strauser <[EMAIL PROTECTED]> wrote: > ... > > > return render_to_response('index.html', > >

threadlocals in Manager, import-time vs. execution-time problem?

2007-07-11 Thread Nathaniel Whiteinge
I'm having a problem with threadlocals in a custom manager making queries for the wrong user. I've Googled around quite a bit, and haven't found the answer -- except others *do* seem to be successfully using threadlocals in Managers. Ostensibly this is a import-time vs. execution-time problem, but

Re: Django + newforms + jQuery

2007-07-12 Thread Nathaniel Whiteinge
ps.google.com/group/django-users/msg/c8f7d18eb79d9aa1 I find the two frameworks to be a pretty solid match. - whiteinge --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to thi

Re: newforms: manually accessing initial value for field

2007-07-12 Thread Nathaniel Whiteinge
ur view is passing the whole form object to the template, not `form.as_p()` (or something). - whiteinge On Jul 11, 12:32 pm, Chris Hoeppner <[EMAIL PROTECTED]> wrote: > Hi there! > > I was just wondering how to access the value I've set in the view with > Form(initial={'

Re: Two huge forms delema

2007-07-15 Thread Nathaniel Whiteinge
I don't have much experience with sub-classing forms, but I suspect `del self.fields[a]` should do the trick. Let us know! - whiteinge On Jul 15, 7:04 am, Eratothene <[EMAIL PROTECTED]> wrote: > Fixed examples mistakes: > > class A(forms.Form) > a = field > b = fi

Multiple URLconfs per app?

2007-07-18 Thread Nathaniel Whiteinge
y, feature2_urls.py)? myproject/urls.py:: urlpatterns = patterns('', (r'^feature1/', include('myproject.apps.myapp.urls.feature1')), (r'^feature2/', include('myproject.apps.myapp.urls.feature2')), ) - whiteinge --~--~-

Re: Multiple URLconfs per app?

2007-07-19 Thread Nathaniel Whiteinge
Thanks, guys. On Jul 19, 12:52 am, Nathan Ostgard <[EMAIL PROTECTED]> wrote: > If you just want to specify the urls as listed, you could always > create a urls folder in myapp, put an __init__.py in there, and create > myapp/urls/feature1.py and myapp/urls/feature2.py. > > > Nathan Ostga

Re: overiding the clean method on newforms

2007-07-30 Thread Nathaniel Whiteinge
I found the forms from James Bennett's Django Registation app helpful when I was first learning newforms. http://django-registration.googlecode.com/svn/trunk/registration/forms.py - whiteinge On Jul 30, 2:08 am, james_027 <[EMAIL PROTECTED]> wrote: > Hi, > > is there any s

Re: create_or_update() shortcut

2007-08-02 Thread Nathaniel Whiteinge
ango-developers&q=3182 - whiteinge --~--~-~--~~~---~--~~ 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,

Re: List comprehension with unique, sorted values

2007-08-19 Thread Nathaniel Whiteinge
. .. _distinct: http://www.djangoproject.com/documentation/db-api/#distinct - whiteinge --~--~-~--~~~---~--~~ 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@googlegrou

Re: editable=False? visible=False?

2007-08-22 Thread Nathaniel Whiteinge
javascript [2]_. .. [1] http://www.w3.org/TR/html401/interact/forms.html#disabled .. [2] http://www.djangoproject.com/documentation/model-api/#js - whiteinge --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Dja

Re: TyneMCE-like for math, You know one?

2007-08-25 Thread Nathaniel Whiteinge
Depending on your ultimate output needs, ASCIIMathML.js may be a good solution: http://www1.chapman.edu/~jipsen/mathml/asciimathdemo.html --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To pos

Re: CRUD generic views and new forms

2007-08-26 Thread Nathaniel Whiteinge
The CRUD generic views haven't been updated for newforms yet. In the meantime you can try using this snippet: http://www.djangosnippets.org/snippets/99/ - whiteinge --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google G

Re: A question about an interface via a Form

2007-09-04 Thread Nathaniel Whiteinge
the database). The docs can be pretty daunting at first, but stick with 'em and feel free to run any questions you have past this list! Good luck, - whiteinge .. [1] http://www.djangoproject.com/documentation/model-api/#automatic-primary-key-fields .. [2] http://www.djangoproject.com/docu

Fixtures auto-incrementing primary keys?

2007-09-06 Thread Nathaniel Whiteinge
pk counter, it is the second time this has struck me as annoying. Would the devs be open to a patch for this sort of thing? Thanks, - whiteinge --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users&quo

Re: Fixtures auto-incrementing primary keys?

2007-09-08 Thread Nathaniel Whiteinge
Thanks for the replies, both. > This idea has occurred to me before, and I can see how it could be > useful, but I got caught up on one significant detail: how do you > handle references? When you specify the PK, you provide an identifier > to use as a cross reference. If this identifier no longe

Re: Form field value

2007-09-08 Thread Nathaniel Whiteinge
x27;t save the new author instance. >>> new_author = f.save(commit=False) # Modify the author in some way. >>> new_author.some_field = 'some_value' # Save the new instance. >>> new_author.save() .. [1] http://www.djangoproject.com/documenta

Re: Post Save

2008-01-21 Thread Nathaniel Whiteinge
! Let us know if you have further questions. - whiteinge --~--~-~--~~~---~--~~ 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 fr

Accessing individual radio buttons from a template

2008-01-22 Thread Nathaniel Whiteinge
workaround ([1], [2]) doesn't seem to work any longer since as_widget() appears to return a string. (Based on the workaround I presume as_widget() used to return an iterable object.) Any advice would be very much appreciated. Thanks. - whiteinge .. [1] http://groups.google.com/gro

Re: How to use newforms ChoiceField to show dynamic choices

2008-01-24 Thread Nathaniel Whiteinge
ModelChoiceField. Currently not documented, but here's example code. Use your browser's find for "ModelChoiceField". http://www.djangoproject.com/documentation/models/model_forms/ On Jan 24, 9:47 pm, shabda <[EMAIL PROTECTED]> wrote: > I want to use the ChoiceField to show choices depending on

Re: Managing the order of subordinate objects

2008-01-29 Thread Nathaniel Whiteinge
nstructions. Hope it helps or gives you a better idea. .. [1] http://www.djangosnippets.org/snippets/568/ - whiteinge --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To p

Re: Help filter with Admin

2008-02-03 Thread Nathaniel Whiteinge
after. Your question inspired me to clean it up a bit and post it to Django Snippets. It might have a bug or two, but I tested it with your use-case and it worked just fine. http://www.djangosnippets.org/snippets/581/ - whiteinge --~--~-~--~~~---~--~~ You r

Re: Which markup language to choose?

2008-02-06 Thread Nathaniel Whiteinge
er is not aware of using a markup language. Or should I just stick > with {{ comment.content | escape | urlizetrunc:40 | linebreaks }}? For b) I'm pretty ambivalent. Textile seems to be on the way out though. - whiteinge --~--~-~--~~~---~--~~ You received

Re: Newwbie trying to get a variable name into a field name

2008-02-07 Thread Nathaniel Whiteinge
On Feb 7, 2:01 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I know I can't do what I am trying to do in the Media class, but how > can I do this? How can I name that folder from the media_type > fieldname? You have to override the _save_FIELD_file method in your model. Marty Alchin has a

Re: Help filter with Admin

2008-02-07 Thread Nathaniel Whiteinge
or B'); The first argument needs to be the exact text of the list_filter heading (the H3 element) that you're trying to hook on to. Email me off-list if that didn't get it working. I'm happy to help. - whiteinge --~--~-~--~~~---~--~~ You received t

Re: How to return Admin to previous filters after save?

2008-02-14 Thread Nathaniel Whiteinge
RL of your choosing is (or will be) possible with the newforms-admin branch. - whiteinge --~--~-~--~~~---~--~~ 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@g

Re: How to return Admin to previous filters after save?

2008-02-20 Thread Nathaniel Whiteinge
by suggesting newforms-admin; I don't know for sure that this is possible. It is far more flexible than the current Admin, so I have high hopes, and other people also want this same functionality [2]. .. [2] http://code.djangoproject.com/ticket/6002 - whiteinge --~--~-~--~~-

Re: add RequestContext automatically to each render_to_response call

2008-03-10 Thread Nathaniel Whiteinge
On Mar 10, 3:28 am, Julian <[EMAIL PROTECTED]> wrote: > def render_to_response(*args, **kwargs): > kwargs['context_instance'] = RequestContext(request) > return _render_to_response(*args, **kwargs) That's exactly how Snippet #3 [1] does it. I personally prefer using the built-in direct_to

Re: Printing only the radio input

2008-04-05 Thread Nathaniel Whiteinge
On Apr 5, 6:36 am, J. Pablo Fernández <[EMAIL PROTECTED]> wrote: > and what I want to do is print the individuals type="radio" ...> without any label, list or anything. No, this isn't currently possible. If you don't mind patching your Django installation, there's a ticket [1] with a patch tha

Re: GeoDjango: Completely Overwhelmed

2008-04-15 Thread Nathaniel Whiteinge
", hopefully I didn't confuse you even more! :-P Good luck. - whiteinge --~--~-~--~~~---~--~~ 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@goog

GeoDjango: distance between PointFields problem

2008-04-22 Thread Nathaniel Whiteinge
cations is off by quite a bit. The distance between Salt Lake City and Chicago is reported as just over 10,000 miles, for example. I'm not sure how to go about troubleshooting this. Any advice would be very much appreciated. - whiteinge .. [1] http://code.djangoproject.com/wiki/GeoDj

Re: GeoDjango: distance between PointFields problem

2008-04-22 Thread Nathaniel Whiteinge
with GIS? The best I've seen so far is the link below. So now that you know more about my setup, how would I find the distance between two users in a model? Thanks for your help so far, Justin. - whiteinge .. __: http://www.sharpgis.net/post/2007/05/Spatial-references2c-coordinate-sys

Re: Getting the user object into a newform

2008-04-24 Thread Nathaniel Whiteinge
27;t use the above quite as much, but it's still very useful for non-ModelForms. - whiteinge --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-u

Re: GeoDjango: distance between PointFields problem

2008-04-24 Thread Nathaniel Whiteinge
d longitude as y/x instead of x/ y. Not so obvious if you don't know lat/long very well. Thanks, Justin, for pointing this out on IRC, and for all the other helpful links. - whiteinge --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Overriding model __init__() method

2008-04-28 Thread Nathaniel Whiteinge
where, or am I doing something fragile that should be done another way? - whiteinge --~--~-~--~~~---~--~~ 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@googleg

Re: Django Registration URLs

2008-04-29 Thread Nathaniel Whiteinge
On Apr 28, 6:30 pm, Szaijan <[EMAIL PROTECTED]> wrote: > The base urls function properly, i.e. /visionary/accounts/register > goes where it is supposed to, but when resulting URLs are called, they > all get called as /accounts/register/complete instead of /visionary/ > accounts/register/complete.

Re: urls() and request.user

2008-05-01 Thread Nathaniel Whiteinge
On May 1, 10:04 am, "Guillaume Lederrey" <[EMAIL PROTECTED]> wrote: > This of course doesnt work because the request isnt in the scope. I > could redefine a view in my views.py and do the work on the request > manually, but i have a feeling there is a solution to do that directly > in my urls.py.

Re: urls() and request.user

2008-05-04 Thread Nathaniel Whiteinge
On May 4, 5:42 am, "Guillaume Lederrey" <[EMAIL PROTECTED]> wrote: > I havent done any functional programming in a long time , but ... isnt > there a way to use an anonymous function (if that's what it is called) > and do the wrapper "inline" ? Something like : Yeah, something like that would wor

Re: Getting 'instance' in ModelForms

2008-05-16 Thread Nathaniel Whiteinge
On May 16, 6:27 am, Greg Taylor <[EMAIL PROTECTED]> wrote: > class Form_SKU(ModelForm): > """ > The form for updating SKUs. > """ > selected = self.instance.colors ``self`` isn't in scope here, try the code below (and it wouldn't hurt to read-up on Python OOP). class Form_SKU(Mod

Re: Remove empty value ('---------') from HTML SELECT choices

2008-06-05 Thread Nathaniel Whiteinge
On Jun 5, 7:36 am, Berco Beute <[EMAIL PROTECTED]> wrote: > My model has a ForeignKey that renders as a SELECT field in HTML. The > problem is that there's an empty value ('-') that I would like > to hide. Presuming you are using newforms (i.e. not the Admin), then override the ModelChoic

Re: Remove empty value ('---------') from HTML SELECT choices

2008-06-07 Thread Nathaniel Whiteinge
On Jun 7, 4:18 pm, Berco Beute <[EMAIL PROTECTED]> wrote: > Quite a lot of work for something so simple I agree that overriding default widgets is currently too much work. But here's a slightly shorter version that works in exactly the same way as your example:: class SomeForm(forms.ModelFor

Re: Form Validation

2008-06-11 Thread Nathaniel Whiteinge
f form.is_valid(): ... else: form = RelationForm(instance=instance) return render_to_response(...) Hope that's helpful. - whiteinge --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Goog

Re: Remove empty value ('---------') from HTML SELECT choices

2008-06-19 Thread Nathaniel Whiteinge
On Jun 19, 3:23 pm, Huuuze <[EMAIL PROTECTED]> wrote: > In this example, what if you wanted to selectively remove a value from > the choice list. For that you'll have to move the field declaration into the form's __init__ method:: class SomeForm(forms.ModelForm): class Meta:

Re: Remove empty value ('---------') from HTML SELECT choices

2008-06-19 Thread Nathaniel Whiteinge
On Jun 19, 3:45 pm, Nathaniel Whiteinge <[EMAIL PROTECTED]> wrote: >                 if self.instance.state == 'processing': >                     queryset = queryset.exclude(state='new') The above lines aren't quite right ``self.instance`` is an instanc

Re: Initializing a form.

2008-06-19 Thread Nathaniel Whiteinge
On Jun 19, 4:36 pm, Adi <[EMAIL PROTECTED]> wrote: > In order to set up the initial values on a couple of fields of my > form, I need to pass in a couple of model objects to my ModelForm's > init method. Try this:: class YourForm(forms.ModelForm): class Meta: ...

Re: Choosing between User.first_name/last_name & username

2008-06-22 Thread Nathaniel Whiteinge
Stuart Grimshaw wrote: > but it was throwing syntax errors on "player.player.first_name == '' ? > player.player.username : player.player.first_name)" It looks like you're trying to use a ternary operator here, but only Python 2.5 and later has one (and the syntax is different [2]). The good news

Re: wizard authentication

2008-06-26 Thread Nathaniel Whiteinge
On Jun 25, 12:13 pm, twenger26 <[EMAIL PROTECTED]> wrote: > def wrapper_for_wizard(request): >     return AddOrderWizard([OrderForm1, OrderForm2Quote, OrderForm3]) You're on the right track! You need to pass your list of forms to the wizard constructor, as you're doing, as well as pass the reque

Re: How to use dynamic choice in a ChoiceField

2008-06-26 Thread Nathaniel Whiteinge
On Jun 26, 7:53 am, mwebs <[EMAIL PROTECTED]> wrote: > gallery = forms.ChoiceField(Gallery.objects.filter( ...)) You want to use a ModelChoiceField [1] instead of a ChoiceField. It takes a QuerySet as an argument:: class PictureForm(forms.Form): ... gallery = forms.ModelChoic

Re: Blank choice for USStateField?

2008-06-26 Thread Nathaniel Whiteinge
On Jun 26, 8:29 am, Huuuze <[EMAIL PROTECTED]> wrote: > How can I add an empty value as the initial value? At the moment you have do a bit of leg-work for this. Something like the following should work (untested):: from django.contrib.localflavor.us.us_states import STATE_CHOICES from dj

Re: Blank choice for USStateField?

2008-06-26 Thread Nathaniel Whiteinge
On Jun 26, 12:00 pm, Huuuze <[EMAIL PROTECTED]> wrote: > Just out of curiosity, are the Django devs working on a patch?  I > wasn't able to find a ticket for this issue. Little consistency tweaks like this one will become more important once 1.0 lands, imo. --~--~-~--~~~--

Re: render_to_response with #anchor

2007-03-15 Thread Nathaniel Whiteinge
e = '?page=%s' % ((posts / paginate_by) + 1) else: page = '' return "%s%s#post_%s" % (self.thread.get_absolute_url(), page, self.id) - whiteinge On Mar 15, 2:19 am, Malcolm Tredinnick <[EMAIL PROTECTED]>

Re: Detect ajax request

2007-04-10 Thread Nathaniel Whiteinge
I've been happily using limodou's suggestion with the jQuery framework for a few weeks, hopefully whatever framework you're using also sends the X-Requested-With header--it just feels cleaner. if request.META.get('HTTP_X_REQUESTED_WITH') == 'XMLHttpRequest':

Re: new forms - processing the form without rebuilding the entire view

2007-04-16 Thread Nathaniel Whiteinge
;m relying on a 403 response header to detect validation errors and the X-Requested-With request header to detect Ajax. Feel free to drop me a line for more explanation if you want. - whiteinge On Apr 13, 8:29 am, "Tipan" <[EMAIL PROTECTED]> wrote: > I've created a view t

Re: new forms - processing the form without rebuilding the entire view

2007-04-18 Thread Nathaniel Whiteinge
Personally, I use a toolkit to lessen cross-browser compatibility problems as well as to speed quick, little functionality (eg. animations). I chose jQuery because it's small, unobtrusive, and I love the CSS-like syntax. - whiteinge On Apr 18, 3:11 am, Tipan <[EMAIL PROTECTED]> wrot

Re: Generic views: how to use them properly?

2007-06-02 Thread Nathaniel Whiteinge
m is they haven't been updated for Django's newforms yet--so use caution, things may change when they're updated. Good luck. - whiteinge --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django

Re: Extending Flatpages

2007-06-02 Thread Nathaniel Whiteinge
-tags Just put them in your flatpages/default.html template. - whiteinge On Jun 2, 10:42 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi All. > > I have got a question about flatpages. Supposed I have a "static" page > that says how great my product i

Re: Generic views: how to use them properly?

2007-06-02 Thread Nathaniel Whiteinge
convenient. .. __: http://www.b-list.org/weblog/2006/11/16/django-tips-get-most-out-generic-views .. __: http://www.djangobook.com/en/beta/chapter09/#cn377 .. __: http://www.pointy-stick.com/blog/2006/06/29/django-tips-extending-generic-views/ - whiteinge On Jun 2, 11:24 am, Nathaniel Whitein

Re: Extending Flatpages

2007-06-02 Thread Nathaniel Whiteinge
ound atoponce's comment at the bottom useful. .. __: http://www.djangosnippets.org/snippets/129/ Good luck! - whiteinge On Jun 2, 9:14 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Sat, 2007-06-02 at 14:54 -0700, [EMAIL PROTECTED] wrote: > > Oh no, that can not be! I just r

Re: Request specific data in generic views

2007-06-04 Thread Nathaniel Whiteinge
If you're using generic views your templates should already have the `user` object in their context. You should be able to just use {{ user }} to get the current user's username. - whiteinge On Jun 4, 8:51 am, konryd <[EMAIL PROTECTED]> wrote: > Is it possible to send usern

Re: Using decoupled urls.py and generic views

2007-09-14 Thread Nathaniel Whiteinge
ot;xgm.AbbrDB.views", (r"^$", "search"), (r'^list/$', object_list, info_dict), ) urlpatterns += patterns("django.views.generic.list_detail", (r'^list/$', 'object_list', info_dict), )

Re: Using decoupled urls.py and generic views

2007-09-14 Thread Nathaniel Whiteinge
Whoops, mind the typo. Should be:: urlpatterns = patterns("xgm.AbbrDB.views", (r"^$", "search"), ) urlpatterns += patterns("django.views.generic.list_detail", (r'^list/$', 'object_list', info_dict), ) --~--~-~--~~~---~--~~ You rece

Re: Downloadable HTML documentation?

2007-09-30 Thread Nathaniel Whiteinge
On Sep 30, 2:23 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Given the age of that ticket, however, is the procedure that "requires > a bit of work" documented anywhere? Or you could just use SmileyChris' implementation [1]_ for now (which works well). .. [1] http://smileychris.tactful.c

Re: Example for update_object

2007-10-24 Thread Nathaniel Whiteinge
ww.djangoproject.com/documentation/newforms/#using-forms-in-views-and-templates .. [4] http://www.djangoproject.com/documentation/newforms/#form-for-instance The only generic views that are currently not working are create and update. - whiteinge --~--~-~--~~~-

Re: Problem get_FOO_url in development server

2007-10-29 Thread Nathaniel Whiteinge
Did you include the port in your MEDIA_URL setting? [1]_ MEDIA_URL = 'http://localhost:8000/media/' .. [1] http://www.djangoproject.com/documentation/settings/#media-url - whiteinge On Oct 29, 4:30 am, Przemek Gawronski <[EMAIL PROTECTED]> wrote: > Hi, the ImageField

Re: First post thanks and question.

2007-10-29 Thread Nathaniel Whiteinge
ordering = ('first', 'last') .. [1] http://www.djangoproject.com/documentation/model-api/#id7 .. [2] http://www.djangoproject.com/documentation/model-api/#ordering Cheers! - whiteinge --~--~-~--~~~---~--~~ You received this message because yo

Re: Example for update_object

2007-10-29 Thread Nathaniel Whiteinge
> What's is your opinion about how long it takes until these forms are > implemented with newforms in SVN? The devs work on Django in their spare time, so there isn't a strict timetable for updates. My advice is not to wait -- forge ahead using the afore-mentioned snippet or regular views. Keep

Re: admin customization for foreign key

2007-10-29 Thread Nathaniel Whiteinge
give you a quick yes-or-no view. .. [1] http://www.djangoproject.com/documentation/model-api/#many-to-one-relationships .. [2] http://www.djangoproject.com/documentation/model-api/#list-display Maybe someone else will have a suggestion that makes mine look silly. Either way, good luck! - whiteing

Re: django.contrib.auth.views.password_change how to

2007-10-31 Thread Nathaniel Whiteinge
f the template: http://code.djangoproject.com/browser/django/trunk/django/contrib/admin/templates/admin/login.html - whiteinge On Oct 31, 10:26 am, Gigs_ <[EMAIL PROTECTED]> wrote: > can anyoune give me simple example how to use: > django.contrib.auth.views.password_c

Re: Foreign key drop down not updating in newforms

2008-01-02 Thread Nathaniel Whiteinge
ModelChoiceField instead -- it'll handle all that ForeignKey business for you automatically. It not currently documented, but you can find example usage here [1] (use your browser's find). .. [1] http://www.djangoproject.com/documentation/models/model_forms/ Cheers. - whiteinge --~--~--