Re: user full name in template

2011-02-04 Thread Andres Lucena
On Fri, Feb 4, 2011 at 6:24 AM, Bobby Roberts wrote: > here's what i'm trying > > from django.contrib.auth import authenticate, login, logout > #import django user modules > from django.contrib.auth.models import User > > def ShowMainMenu (request): >        fullname=User.first_name + ' ' + User.l

Re: user full name in template

2011-02-04 Thread Ivo Brodien
> Don't forget the login_required decorator, because if an anonymous > user try to get that page he will get an exception (I think, didn't > try that) No, they will be redirected to login and after login they come back to the original page, if the form considers the ’next’ field. How nice is tha

Re: No POST response when using checkbox form

2011-02-04 Thread Daniel Roseman
On Friday, February 4, 2011 12:35:20 AM UTC, Ethan Yandow wrote: > > Hey there, I am trying to delete Events as chosen by a by a user using > check boxes to check of which events they want to be deleted. But for > some reason whenever I call request.POST.get('event_list') Nothing is > received

Re: No POST response when using checkbox form

2011-02-04 Thread Daniel Roseman
On Friday, February 4, 2011 9:24:48 AM UTC, Daniel Roseman wrote: > > On Friday, February 4, 2011 12:35:20 AM UTC, Ethan Yandow wrote: >> >> Hey there, I am trying to delete Events as chosen by a by a user using >> check boxes to check of which events they want to be deleted. But for >> some rea

Re: Submitting Django forms with AJAX

2011-02-04 Thread Daniel Roseman
On Friday, February 4, 2011 1:41:36 AM UTC, mf wrote: > > I want to have a little feedback form in one of my views but I can't > get it to work. I put a pdb.set_trace() to debug the views but when I > click submit the view reloads and never gets into the if > request.method == 'POST' and... code

Passing variables to template filters

2011-02-04 Thread Andres Lucena
Hi, In my base.html I'm trying to do this: {% block title %}{{title|default:"{{SITE_NAME}}"}}{% endblock %} But I'm getting this: TemplateSyntaxError at / default requires 1 arguments, 0 provided So, SITE_NAME is not passed to the filter. As a workaround I did this: {% block

Re: user full name in template

2011-02-04 Thread Andres Lucena
On Fri, Feb 4, 2011 at 10:23 AM, Ivo Brodien wrote: > >> Don't forget the login_required decorator, because if an anonymous >> user try to get that page he will get an exception (I think, didn't >> try that) > > No, they will be redirected to login and after login they come back to the > original

Redirecting to personal pages.

2011-02-04 Thread balu
Hi all :) I'm trying to create a website application using django's built in authenticaiton app. I had customized the login, logout, signup... template. But how to customize personal page which will be redirected after login confirmation. Which will be just how we redirected to our inbox after aut

Re: Redirecting to personal pages.

2011-02-04 Thread Andres Lucena
On Fri, Feb 4, 2011 at 10:59 AM, balu wrote: > Hi all :) > > I'm trying to create a website application using django's built in > authenticaiton app. I had customized the login, logout, signup... > template. But how to customize personal page which will be redirected > after login confirmation. Wh

Re: Passing variables to template filters

2011-02-04 Thread Tom Evans
On Fri, Feb 4, 2011 at 9:53 AM, Andres Lucena wrote: > Hi, > > In my base.html I'm trying to do this: > >        {% block title %}{{title|default:"{{SITE_NAME}}"}}{% > endblock %} > > But I'm getting this: > > TemplateSyntaxError at / > default requires 1 arguments, 0 provided > > So, SITE_NAME is

Re: Passing variables to template filters

2011-02-04 Thread Andres Lucena
On Fri, Feb 4, 2011 at 11:07 AM, Tom Evans wrote: > On Fri, Feb 4, 2011 at 9:53 AM, Andres Lucena wrote: >> Hi, >> >> In my base.html I'm trying to do this: >> >>        {% block title %}{{title|default:"{{SITE_NAME}}"}}{% >> endblock %} >> >> But I'm getting this: >> >> TemplateSyntaxError at /

Change null representation when you're using choices widget.

2011-02-04 Thread Marc Aymerich
Hi In some choices widgets I want to represent null values as u'No period' instead of u'' I try with: PERIOD_CHOICES = getattr(settings, 'PERIOD_CHOICES', ((None, ugettext('No Period')),

Re: Change null representation when you're using choices widget.

2011-02-04 Thread Tom Evans
On Fri, Feb 4, 2011 at 11:07 AM, Marc Aymerich wrote: > Hi > In some choices widgets I want to represent null values as u'No > period' instead of u'' > > I try with: > > PERIOD_CHOICES = getattr(settings, 'PERIOD_CHOICES', >                                                     ((None, > uge

Re: store superuser permamently

2011-02-04 Thread Jaroslav Dobrek
On 3 Feb., 15:19, Ivo Brodien wrote: > > What do I have to do to avoid having to define a superuser each time? > > you can dump the data of the auth app and than load it again. > > s.th. like this: > > ./manage.py dumpdata --indent=4 auth  > fixtures/auth.json > ./manage.py dumpdata --indent=4 s

Re: Submitting Django forms with AJAX

2011-02-04 Thread mf
Thanks Daniel, I made the change but I see no different results. On Feb 4, 6:29 am, Daniel Roseman wrote: > On Friday, February 4, 2011 1:41:36 AM UTC, mf wrote: > > > I want to have a little feedback form in one of my views but I can't > > get it to work. I put a pdb.set_trace() to debug the vie

Re: user full name in template

2011-02-04 Thread Thomas
which django version do you use? the current 'head' version shows in django/contrib/auth/models.py: ---8<--- 200 class User(models.Model): 201 """ 202 Users within the Django authentication system are represented by this model. 203 204 Username and password are required. Other fie

Re: Submitting Django forms with AJAX

2011-02-04 Thread David De La Harpe Golden
On 04/02/11 01:41, mf wrote: > I'm very confused about > how to approach ajax forms submission with django. I would suggest the ajaxForm plugin. http://jquery.malsup.com/form/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this gr

Personalise activation from email django registration 0.8

2011-02-04 Thread Alex
Hi, Thanks for the nice sugar of django registration. Has anyone figured out how to get the username of a new user account into the activation email? Personalising the experience is more likely to get activation clicked. Ideas? Thanks in advance, Alex -- You rec

Re: help with foreign keys in admin

2011-02-04 Thread Derek
Python is amazingly good at many things... but mind reading is not one of them yet ;) On Feb 3, 3:08 pm, Bobby Roberts wrote: > nevermind... it was a case issue... you know if python knows there's > an error with case  it would just say "hey check the case here" > > On Feb 3, 12:31 am, Karl Bowde

Re: Redirecting to personal pages.

2011-02-04 Thread balu
How "next" parameter works? On Feb 4, 3:04 pm, Andres Lucena wrote: > On Fri, Feb 4, 2011 at 10:59 AM, balu wrote: > > Hi all :) > > > I'm trying to create a website application using django's built in > > authenticaiton app. I had customized the login, logout, signup... > > template. But how to

Re: Submitting Django forms with AJAX

2011-02-04 Thread Antônio Ribeiro
Well, I've never seen this method before "request.is_ajax()", so i went to documentation. And here what i've found: *"Returns True if the request was made via an XMLHttpRequest, by checking the HTTP_X_REQUESTED_WITH header for the string 'XMLHttpRequest'."* * * So I though the jQuery already sends

Re: Redirecting to personal pages.

2011-02-04 Thread Brian Bouterse
Did you read the link in documentation? In case you missed it [1]. Brian [1] http://docs.djangoproject.com/en/dev/topics/auth/ On Fri, Feb 4, 2011 at 8:51 AM, balu wrote: > How "next" parameter works? > > On Feb 4, 3:04 pm, Andres Lucena wrote: > > On Fri, Feb 4, 2011 at 10:59 AM, balu wr

Re: Submitting Django forms with AJAX

2011-02-04 Thread Tom Evans
2011/2/4 Antônio Ribeiro : > Well, I've never seen this method before "request.is_ajax()", so i went to > documentation. > And here what i've found: > "Returns True if the request was made via an XMLHttpRequest, by checking > the HTTP_X_REQUESTED_WITH header for the string 'XMLHttpRequest'." > So I

Re: Submitting Django forms with AJAX

2011-02-04 Thread Antônio Ribeiro
You're right! Sorry, my mistake. On 4 February 2011 11:06, Tom Evans wrote: > 2011/2/4 Antônio Ribeiro : > > Well, I've never seen this method before "request.is_ajax()", so i went > to > > documentation. > > And here what i've found: > > "Returns True if the request was made via an XMLHttpRequ

Re: Change null representation when you're using choices widget.

2011-02-04 Thread Marc Aymerich
On Fri, Feb 4, 2011 at 12:12 PM, Tom Evans wrote: > On Fri, Feb 4, 2011 at 11:07 AM, Marc Aymerich wrote: >> Hi >> In some choices widgets I want to represent null values as u'No >> period' instead of u'' >> >> I try with: >> >> PERIOD_CHOICES = getattr(settings, 'PERIOD_CHOICES', >>    

Re: Change null representation when you're using choices widget.

2011-02-04 Thread Marcos Moyano
Remove (None, "No Period") from your choices and left the required=False on your form field. That should work. Rgds, Marcos On Fri, Feb 4, 2011 at 11:31 AM, Marc Aymerich wrote: > On Fri, Feb 4, 2011 at 12:12 PM, Tom Evans > wrote: > > On Fri, Feb 4, 2011 at 11:07 AM, Marc Aymerich > wrote: >

Re: Change null representation when you're using choices widget.

2011-02-04 Thread Marc Aymerich
On Fri, Feb 4, 2011 at 3:31 PM, Marc Aymerich wrote: > On Fri, Feb 4, 2011 at 12:12 PM, Tom Evans wrote: >> On Fri, Feb 4, 2011 at 11:07 AM, Marc Aymerich wrote: >>> Hi >>> In some choices widgets I want to represent null values as u'No >>> period' instead of u'' >>> >>> I try with: >>>

Re: Change null representation when you're using choices widget.

2011-02-04 Thread Marcos Moyano
s/left/leave/ sorry fot the double post. On Fri, Feb 4, 2011 at 11:37 AM, Marcos Moyano wrote: > Remove (None, "No Period") from your choices and left the required=False on > your form field. That should work. > > Rgds, > Marcos > > > On Fri, Feb 4, 2011 at 11:31 AM, Marc Aymerich wrote: > >> On

Re: Change null representation when you're using choices widget.

2011-02-04 Thread Marc Aymerich
On Fri, Feb 4, 2011 at 3:37 PM, Marcos Moyano wrote: > Remove (None, "No Period") from your choices and left the required=False on > your form field. That should work. > but I wanted to do was to change the default value of null value: instead of '--' I want to show "No Period". this seems to

Re: No POST response when using checkbox form

2011-02-04 Thread Ethan Yandow
aahhh yes!!! Thank you very much!!! Alright, ill work on implementing those form views :) On Fri, Feb 4, 2011 at 4:25 AM, Daniel Roseman wrote: > On Friday, February 4, 2011 9:24:48 AM UTC, Daniel Roseman wrote: >> >> On Friday, February 4, 2011 12:35:20 AM UTC, Ethan Yandow wrote: >>> >>> Hey t

Re: Custom/Inclusion Tags

2011-02-04 Thread J J
I have a inclusion tag that needs to access a named param in the url. From what I understand inclusion tags can only get information from RequestContext. I seem to have solved my problem by putting the value into RequestContext from the view that calls the page /main/site/01/2011. Is this the co

Re: IE, CSRF and admin login

2011-02-04 Thread MikeKJ
In case anyone else hits this little nasty IE doesn't know what to do with underscored sub domains as far as cookies and therefore csrf_token so dont do as I did and create a subdomain site for development using an underscored name and end up looking for a non existant needle... thank

Re: Custom/Inclusion Tags

2011-02-04 Thread bruno desthuilliers
On 4 fév, 16:19, J J wrote: > I have a inclusion tag that needs to access a named param in the url.  From > what I understand inclusion tags can only get information from > RequestContext. > > I seem to have solved my problem by putting the value into RequestContext > from the view that calls the

forms and models

2011-02-04 Thread CrabbyPete
I have the following code: def sites(request): if 'url' in request.GET: url = request.GET['url'] website = WebSite.objects.get( url = url ) form = WebSiteForm(instance = website) return submit_web_form( request, form ) else: form = WebSiteForm(reque

Re: help understanding mptt/treebeard

2011-02-04 Thread Tim
Hi Jason, Thanks for explaining. I suppose I was trying to make my problem harder than it really is. My answer for the problem of a user who wants to remove or insert a chapter is to use a field called 'sequence_number'. If a user deletes or adds a chapter, I have a pre-save function that (1) loo

Stats for: Optimizing Django database access : some ideas/experimentshttp://blog.bootstraptoday.com

2011-02-04 Thread Anand Agarwal
http://blog.bootstraptoday.com/2011/02/04/optimizing-django-database-access-some-ideasexperiments/ caching at connection manager level has saved us lots of calls to database. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group

Re: Custom/Inclusion Tags

2011-02-04 Thread Tom Evans
On Fri, Feb 4, 2011 at 3:30 PM, bruno desthuilliers wrote: > On 4 fév, 16:19, J J wrote: >> I have a inclusion tag that needs to access a named param in the url.  From >> what I understand inclusion tags can only get information from >> RequestContext. >> >> I seem to have solved my problem by pu

Re: No POST response when using checkbox form

2011-02-04 Thread Ethan Yandow
Hmmm, I am having a hard time understanding the django forms... Would someone mind giving me an example of how I would list my events with check boxes next to them please :) On Fri, Feb 4, 2011 at 10:07 AM, Ethan Yandow wrote: > aahhh yes!!! Thank you very much!!! Alright, ill work on implement

Re: Stats for: Optimizing Django database access : some ideas/experimentshttp://blog.bootstraptoday.com

2011-02-04 Thread Tom Evans
On Fri, Feb 4, 2011 at 3:49 PM, Anand Agarwal wrote: > > http://blog.bootstraptoday.com/2011/02/04/optimizing-django-database-access-some-ideasexperiments/ > > caching at connection manager level has saved us lots of calls to database. > > And simultaneously made this behaviour broken: >>> f = F

Re: IE, CSRF and admin login

2011-02-04 Thread Tom Evans
On Fri, Feb 4, 2011 at 3:14 PM, MikeKJ wrote: > > > In case anyone else hits this little nasty > > IE doesn't know what to do with underscored sub domains as far as cookies > and therefore csrf_token > so dont do as I did and create a subdomain site for development using an > underscored name

Re: No POST response when using checkbox form

2011-02-04 Thread Shawn Milochik
Here's the main piece: http://docs.djangoproject.com/en/1.2/ref/forms/ Just make a form with a boolean field. When you've successfully made one form that you submit, validate, and act upon, just throw a bunch in a formset: http://docs.djangoproject.com/en/1.2/topics/forms/formsets/ If you get

Admin change view and extra form field.

2011-02-04 Thread Marc Aymerich
I have an AdminModel with an overridden form, just for having an extra form field called 'limit'. This field 'limit' is stored in a separated model. Until here I haven't any problem. Now I want to show the saved 'limit' value when I am on admin change_view. Unfortunately the admin change_view met

Re: Admin change view and extra form field.

2011-02-04 Thread Marc Aymerich
On Fri, Feb 4, 2011 at 5:23 PM, Marc Aymerich wrote: > I have an AdminModel with an overridden form, just for having an extra > form field called 'limit'. > > This field 'limit' is stored in a separated model. Until here I > haven't any problem. > > Now I want to show the saved 'limit' value when

Re: No POST response when using checkbox form

2011-02-04 Thread Tom Evans
On Fri, Feb 4, 2011 at 4:20 PM, Shawn Milochik wrote: > Here's the main piece: > http://docs.djangoproject.com/en/1.2/ref/forms/ > Just make a form with a boolean field. > When you've successfully made one form that you submit, validate, and act > upon, just throw a bunch in a formset: > http://do

Charfield, limiting acceptable characters

2011-02-04 Thread ozgur yilmaz
Hi there, I want to limit the characters for a charfield with [a-z\-] (characters from a to z (lowercase) and '-' ) Is there any way you know? 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

Re: Charfield, limiting acceptable characters

2011-02-04 Thread Shawn Milochik
The easiest thing to do is override the clean on your form. Shawn -- 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+un

Re: Charfield, limiting acceptable characters

2011-02-04 Thread ozgur yilmaz
It was possible in the past with validator_list. Like: regex = r'^[A-z][\w-]{2,31}$' name = models.CharField(max_length=32, unique=True , validator_list=[validators.MatchesRegularExpression(regex)] ) But with what code to override the clean method? Is there any sample or built in function for t

Re: Charfield, limiting acceptable characters

2011-02-04 Thread Shawn Milochik
On Feb 4, 2011, at 2:47 PM, ozgur yilmaz wrote: > It was possible in the past with validator_list. Like: > > regex = r'^[A-z][\w-]{2,31}$' > name = models.CharField(max_length=32, unique=True , > validator_list=[validators.MatchesRegularExpression(regex)] ) > > But with what code to override t

Re: Charfield, limiting acceptable characters

2011-02-04 Thread Łukasz Rekucki
On 4 February 2011 20:47, ozgur yilmaz wrote: > It was possible in the past with validator_list. Like: > > regex = r'^[A-z][\w-]{2,31}$' > > name = models.CharField(max_length=32, unique=True , > validator_list=[validators.MatchesRegularExpression(regex)] ) > It still is? http://docs.djangoprojec

Re: Charfield, limiting acceptable characters

2011-02-04 Thread ozgur yilmaz
Yes, i know overriding field cleand method, but i couldnt get a start point for character match code. 2011/2/4 Shawn Milochik > > On Feb 4, 2011, at 2:47 PM, ozgur yilmaz wrote: > > It was possible in the past with validator_list. Like: > > regex = r'^[A-z][\w-]{2,31}$' > > name = models.CharFie

Re: Admin inline adding one too many extra rows to the form

2011-02-04 Thread Brent
I'm having the same issue. Will post if I discover the solution. On Dec 14 2010, 12:09 pm, Nick wrote: > I have three models. Two are inlines of another model in the Admin. I > have their extra parameters set to 0 so: > > class model1(admin.StackedInline): >     model = Model1 >     extra = 0 >

Re: Charfield, limiting acceptable characters

2011-02-04 Thread ozgur yilmaz
Maybe RegexValidator can solve this problem. But i couldnt manage to use it: from django.core.validators import RegexValidator alias = models.CharField( max_length = 100, unique = True, validators=[RegexValidator('[a-z]')] ) 2011/2/4 ozgur yilmaz > Yes, i know overriding field cleand method,

Re: Charfield, limiting acceptable characters

2011-02-04 Thread ozgur yilmaz
Ok, solved the problem. Thanks Lukasz and thanks to all... from django.core.validators import RegexValidator import re namespace_regex = re.compile(r'^[a-z\-]+$') alias = models.CharField( max_length = 100, unique = True, validators=[RegexValidator(regex=namespace_regex)] ) 2011/2/4 ozgur yilmaz

How to know if is a update or insert??

2011-02-04 Thread andmart
Hi, I overrided the save_model of ModelAdmin of model Client that is associated a one User so I can create a user when a client is created. Well, how to know if the save_model was called to do a update or a insert if the object already exists in database? Trying to see if model.pk exists fail.

Help on adding CSS to django project

2011-02-04 Thread h@ck5t0ck
Hi guys, am very new to django and am having troubles adding css to my pages even though i've found some tutorials online and followed it word for word. Can anyone please help me urgently? I really appreciate your help. Best Wishes, h@ck5t0ck -- You received this message because you are subscribe

Re: Help on adding CSS to django project

2011-02-04 Thread ozgur yilmaz
In your template: In your urls.py: site_media = os.path.join(os.path.dirname(__file__),'site_media') urlpatterns = patterns('', (r'^site_media/(?P.*)$' , 'django.views.static.serve',{'document_root':site_media}), ) Maybe helps... 2011/2/4 h@ck5t0ck > Hi guys, > am very new to d

Re: How to know if is a update or insert??

2011-02-04 Thread ozgur yilmaz
try: old_user = User.objects.get(pk=self.pk) # means update except: pass 2011/2/4 andmart > Hi, > > I overrided the save_model of ModelAdmin of model Client that is > associated a one User so I can create a user when a client is created. > > Well, how to know if the save_model was ca

Re: Help on adding CSS to django project

2011-02-04 Thread h@ck5t0ck
Hi, Thanks for your quick reply. I tried what you showed me but it didn't work. Below are the contents of my settings.py and urls.py files. Could you please study them and point out where am going wrong? SETTINGS.PY === import os DEBUG = Tru

Re: How to know if is a update or insert??

2011-02-04 Thread Marc Aymerich
On Fri, Feb 4, 2011 at 10:13 PM, andmart wrote: > Hi, > > I overrided the save_model of ModelAdmin of model Client that is > associated a one User so I can create a user when a client is created. > > Well, how to know if the save_model was called to do a update or a > insert if the object already

Re: Help on adding CSS to django project

2011-02-04 Thread W. Craig Trader
The exact method of adding media resources to a Django application will depend on a number of factors (OS, Webserver, project layout) but it's fairly straight-forward. Here's the approach that I use: Assume that my Django project is named 'foo' and that any media (CSS, Javascript, etc) files I wa

Re: Help on adding CSS to django project

2011-02-04 Thread Chris Hannam
> > Hi guys, > am very new to django and am having troubles adding css to my pages > even though i've found some tutorials online > and followed it word for word. Hi, The way I have approached this is to have a static dir set in my urls.py: -- You received this message because you are subscribe

Re: Help on adding CSS to django project

2011-02-04 Thread Chris Hannam
Apologies for that premature send: > Hi, > The way I have approached this is to have a static dir set in my urls.py: > > (r'^static/(?P.*)$', 'django.views.static.serve', { 'document_root': settings.MEDIA_ROOT } ) settings.py has the following MEDIA_ROOT = os.path.join(PATH

Re: Amazing work

2011-02-04 Thread Kenneth Gonsalves
On Fri, 2011-02-04 at 01:02 +, Cal Leeming [Simplicity Media Ltd] wrote: > May I ask, how well did you get along with Zope? From what I can tell, > Django is suited for SME, where as Zope is the kinda thing that banks > would > be using etc. as long as one sticks to out of the box stuff and z

Having trouble creating instances of another model in the __init__ of one model

2011-02-04 Thread Daniel Klein
I'm teaching myself django by idling poking at a project in the hope that it may become a playable browser game some day. It's early days. So I have a model "Game", which is one game session. Each game is supposed to have two teams. I doubt the content of the Team model matters very much, so I