Re: CSRF verification failed when I use smart phone

2015-06-26 Thread Wim Feijen
Thanks Gergely, 

That solved it for me. 

Wim

On Sunday, 31 May 2015 09:58:32 UTC+2, Gergely Polonkai wrote:
>
> I had this error when I had two Django application with the same domain 
> and both with the same (default) CSRF cookie name. Changing the cookie name 
> to something different solved the issue.
> On 30 May 2015 22:30, "Michael Greer"  
> wrote:
>
>> We have started seeing this behavior occasionally. No code change in this 
>> area, but sometimes (esp on phones) the CSRF cookie is wrong.
>>
>> Our guess is too many cookies on the domain, but it is difficult to prove 
>> this. Indeed, opening a new browser session resolves it... temporarily.
>>
>> -Mike
>>
>> On Tuesday, January 6, 2015 at 3:09:46 AM UTC-6, Sugita Shinsuke wrote:
>>>
>>> Hello.
>>>
>>> When I use Django via my smart phone Android and iOS.
>>> The error sometimes occurred.
>>>
>>> Forbidden (403)
>>> CSRF verification failed. Request aborted.
>>> Help
>>> Reason given for failure:
>>> CSRF token missing or incorrect.
>>>
>>> In general, this can occur when there is a genuine Cross Site Request 
>>> Forgery, or when Django's CSRF mechanism has not been used correctly. For 
>>> POST forms, you need to ensure:
>>> Your browser is accepting cookies.
>>> The view function uses RequestContext for the template, instead of 
>>> Context.
>>> In the template, there is a {% csrf_token %} template tag inside each 
>>> POST form that targets an internal URL.
>>> If you are not using CsrfViewMiddleware, then you must use csrf_protect 
>>> on any views that use the csrf_token template tag, as well as those that 
>>> accept the POST data.
>>> You're seeing the help section of this page because you have DEBUG = 
>>> True in your Django settings file. Change that to False, and only the 
>>> initial error message will be displayed.
>>> You can customize this page using the CSRF_FAILURE_VIEW setting.
>>>
>>> I append django.middleware.csrf.CsrfViewMiddleware', of 
>>> MIDDLEWARE_CLASSES in settings.py
>>>
>>> I use
>>> Python 2.7.5
>>> Django 1.6.4
>>>
>>> Anyone who know this matter, please help.
>>>
>>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/89d20584-d3bf-4104-b642-0f519c4deb10%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4e3014c1-5753-405e-9341-de8c1f62c750%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: session_key varies

2013-06-07 Thread Wim Feijen
Hi Tom,

Thanks for making this clear!

Now I explicitly save the session and everything works as supposed.

Thanks again!

Wim


On 3 June 2013 15:19, Tom Evans <tevans...@googlemail.com> wrote:

> On Mon, Jun 3, 2013 at 11:48 AM, Wim Feijen <w...@go2people.nl> wrote:
> > Hi,
> >
> > Is it normal that a session_key varies when a user is not logged in? And
> if
> > so, should I then use request.COOKIES instead to store information in?
> >
> > In one of my projects, users can order a calendar and upload their own
> > photos, one for each month. In between, I like to keep track of which
> photos
> > have been uploaded to a certain calendar. Users don't need to login to do
> > this.
> >
> > First, I was using the session_key to keep track of a calendar order,
> but I
> > noticed that the key kept on varyingr when a colleague on a Mac clicked a
> > button.
> >
> > Now I am wondering whether this is normal behavior, or can I do
> something to
> > prevent it.
> >
> > And should I use request.COOKIES instead?
> >
> > Thanks for your help!
> >
> > Wim
> >
>
> Hi Wim
>
> In fact, what happens is that the session id will not be fixed unless
> the session has been persisted, ie something has been put inside the
> session and the session saved.
>
> Basically, the code flow is like this:
>
> Session backend initiated with session id=None
> You print out/access request.session.session_id
> Accessing the session id if there is no current session id causes a
> new session id to be generated.
> The session referred to by the session id is only persisted into the
> database if the session is modified.
> Simply accessing the session id is not sufficient to mark the session
> as modified
> Since the session was not saved, the session cookie is not sent to the
> client.
> The client reloads the page, with no session id cookie
> Session backend initiated with session id=None
>
> Probably in your unauthenticated scenario, the session is completely
> untouched, and therefore the (apparent) session id fluctuates between
> requests, because a new session id is created for each request until
> something on the request uses the session.
>
> Cheers
>
> Tom
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/QADDLwsCeFI/unsubscribe?hl=en
> .
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>


-- 
Wim Feijen
Eigenaar

*Wij zijn verhuisd:*
Go2People Websites
La Guardiaweg 88 (toren B)
1043 DK Amsterdam

T:  088 170 0718 (tijdelijk) / 06  3316
W: http://go2people-websites.nl

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Deployment Conundrum

2013-06-03 Thread Wim Feijen
Hi Daniel,

I would definitely recommend ordering a small VPS (costs: maybe 10 euros a 
month) and go from there.

Wim

On Sunday, 2 June 2013 09:37:11 UTC+2, Daniel Braun wrote:
>
> Hello,
> I'm working in a non-profit organization. It's a design archive and 
> research institute based in Israel.
> We're developing (me actually, the only developer) a Django website to 
> replace our ASP/MS-Access horrible system.
>
> To the point - the only server I am allocated by the IT department is a 
> Windows 2008 server.
> I'm currently working with Heroku, and needless to say, deployment is a 
> breeze.
> (Would love to stay with it, except I don't have the budget to pay for 
> heroku/s3)
>
> I realize I can run apache as a server, or even IIS. But how do I go about 
> replicating heroku's deployment process (with git)?
> Is it viable to install a Ubuntu server virtual machine on top of the 
> Windows installation? Does anyone have experience with it?
>
> I apologize if this post is confusing, I am myself a little confused...
>
> Thanks, Daniel
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: different admin form if adding a record

2013-06-03 Thread Wim Feijen
Hi Christian,

I recommend defining your own ModelForm and using that in the admin. For an 
example using a custom form, see: 
https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.form

But why don't you want a choicefield in the admin then?

Regards, Wim

On Monday, 3 June 2013 10:13:07 UTC+2, Christian Schulz wrote:
>
> Hi ,
>
> I'm a newbie in django and wondering what is the most easy way to change 
> the "behavoir"  if I add a record for a model.
>
> class AttributeMapping(models.Model):
>#In the standard admin view I like a CharField to see filled entries
>field = models.CharField(max_length=100)
>#In the add case I like a choice a field
>#field = models.CharField(max_length=100,choices=fields)
>
> Many thanks,
> Christian
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




session_key varies

2013-06-03 Thread Wim Feijen
Hi,

Is it normal that a session_key varies when a user is not logged in? And if 
so, should I then use request.COOKIES instead to store information in?

In one of my projects, users can order a calendar and upload their own 
photos, one for each month. In between, I like to keep track of which 
photos have been uploaded to a certain calendar. Users don't need to login 
to do this. 

First, I was using the session_key to keep track of a calendar order, but I 
noticed that the key kept on varyingr when a colleague on a Mac clicked a 
button.

Now I am wondering whether this is normal behavior, or can I do something 
to prevent it. 

And should I use request.COOKIES instead? 

Thanks for your help!

Wim 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: how to import excel file into django models?

2013-06-03 Thread Wim Feijen
Hi,

Yesterday I did some research on this topic and I would like to recommend 
looking at examples on github, for example:
https://github.com/edcrewe/django-csvimport
or
https://github.com/foreveryh/django-excel-import

But I didn't use any of them, because I decided to re-use my own code.

Wim


On Monday, 3 June 2013 08:22:11 UTC+2, Derek wrote:
>
> Just a small clarification - xlrd runs on both Windows and Linux and would 
> be the recommended way to go here.
>
> Otherwise I agree with Vernon - create a base xlrd_reader class, to handle 
> generic reading and data checking, and then have model-specific routines 
> that handle assignment of data to specific fields.  There is a ton of 
> example code for xlrd on the web, and some with examples for Django.  My 
> code works with forms that let the user specify which columns are being 
> used for what, rather than a command-line approach.  How you handle this 
> aspect depends on your use case...
>
> Derek
>
> On Sunday, 2 June 2013 21:44:53 UTC+2, Vernon D. Cole wrote:
>>
>> I have used two methods -- one works only on Windows, the other is cross 
>> platform -- and you have said nothing about your application so it is hard 
>> to advise...
>>
>> If you know Windows and SQL -- then use adobapi and open the spreadsheet 
>> as a table (see examples at http://sourceforge.net/projects/adodbapi) 
>> and read it using SQL SELECT commands.
>>
>> If you are on Linux, then xlrd is your friend.  (Find it on pypi or 
>> http://www.python-excel.org/)  In my case, the spreadsheet was large, 
>> and the columns moved around from time to time, so I wrote a mini-ORM 
>> (xlrd_helper) to allow me to refer to the spreadsheet columns by name, 
>> rather than by number, and handle the idiosyncrasies of my application.  I 
>> have been working on this for several months, but my work is too 
>> application specific to publish.  (You probably do not need to do automatic 
>> spelling correction for the names of Nigerian villages.)  The python code 
>> which does the import is implemented as a set of manage.py command scripts.
>> --
>> Vernon Cole
>>
>> On Saturday, June 1, 2013 3:21:33 AM UTC-6, Ali hallaji wrote:
>>>
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




image browsing from a textfield

2013-01-28 Thread Wim Feijen
Hello, 

For an e-learning app in development, we want editors to be able to edit 
html (TextField) within our app (not the admin), and insert formatted text, 
images and (Vimeo) video in there.

At the moment, I am looking into using TinyMCE (django-tinymce) combined 
with django-filebrowser. During my research, I came across many other 
solutions (Mezzanine, markup, django-adminfiles, oembed).

I am curious at what solutions you chose in order to edit html with images 
and why?

Best regards, Wim

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: How to use SESSION_COOKIE_DOMAIN on two subdomains

2011-09-19 Thread Wim Feijen
After reading the documentation again, and spending some time on
django-debug-toolbar, and watching the cookies in an Opera clean of
any other cookies, I believe we are running into a bug, and I filed a
ticket which you can see here:

https://code.djangoproject.com/ticket/16879

- Wim

On Sep 18, 7:58 am, Wim Feijen <wimfei...@gmail.com> wrote:
> Hello,
>
> I'd like to share the same session across two subdomains, namely:
> crm.trumpetcms.nl
> wtsadvocaten.trumpetcms.nl
>
> Do I have to set the SESSION_COOKIE_DOMAIN in both settings.py files?
> Or just in one?
>
> Is this line correct?
> SESSION_COOKIE_DOMAIN = '.trumpetcms.nl'
>
> I am hosting the projects using an apache/nginx combination and
> virtual hosts.
>
> In Google Chrome, Incognito mode, what happens is, when I log into the
> server at:http://wtsadvocaten.trumpetcms.nl/admin/
>
> I'm still begin asked to login at:http://crm.trumpetcms.nl/
>
> I am using Django 1.3.0.
>
> Any help will be very much appreciated, 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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



How to use SESSION_COOKIE_DOMAIN on two subdomains

2011-09-17 Thread Wim Feijen
Hello,

I'd like to share the same session across two subdomains, namely:
crm.trumpetcms.nl
wtsadvocaten.trumpetcms.nl

Do I have to set the SESSION_COOKIE_DOMAIN in both settings.py files?
Or just in one?

Is this line correct?
SESSION_COOKIE_DOMAIN = '.trumpetcms.nl'

I am hosting the projects using an apache/nginx combination and
virtual hosts.

In Google Chrome, Incognito mode, what happens is, when I log into the
server at:
http://wtsadvocaten.trumpetcms.nl/admin/

I'm still begin asked to login at:
http://crm.trumpetcms.nl/

I am using Django 1.3.0.

Any help will be very much appreciated, 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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Am I overlooking something or is this a bug in ModelForm?

2011-08-31 Thread Wim Feijen
Hello,

I am using a form which (simplified) looks like this:

class AdvancedSearchForm(forms.ModelForm):
email = forms.CharField(label='Emailadres', required=False)

class Meta:
model = Address
fields = [
'last_name',
'middle_name',
'first_name',
'email',
'street',
]

Because it is a search form, I do not want to validate the e-
mailfield. However, whenever I add 'email' to get the order of the
meta fields right, default email validation is used.

I am very surprised at that. Why doesn't it honor my specified email
field which is a CharField? It should get precedence, right?

Am I overlooking something? Or is this a bug?

For further reading, see:
https://docs.djangoproject.com/en/dev/topics/forms/modelforms/#overriding-the-default-field-types-or-widgets
and: 
https://docs.djangoproject.com/en/dev/topics/forms/modelforms/#changing-the-order-of-fields

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: templatetags and refresh

2011-06-24 Thread Wim Feijen
Thanks Bruno for your detailed advice and attention!

I agree wholeheartedly.

Wim

On Jun 24, 12:53 pm, bruno desthuilliers
 wrote:
> On Jun 24, 11:57 am,WimFeijen wrote:
>
>
>
> > Looking at it again, I saw what was wrong and fixed it! For
> > completeness, I moved the NewsItem query within the NewsItemBlockNode
>
> FWIW, code at the module top-level is only executed when the module is
> first imported. Now you'll know ;)
>
>
>
>
>
>
>
>
>
> > and everything works fine! The current code is:
>
> > import re
>
> > from django.template import Variable, VariableDoesNotExist, Node,
> > Library, Template, TemplateSynta
> > from django.conf import settings
> > from django.utils.safestring import mark_safe
> > from django.utils.html import escape
> > from django.utils.translation import ugettext as _
>
> > register = Library()
>
> > from cms.news.models import NewsItem
> > from django.db.models import Q
> > from datetime import datetime
>
> > class NewsItemBlockNode(Node):
> >     def __init__(self, identifier, field):
> >         self.identifier = str(identifier)
> >         self.field      = str(field)
> >         self.image      = False
>
> >     def render(self, context):
> >         try:
> >             newsitems = NewsItem.objects.filter(Q(expires_at__gt =
> > datetime.now()) | Q(expires_at_
> >         except:
>
> Never use a bare except clause, unless you reraise the exception.
>
>
>
>
>
>
>
>
>
> >             newsitems = None
>
> >         number  = -1
> >         numbers = {
> >             'large':       0,
> >             'large-small': 0,
> >             'small1':      1,
> >             'small2':      2,
> >             'small3':      3,
> >             'small4':      4,
> >             'medium':      5,
> >         }
>
> >         # Only image
> >         if self.field == 'teaser-image':
> >             self.field = 'teaser'
> >             self.image = True
>
> Never change a Node's attributes from within the render method - this
> will screw you sooner or later. Use local variables instead (with the
> added bonus of improved performances - local variables are way faster
> than attribute lookups).
>
> >         if self.identifier in numbers:
> >             number = numbers[self.identifier]
>
> >         try:
> >             newsitem = getattr(newsitems[number], self.field)
>
> >             if type(newsitem).__name__ == 'datetime':
>
> you may want to read about "isintance"
>
> >                 if self.identifier in ['medium', 'large']:
>
> use a tuple instead of a list - it's cheaper.
>
> >                     newsitem = newsitem.strftime('%d [%m] %Y')
>
> >                     newsitem = newsitem.replace('[01]', 'januari')
> >                     newsitem = newsitem.replace('[02]', 'februari')
> >                     newsitem = newsitem.replace('[03]', 'maart')
> >                     newsitem = newsitem.replace('[04]', 'april')
> >                     newsitem = newsitem.replace('[05]', 'mei')
> >                     newsitem = newsitem.replace('[06]', 'juni')
> >                     newsitem = newsitem.replace('[07]', 'juli')
> >                     newsitem = newsitem.replace('[08]', 'augustus')
> >                     newsitem = newsitem.replace('[09]', 'september')
> >                     newsitem = newsitem.replace('[10]', 'oktober')
> >                     newsitem = newsitem.replace('[11]', 'november')
> >                     newsitem = newsitem.replace('[12]', 'december')
>
> You may want to have a read at Django's and Python's localisation
> features...
>
> >                     newsitem = newsitem.upper()
> >                 else:
> >                     newsitem = newsitem.strftime('%d-%m-%Y')
>
> >             if self.image:
> >                 # Filter only image
> >                 src = re.search('', newsitem)
>
> regexps are not the safest way to parse html.
>
> >                 if src and src.group(2):
> >                     newsitem = src.group(2)
> >                 else:
> >                     newsitem = '/media/site/img/blank.gif'
>
> Use named urls and reverse() instead - unless you are happy with
> maintenance headache, of course ;)
>
> >             elif self.field == 'teaser':
> >                 # Filter image
> >                 newsitem = re.sub('', '', newsitem)
> >                 newsitem = re.sub('', '', newsitem)
> >                 newsitem = re.sub('', '', newsitem)
> >                 newsitem = re.sub('', '', newsitem)
>
> Proverbial SquaredWheel alert. Django (and Python) have safer ways to
> strip a text from HTML tags and entities.
>
> >         except:
>
> Same as above. Exceptions and traceback are here to HELP you fixing
> your code, so don't shoot yourself in the foot by silently passing
> them.
>
> HTH

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to 

Re: templatetags and refresh

2011-06-24 Thread Wim Feijen
  'small2':  2,
'small3':  3,
'small4':  4,
'medium':  5,
}

# Only image
if self.field == 'teaser-image':
self.field = 'teaser'
self.image = True

if self.identifier in numbers:
number = numbers[self.identifier]

try:
newsitem = getattr(newsitems[number], self.field)

if type(newsitem).__name__ == 'datetime':
if self.identifier in ['medium', 'large']:
newsitem = newsitem.strftime('%d [%m] %Y')

newsitem = newsitem.replace('[01]', 'januari')
newsitem = newsitem.replace('[02]', 'februari')
newsitem = newsitem.replace('[03]', 'maart')
newsitem = newsitem.replace('[04]', 'april')
newsitem = newsitem.replace('[05]', 'mei')
newsitem = newsitem.replace('[06]', 'juni')
newsitem = newsitem.replace('[07]', 'juli')
newsitem = newsitem.replace('[08]', 'augustus')
newsitem = newsitem.replace('[09]', 'september')
newsitem = newsitem.replace('[10]', 'oktober')
newsitem = newsitem.replace('[11]', 'november')
newsitem = newsitem.replace('[12]', 'december')

newsitem = newsitem.upper()
else:
newsitem = newsitem.strftime('%d-%m-%Y')

if self.image:
# Filter only image
src = re.search('<img(.+)src="(.*?)"(.+)/>', newsitem)

if src and src.group(2):
newsitem = src.group(2)
else:
newsitem = '/media/site/img/blank.gif'
elif self.field == 'teaser':
# Filter image
newsitem = re.sub('', '', newsitem)
newsitem = re.sub('<a.*?>', '', newsitem)
newsitem = re.sub('', '', newsitem)
newsitem = re.sub('', '', newsitem)
except:
newsitem = ''

return mark_safe(newsitem)

@register.tag()
def show_newsitem(parser, token):
try:
tag, identifier, field = token.split_contents()
except ValueError:
raise TemplateSyntaxError('%s needs newsitem number (x latest
newsitem) as an argument.' %

return NewsItemBlockNode(identifier, field)


Thanks Michal and Daniel for your help!

Wim

On Jun 22, 8:24 pm, Daniel Roseman <dan...@roseman.org.uk> wrote:
> On Wednesday, 22 June 2011 14:32:10 UTC+1, Wim Feijen wrote:
>
> > Hello,
>
> > Atwww.mkb-rotterdam.nlwe use a template tag to display NewsItems in
> > different formats on the homepage.
>
> > However, when a new NewsItem is added, it does not appear at once.
>
> > Might this have to do with the fact that we use a template tag to get
> > the NewsItems out of the db?
>
> > Our query is:
>
> > newsitems = NewsItem.objects.filter(Q(expires_at__gt = datetime.now())
> > | Q(expires_at__isnull = True), effective_at__lte = datetime.now(),
> > is_active=True).order_by('-news_timestamp')
>
> > Or is datetime.now() fixed to the past?
>
> > What would be a proper way to solve this then? Maybe add a post-save
> > signal but how could we use this then to refresh the tag?
>
> > If something else is the matter, or just if you're interested: we host
> > our site using a virtual apache + mod_wsgi + nginx.
>
> > Thanks for your help!
>
> > Wim
>
> Please show the full code for the templatetag.
> --
> DR.

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



templatetags and refresh

2011-06-22 Thread Wim Feijen
Hello,

At www.mkb-rotterdam.nl we use a template tag to display NewsItems in
different formats on the homepage.

However, when a new NewsItem is added, it does not appear at once.

Might this have to do with the fact that we use a template tag to get
the NewsItems out of the db?

Our query is:

newsitems = NewsItem.objects.filter(Q(expires_at__gt = datetime.now())
| Q(expires_at__isnull = True), effective_at__lte = datetime.now(),
is_active=True).order_by('-news_timestamp')

Or is datetime.now() fixed to the past?

What would be a proper way to solve this then? Maybe add a post-save
signal but how could we use this then to refresh the tag?

If something else is the matter, or just if you're interested: we host
our site using a virtual apache + mod_wsgi + nginx.

Thanks for your help!

Wim


-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: admin won't load revisited

2011-01-27 Thread Wim Feijen
Hi Octopus,

What do you mean by: "won't load correctedly"?

Is there an admin interface at /admin/ ? If not, did you enable the
admin in your settings.py and in your urls.py?

Is there one or more object missing from the admin interface? If there
is one missing, maybe you've made an error in your admin.py file,
which causes the object not to load in the admin. Comment your
ModelAdmin instances and try again, if necessary go back to the most
basic admin.site.register(MyModel)

Do the static files (css, js) not load? Then maybe your paths in
settings.py are not configured properly.

Hope this helps, and if you need any further assistance please let us
know what exactly is wrong.

Good luck!

Wim


On Jan 27, 10:47 pm, octopusgrabbus  wrote:
> I am running Django 1.2.4 and mod_wsgi. My application is running
> fine.
> My admin won't load correctly.
>
> wsgi_handler.py
> ---
> import os
> import sys
>
> PROJECT_ROOT = os.path.realpath(os.path.dirname(__file__))
> sys.path.append(PROJECT_ROOT)
> sys.path.append(os.path.join('/home/amr/django'))
> sys.path.append(os.path.join('/home/amr/django/amr'))
> sys.path.append(os.path.join('/home/amr/bin'))
> sys.path.append(os.path.join('/usr/local/www/documents/media'))
>
> os.environ['DJANGO_SETTINGS_MODULE'] = 'amr.settings'
> os.environ['PYTHON_EGG_CACHE'] = '/python_egg_cache'
>
> import django.core.handlers.wsgi
> application = django.core.handlers.wsgi.WSGIHandler()
>
> httpd.conf
> --
> Listen 8002
> 
> DocumentRoot /usr/local/www/documents
> 
>     Order allow,deny
>     Allow from all
> 
>
> Alias /media/ /usr/local/www/documents/media/
> 
> Order deny,allow
> Allow from all
> 
>
> WSGIScriptAlias / /usr/local/www/wsgi-scripts/wsgi_handler.py
> 
>     Order allow,deny
>     Allow from all
> 
> #
> 
>
> This link exists in /usr/local/www/documents/media
> media -> /usr/local/lib/python2.6/site-packages/django/contrib/admin/
> media
>
> according to the documentation.
>
> I'm missing something, and just cannot see it. Pointers in fixing this
> would be appreciated.
> Thank you.

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Askani

2010-11-26 Thread Wim Feijen
Nice! It definitely saves typing. Sounds like a right thing for
newbies, because when I was a newbie, I always had to look up which
fieldname to use and oh the typos.

Wim

On Nov 20, 3:28 pm, Alvaro Mouriño  wrote:
> Hi.
>
> I'd like to introduce to you this idea I've been working on for the
> last month, a django models generator:http://askani.net/
>
> Field options definition it's repetitive. Writing meta options leads
> to inconsistent use due to the variety available. "Inspired" by the
> repetitiveness of coding django models and the required memory load of
> defining meta options I decided to create a graphical interface that
> would guide the user in the creation of models.
>
> Askani.net is the result of scratching those itches. It represents
> models, fields, attributes and meta options in a UML-and-MER-ish way
> (but doesn't follow it strictly). It displays all the possible
> information for a model so the user only has to fill in the blanks the
> desired options, not remember all of them.
>
> The python code that outputs it's far from perfect, I know, this is
> just a barely-usable system to prove the concept, a prototype.
>
> The reason for this email is to request comments, suggestions and
> critics on the idea and specially on the usability. Clone the source,
> read the README file and play with it. Have fun =)
>
> Regards,
>
> --
> Alvaro Mouriñohttp://askani.net/

-- 
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Reusing actions "Save and continue editing" and "Save"

2010-11-26 Thread Wim Feijen
Hi Lom,

I would recommend the following:
1. Add all three buttons to your template
2. In your view, handle the form saving and then determine which
button has been pressed.
3. Accordingly, redirect to the same url (for example, redirect("/
address/14") for viewing, redirect("/address/14/edit") for continue
editing, or redirect("address/add") to add another).

For the redirect function, see:
http://docs.djangoproject.com/en/dev/topics/http/shortcuts/

Hope this helps.

Best regards,

Wim


On Nov 23, 3:46 pm, lom276  wrote:
> Hi all.
>
> I want to ask you if there is a best way to implement the actions
> "Save and add another", "Save and continue editing" and "Save" for my
> own forms. Is it possible to reuse the functionality from the Admin-
> Interface or do I have to invent the wheel again and implement it
> without reusing any existing code?
>
> Thank you.

-- 
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Building Privacy Options Like Facebook with Django

2010-11-26 Thread Wim Feijen
Hi Corey,

I would recommend using a UserProfile for this, which is bound to a
user (so make sure an authenticated user can access only his profile
by using request.user.get_profile() in your views.

See: http://docs.djangoproject.com/en/dev/topics/auth/

Good luck!

Best regards,

Wim

On Nov 25, 5:49 am, Corey  wrote:
> I was trying to build a website that would be a good idea to have
> privacy options to hide certain data such as Facebook does with
> personal info. I am a somewhat newbie to Django and website building
> in general. So Im trying to wrap my head around how to work on this. I
> have indeed tried to look on Google to find something regarding this
> but have had no luck. Any pointers or tutorial links regarding this
> would be greatly appreciated. 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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Central Login with Redirecting users based on Groups

2010-11-26 Thread Wim Feijen
In addition, you can use permissions to deny access for users to
certain views by using the permission_required decorator, see:

http://docs.djangoproject.com/en/dev/topics/auth/

Wim

On Nov 25, 4:46 pm, Knut Ivar Nesheim  wrote:
> Hi Stefan,
>
> If you roll your own login view, this can be done by simply
> redirecting to the correct url after authentication. You would have to
> come up with the correct url by looking at the groups. Consider
> something like this:
>
> def login_view(request):
>     # login and authenticate..
>     user = User object
>
>     url = get_redirect_url(user)
>     return HttpResponseRedirect(url)
>
> def get_redirect_url(user):
>     if user.groups.filter(name = 'Manager'):
>         return '/managers'/
>    elif user.groups.filter(name = 'Users'):
>         return '/users/'
>
>    return '/'
>
> This could be further improved by using some Django helpers, like
> 'redirect' and 'reverse'.
>
> If you have many groups, you could improve this by having a dict
> mapping group name to url. Consider something like this in your
> settings
>
> LOGIN_URL_MAP = {
>     'Managers': '/managers'/,
>     'Users': '/users':
>
> }
>
> Then 'get_redirect_url' could look something like this:
>
> def get_redirect_url(user):
>     url = '/'
>     for group in user.groups.all():
>         url = settings.LOGIN_URL_MAP[group.name]
>
>     return url
>
> Regards
> Knut
>
> On Thu, Nov 25, 2010 at 10:24 AM, stefanvonfintel
>
>
>
>
>
>
>
>  wrote:
> > Hi all.
>
> > I am new to Django and have just recently started using it for a new
> > project at our company.
> > I have a bit of problem at the moment. What I would ideally like is to
> > have one central login for users and then redirect them based on the
> > groups that
> > they belong to once they have been authenticated successfully ie. for
> > managers they get redirected towww.example.com/manager/and for
> > normal
> > users they get redirected towww.example.com/users/.
>
> > I have searched google and the forums for a while and can not get an
> > answer to this question.
> > So I have given up on that idea that's why at the moment I have got
> > two different login forms one on /users/ and one on /managers/. But
> > they are both using the login() and authenticate() functions that are
> > built in to django. This is a problem since if you login to /users/
> > then you have access to /managers/ without logging in there. Or is the
> > some other way that I am completely missing?
>
> > --
> > 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 more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en.

-- 
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: extends a template that is stored in an app template directory

2010-11-26 Thread Wim Feijen
Hi Owidjaya,

Common usage is to refer to your_app_name/template_name.html , so you
can put for example

{% extends "datagrid/template1.html" %}

in your client template.

So it is recommended to store your templates in a directory
your_app_name/templates/your_app_name/template_name.html

For more info, see http://docs.djangoproject.com/en/1.2/topics/templates/

Hope this helps.

Best regards, Wim


On Nov 26, 7:48 pm, owidjaya  wrote:
> How do i extends a template that is stored within an application
> template directory from another application?
> I have two apps
> one is datagrid and the other one is client
> I want to use datagrid to display list of clients
> but instead of using the datagrid template that comes from the app, i
> want to extend that template to modify the datagrid for client display

-- 
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: 'module' object has no attribute 'instancemethod' error

2010-08-18 Thread Wim Feijen
And I solved the problem as well, a new.pyc file was dangling
somewhere in my project root, so that was why new.SomeThing didn't
work. Oh, I'm happy now!

On 18 aug, 16:13, Wim Feijen <wimfei...@gmail.com> wrote:
> Nice app Reinout! This does really help in cleaning up!
>
> Unfortunately, it does not solve this problem. But I'll try to dig
> some deeper.
>
> On 11 aug, 13:19, Reinout van Rees <rein...@vanrees.org> wrote:
>
>
>
> > On 08/10/2010 09:53 PM, WimFeijenwrote:
>
> > > Exception Type: ViewDoesNotExist at /
> > > Exception Value: Tried book in module book.address.views. Error was:
> > > 'module' object has no attribute 'instancemethod'
>
> > It *looks* like you're using 'instancemethod' in that views.py, but that
> > it isn't available in views.py.  Perhaps a missing import?
>
> > Tip: "easy_install pyflakes" and call "pyflakes views.py", it'll report
> > on missing (or extraneous) imports or variables.
>
> > Reinout
>
> > --
> > Reinout van Rees - rein...@vanrees.org -http://reinout.vanrees.org
> > Programmer athttp://www.nelen-schuurmans.nl
> > "Military engineers build missiles. Civil engineers build targets"

-- 
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: 'module' object has no attribute 'instancemethod' error

2010-08-18 Thread Wim Feijen
Nice app Reinout! This does really help in cleaning up!

Unfortunately, it does not solve this problem. But I'll try to dig
some deeper.

On 11 aug, 13:19, Reinout van Rees  wrote:
> On 08/10/2010 09:53 PM, WimFeijenwrote:
>
> > Exception Type: ViewDoesNotExist at /
> > Exception Value: Tried book in module book.address.views. Error was:
> > 'module' object has no attribute 'instancemethod'
>
> It *looks* like you're using 'instancemethod' in that views.py, but that
> it isn't available in views.py.  Perhaps a missing import?
>
> Tip: "easy_install pyflakes" and call "pyflakes views.py", it'll report
> on missing (or extraneous) imports or variables.
>
> Reinout
>
> --
> Reinout van Rees - rein...@vanrees.org -http://reinout.vanrees.org
> Programmer athttp://www.nelen-schuurmans.nl
> "Military engineers build missiles. Civil engineers build targets"

-- 
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: filter users by group

2010-08-18 Thread Wim Feijen
So simple and so great!

Thanks!

On 11 aug, 21:50, Nick  wrote:
> You can subclass the User admin and then unregister the default admin
> and register your new subclassy admin (subclassy is a word)
>
> in admin.py:
>
> from django.contrib.auth.admin import UserAdmin
> from django.contrib.auth.models import User
>
> class MyNewUserAdmin(UserAdmin):
>     list_filter = UserAdmin.list_filter + ('groups',)
>
> admin.site.unregister(User)
> admin.site.register(User, MyNewUserAdmin)
>
> On Aug 11, 9:42 am, WimFeijen wrote:
>
>
>
> > Hello,
>
> > I am banging my brain against the wall but it doesn't help and all I
> > get is brain damage. Maybe you can help me find a solution for the
> > following problem?
>
> > How can I add a filter to the django admin User interface (/admin/auth/
> > user/) so I can filter Users by Group?
>
> > What I have thought of, is:
> > 1. Alter the template templates/admin/auth/user/change_list.html and
> > edit it to add a list of existing groups as links.
> > 2. Redirect to ?group_id=1. THIS STEP FAILS!
> > 3. Write a custom UserAdmin and overwrite the queryset method to show
> > only users of a group, thus:
>
> > class UserAdmin(admin.ModelAdmin):
> >     model = User
>
> >     def queryset(self, request):
> >         group_id = request.GET.get('group_id', '')
> >         if group_id:
> >             return Group.objects.get(id=group_id).user_set.all()
> >         else:
> >             return super(UserAdmin, self).queryset(request)
>
> > try:
> >     admin.site.unregister(User)
> > except admin.sites.Unregistered:
> >     pass
> > admin.site.register(User, UserAdmin)
>
> > The missing link is step 2. How on earth do I get a request.GET
> > parameter through django's normal filtering process/ how can I combine
> > it. When I try '/admin/auth/user/?group_id=1', django redirects me to
> > '/admin/auth/user/?e=1'
>
> > Any help and tips will be very much appreciated, thank you!
>
> > If someone's has ever done this, I'd really like to know!
>
> > Wim

-- 
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



filter users by group

2010-08-11 Thread Wim Feijen
Hello,

I am banging my brain against the wall but it doesn't help and all I
get is brain damage. Maybe you can help me find a solution for the
following problem?

How can I add a filter to the django admin User interface (/admin/auth/
user/) so I can filter Users by Group?

What I have thought of, is:
1. Alter the template templates/admin/auth/user/change_list.html and
edit it to add a list of existing groups as links.
2. Redirect to ?group_id=1. THIS STEP FAILS!
3. Write a custom UserAdmin and overwrite the queryset method to show
only users of a group, thus:

class UserAdmin(admin.ModelAdmin):
model = User

def queryset(self, request):
group_id = request.GET.get('group_id', '')
if group_id:
return Group.objects.get(id=group_id).user_set.all()
else:
return super(UserAdmin, self).queryset(request)

try:
admin.site.unregister(User)
except admin.sites.Unregistered:
pass
admin.site.register(User, UserAdmin)


The missing link is step 2. How on earth do I get a request.GET
parameter through django's normal filtering process/ how can I combine
it. When I try '/admin/auth/user/?group_id=1', django redirects me to
'/admin/auth/user/?e=1'

Any help and tips will be very much appreciated, thank you!

If someone's has ever done this, I'd really like to know!

Wim

-- 
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



'module' object has no attribute 'instancemethod' error

2010-08-10 Thread Wim Feijen
Hi,

When using reportlab trying to import a file which contains the
following line, I get an error.

from reportlab.platypus import Paragraph

The error says:
ViewDoesNotExist at /
Tried book in module book.address.views. Error was: 'module' object
has no attribute 'instancemethod'

The trace is below.

What could be wrong?

Wim



Environment:

Request Method: GET
Request URL: http://localhost:8000/
Django Version: 1.0.3 pre-alpha SVN-10924
Python Version: 2.6.5
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.flatpages',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.admin',
 'book.address',
 'book.adyen',
 'book.birthday',
 'book.budget',
 'book.export',
 'book.event',
 'book.field',
 'book.files',
 'book.friend',
 'book.help',
 'book.importbook',
 'book.login',
 'book.management',
 'book.password',
 'book.preferences',
 'book.create_pdf',
 'book.registration',
 'book.search',
 'book.tag',
 'book.write']
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.middleware.common.CommonMiddleware')


Traceback:
File "/home/wim/myprojects/book/django/core/handlers/base.py" in
get_response
  82. request.path_info)
File "/home/wim/myprojects/book/django/core/urlresolvers.py" in
resolve
  183. sub_match = pattern.resolve(new_path)
File "/home/wim/myprojects/book/django/core/urlresolvers.py" in
resolve
  124. return self.callback, args, kwargs
File "/home/wim/myprojects/book/django/core/urlresolvers.py" in
_get_callback
  136. raise ViewDoesNotExist, "Tried %s in module %s.
Error was: %s" % (func_name, mod_name, str(e))

Exception Type: ViewDoesNotExist at /
Exception Value: Tried book in module book.address.views. Error was:
'module' object has no attribute 'instancemethod'

-- 
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: limit on date in postgres/django

2010-06-09 Thread Wim Feijen
Thanks for your reponse guys!

It is a production machine with a lot of custom software, so I cannot
change that right now. For me, it worked fine under Django 1.0.3 alpha
and postgres 8.2.7 ! ??

Wim

On 9 jun, 13:43, David De La Harpe Golden
<david.delaharpe.gol...@ichec.ie> wrote:
> On 09/06/10 12:23, Wim Feijen wrote:
>
> > Hello,
>
> > Do you know whether there is a minimum to a date?
>
> Well there is, at the postgresql level, dates are supported
> between 4713 BC and 5874897 AD
>
> http://www.postgresql.org/docs/8.4/static/datatype-datetime.html
>
> Maybe there's some text to date parser level stuff going funny, but
> FWIW, I can set a 21 Jan 61 date with django 1.1.2  and postgresql 8.4
>
> d = datetime(61,01,21)
> s = SomeModel.objects.all()[0]
> s.some_timestamp_field = d
> s.save()
>
>  > I'm using Django 1.0.5 alpha
>
> That's quite an old django version at this stage I guess,
> I wonder if it's doing the same db connection init.

-- 
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



limit on date in postgres/django

2010-06-09 Thread Wim Feijen
Hello,

Do you know whether there is a minimum to a date? In my project, I'd
like to add birthdays from way back, from people born on 21 january
0061 for example.

When trying to write these dates to the db, I get the following error.
I'm using Django 1.0.5 alpha and Postgres 8.3.9.

---
Traceback (most recent call last):

 File "/var/projects/niveopleidingen/code/site-packages/django/core/
handlers/base.py", line 91, in get_response
   response = callback(request, *callback_args, **callback_kwargs)

 File "/var/projects/niveopleidingen/code/site-packages/django/contrib/
admin/sites.py", line 158, in root
   return self.model_page(request, *url.split('/', 2))

 File "/var/projects/niveopleidingen/code/site-packages/django/views/
decorators/cache.py", line 44, in _wrapped_view_func
   response = view_func(request, *args, **kwargs)

 File "/var/projects/niveopleidingen/code/site-packages/django/contrib/
admin/sites.py", line 177, in model_page
   return admin_obj(request, rest_of_url)

 File "/var/projects/niveopleidingen/code/site-packages/django/contrib/
admin/options.py", line 191, in __call__
   return self.add_view(request)

 File "/var/projects/niveopleidingen/code/site-packages/django/db/
transaction.py", line 238, in _commit_on_success
   res = func(*args, **kw)

 File "/var/projects/niveopleidingen/code/site-packages/django/contrib/
admin/options.py", line 502, in add_view
   self.save_model(request, new_object, form, change=False)

 File "/var/projects/niveopleidingen/code/site-packages/django/contrib/
admin/options.py", line 378, in save_model
   obj.save()

 File "/var/projects/jubelkalender/code/site-packages/jubelkalender/
sterrenkalender/models.py", line 59, in save
   super(BaseStarDate, self).save(*args, **kwargs)

 File "/var/projects/niveopleidingen/code/site-packages/django/db/
models/base.py", line 330, in save
   self.save_base(force_insert=force_insert,
force_update=force_update)

 File "/var/projects/niveopleidingen/code/site-packages/django/db/
models/base.py", line 402, in save_base
   result = manager._insert(values, return_id=update_pk)

 File "/var/projects/niveopleidingen/code/site-packages/django/db/
models/manager.py", line 162, in _insert
   return insert_query(self.model, values, **kwargs)

 File "/var/projects/mkbdenhaag/code/site-packages/django/db/models/
query.py", line 923, in insert_query
   return query.execute_sql(return_id)

 File "/var/projects/niveopleidingen/code/site-packages/django/db/
models/sql/subqueries.py", line 303, in execute_sql
   cursor = super(InsertQuery, self).execute_sql(None)

 File "/var/projects/banka/code/site-packages/django/db/models/sql/
query.py", line 1820, in execute_sql
   cursor.execute(sql, params)

ProgrammingError: date/time field value out of range: "  63-01-21"
HINT:  Perhaps you need a different "datestyle" setting.


If there is a solution, I'd really like to know. Thanks!

Wim

-- 
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: formsets and empty results

2010-05-17 Thread Wim Feijen
Hi Dexter, thanks for your answer,

The urls you gave are about forms, not formsets? My code looks like
this:



@teacher_required
def add_students(request):
school = School.objects.for_user(request.user)

class StudentForm(UserCreationForm):
name = forms.CharField(label='Naam')
group = forms.ChoiceField(label='Groep')
def __init__(self, *args, **kwargs):
super(StudentForm, self).__init__(*args, **kwargs)
self.fields['group'].choices = [(g.id, g.name) for g in
StudentGroup.objects.for_school(school)]

from django.forms.formsets import formset_factory
StudentFormSet = formset_factory(StudentForm, extra=10)
if request.method == 'POST':
formset = StudentFormSet(request.POST)
if formset.is_valid():
for form in formset:
if form.is_valid():
user = form.save()
student = Student(user=user,
name=form.cleaned_data['name'], group_id=form.cleaned_data['group'])
student.save()
return HttpResponseRedirect(reverse('schooladmin_students'))
else: #GET
formset = StudentFormSet()

base_template = get_base_template(request.user)
return render_to_response('school/add_students.html', {
'formset': formset,
'base_template': base_template
}, context_instance=RequestContext(request))

---
The StudentForm is defined over here because I could not set the
groups otherwise. I am using Django 1.0 . After the post, I'd like to
ignore empty forms in the formset.

Is this possible?

Best regards, groeten van Wim


On 15 mei, 20:31, Dexter <a.essel...@gmail.com> wrote:
> Hey,
>
> Ik zou deze pagina even 
> bekijken:http://docs.djangoproject.com/en/1.1/ref/forms/validation/#ref-forms-...
>
> <http://docs.djangoproject.com/en/1.1/ref/forms/validation/#ref-forms-...>
> Grtz
>
>
>
>
>
> On Sat, May 15, 2010 at 7:34 PM, Wim Feijen <wimfei...@gmail.com> wrote:
> > Hi all,
>
> > Can some of you please help me with the following?
>
> > For an application, I need to display the same form ten times over.
> > Filling in each form is optional. Of course, I'd like to keep this
> > safe & simple and therefore I am looking at formsets.
>
> > Is it possible to use a formset, call formset.is_valid() and that it
> > ignores empty forms?
>
> > I'm using the forms only for adding new data, not for altering
> > existing data.
>
> > Thanks!
>
> > Best regards, Wim
>
> > --
> > 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<django-users%2bunsubscr...@google 
> > groups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.
>
> --
> 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 more options, visit this group 
> athttp://groups.google.com/group/django-users?hl=en.

-- 
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



formsets and empty results

2010-05-15 Thread Wim Feijen
Hi all,

Can some of you please help me with the following?

For an application, I need to display the same form ten times over.
Filling in each form is optional. Of course, I'd like to keep this
safe & simple and therefore I am looking at formsets.

Is it possible to use a formset, call formset.is_valid() and that it
ignores empty forms?

I'm using the forms only for adding new data, not for altering
existing data.

Thanks!

Best regards, Wim

-- 
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



DateFormat and localization

2010-03-26 Thread Wim Feijen
Hi,

I'm unsure if and how to use DateFormat from django/utils/
dateformat.py .

I'd like to use a local (Dutch) representation of dates. What I get
is:
u'26th March 2010'

I'd like that to be in Dutch. How do I do that?

Major thanks!

Wim


My IPython looks like this:

In [1]: import datetime

In [2]: d = datetime.datetime.now()

In [3]: from django.utils.dateformat import DateFormat

In [4]: df = DateFormat(d)

In [5]: df.format('jS F Y')
Out[5]: u'26th March 2010'

In [6]:

In [7]: import settings

In [8]: settings.USE_L10N
Out[8]: True

In [9]: settings.LANGUAGE_CODE
Out[9]: 'nl'

In [10]: settings.LANGUAGES
Out[10]: (('nl', 'Dutch'),)

-- 
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: admin rows aren't ordered as expected

2010-03-09 Thread Wim Feijen
OK Thanks! That explains a lot.

Wim

On Mar 8, 2:54 pm, derek <gamesb...@gmail.com> wrote:
> On Mar 8, 2:46 pm, Wim Feijen <wimfei...@gmail.com> wrote:
>
>
>
>
>
> > Hello,
>
> > In my admin interface, the data isn't ordered as expected. What I get
> > is:
> > Provincie/Land   Type
> > Limburg     Provincie
> > Groningen  Provincie
> > Utrecht      Provincie
> > etc.
> > which clearly isn't alphabetical order, while I do specify that
> > provinces should be ordered that way. In my python manage.py shell the
> > provinces are ordered alphabetically. What could be wrong?
>
> > admin.py:
> > class ProvinceAdmin(admin.ModelAdmin):
> >     list_display = ('name', 'type')
> >     actions = None
>
> > admin.site.register(Province, ProvinceAdmin)
>
> > models.py:
> > class Province(models.Model):
> >     TYPES = (
> >         ('c', 'Land'),
> >         ('p', 'Provincie'),
> >     )
> >     name = models.CharField(max_length=200, verbose_name="Provincie/
> > Land")
> >     type = models.CharField(max_length=1, choices=TYPES, default='c')
>
> >     def __unicode__(self):
> >         return self.name
>
> >     class Meta:
> >         ordering = ('-type', 'name',)
> >         verbose_name = 'Provincie/Land'
> >         verbose_name_plural = 'Provincies/Landen'
>
> > For the record, I am using django trunk revision 12295 .
>
> > - Wim
>
> The Django 
> documentation:http://docs.djangoproject.com/en/dev/ref/models/options/#ordering
> mentions that ... "Regardless of how many fields are in ordering, the
> admin site uses only the first field."
>
> """
> Minor observation:  shouldn't the format be
>     ordering = [-type', 'name',]
> """
>
> Derek

-- 
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



admin rows aren't ordered as expected

2010-03-08 Thread Wim Feijen
Hello,

In my admin interface, the data isn't ordered as expected. What I get
is:
Provincie/Land   Type
Limburg Provincie
Groningen  Provincie
Utrecht  Provincie
etc.
which clearly isn't alphabetical order, while I do specify that
provinces should be ordered that way. In my python manage.py shell the
provinces are ordered alphabetically. What could be wrong?

admin.py:
class ProvinceAdmin(admin.ModelAdmin):
list_display = ('name', 'type')
actions = None

admin.site.register(Province, ProvinceAdmin)

models.py:
class Province(models.Model):
TYPES = (
('c', 'Land'),
('p', 'Provincie'),
)
name = models.CharField(max_length=200, verbose_name="Provincie/
Land")
type = models.CharField(max_length=1, choices=TYPES, default='c')

def __unicode__(self):
return self.name

class Meta:
ordering = ('-type', 'name',)
verbose_name = 'Provincie/Land'
verbose_name_plural = 'Provincies/Landen'

For the record, I am using django trunk revision 12295 .

- Wim

-- 
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



save method manytomany

2010-01-18 Thread Wim Feijen
Hi,

Will you help me please?

I've got a model called Card which has a ManyToMany relationship to
Tag. When I save a Card, I'd like to create a Product as well, which I
want to have the same ManyToMany relationship to tag.

How do I access the instance's tags? self.tags.all() gives an empty
list, while if I check after saving, the card actually has tags. My
code is below. For the record, I am using Django 1.0.5.

Major thanks!

Wim

class Card(models.Model):
product = models.ForeignKey(Product, editable=False,
null=True)
name   = models.CharField('name', max_length=50, unique=True,
help_text='A short and unique name or title of the object.')
identifier = models.SlugField('identifier', unique=True,
help_text='A unique identifier constructed from the name of the
object. Only change this if you know what it does.', db_index=True)
tags   = models.ManyToManyField(Tag, verbose_name='tags',
db_index=True)
price  = models.DecimalField('price', max_digits=15,
decimal_places=2, db_index=True)

def add_product(self):
product = Product(
name = self.name,
identifier = self.identifier,
price = self.price
)
product.save()
return product

def save(self, *args, **kwargs):
# Step 1: Create product
if not self.id:
self.product = self.add_product()
# Step 2: Create Card
super(Card, self).save(*args, **kwargs)
# Step 3: Copy cards many to many to product
# How do I do this?
print self.tags.all() # gives an empty list??


Any help is appreciated
-- 
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: Modeling and validating international addresses?

2009-09-27 Thread Wim Feijen

Hi ringmeup again,

What I would do is choose the most common one and use that. In many
web applications I find that people use American-style addresses,
where I have to enter my state which has no equivalent in the
Netherlands, but nevertheless I have to.

Another good solution would be to define a common BaseAddress on which
you expend for each country's customs, and if you want to make your
application really slick, you can throw in some Javascript to
dynamically alter the form displayed. Though I would certainly opt for
simplicity and let the user first select a country, and then render
the appropriate form in the next script.

What does google find?

Wim


On Sep 26, 10:34 pm, ringemup  wrote:
> I can't be the only person building an app that needs to be able to
> take mailing addresses from people all over the world, not just in one
> country.  How have you handled models and validation for international
> addresses?
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Overriding verbose_name in contrib or 3rd-party apps?

2009-09-27 Thread Wim Feijen

Can you please post some more information for what purpose you like to
do this?

My first guess would be you are using the admin interface. Dirty
workarounds are: copying code and adapting it, importing from your
adaptation in stead of the original. Maybe modifying the admin view to
do something differently. Or adapt a translation?

Probably there are a hundred better ways, but you can try these for a
start.

Wim

On Sep 25, 10:59 pm, ringemup  wrote:
> Is there an easy way to override strings like help_text or
> verbose_name or __unicode__ methods for models in contrib or third-
> party apps?  I can't seem to find anything on Google.
>
> 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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: can't show admin interface

2009-09-27 Thread Wim Feijen

It does nothing to help you solve your problem, but mod_wsgi is
generally preferred above mod python.

Good luck solving the problem!

Wim

On Sep 26, 10:06 am, nausikaa  wrote:
> Have you done
>
> from yourapp.models import *
> from django.contrib import admin
>
> admin.site.register(Books)
>
> in admin.py?
>
> On Sep 26, 4:55 am, pengwupeng  wrote:
>
> > the environment is  apache+django, accessing   my app is ok,but i
> > can't access the admin interface.
> > the configuration  of the httpd.conf  is likes this below:
> >     Listen 127.0.0.1:
> > 
> > 
> >     SetHandler python-program
> >     PythonPath "sys.path+['c:/']"
> >     PythonHandler django.core.handlers.modpython
> >     SetEnv DJANGO_SETTINGS_MODULE Djangoproject.settings
> >     PythonInterpreter books
> >     PythonDebug On
> > 
>
> > #Alias /site_media
> > Alias /site_media c:/Djangoproject/media
> > 
> >     AllowOverride None
> >     Options FollowSymLinks MultiViews Indexes
> >     Order allow,deny
> >     Allow from all
> > 
> > 
> >        SetHandler None
> > 
>
> > #Alias /media
> > Alias /media C:/Python25/Lib/site-packages/django/contrib/admin/media
> > 
> >     AllowOverride None
> >     Options FollowSymLinks MultiViews Indexes
> >     Order allow,deny
> >     Allow from all
> > 
> > 
> >        SetHandler None
> > 
> > # file types we want to serve statically
> > # case insensative match
> > 
> >        SetHandler None
> > 
> > 
>
> > Environment:
>
> > Request Method: GET
> > Request URL:http://localhost:/admin/
> > Django Version: 1.1
> > Python Version: 2.5.4
> > Installed Applications:
> > ['django.contrib.auth',
> >  'django.contrib.contenttypes',
> >  'django.contrib.sessions',
> >  'django.contrib.sites',
> >  'django.contrib.admin',
> >  'Djangoproject.books']
> > Installed Middleware:
> > ('django.middleware.common.CommonMiddleware',
> >  'django.contrib.sessions.middleware.SessionMiddleware',
> >  'django.contrib.auth.middleware.AuthenticationMiddleware')
>
> > Template error:
> > In template c:\python25\lib\site-packages\django\contrib\admin
> > \templates\admin\base.html, error at line 30
> >    Caught an exception while rendering: Could not import
> > Djangoproject.books.search. Error was: No module named books.models
> >    20 :     
>
> >    21 :     
>
> >    22 :         
>
> >    23 :         {% block branding %}{% endblock %}
>
> >    24 :         
>
> >    25 :         {% if user.is_authenticated and user.is_staff %}
>
> >    26 :         
>
> >    27 :             {% trans 'Welcome,' %}
>
> >    28 :             {% firstof user.first_name user.username %}
> > .
>
> >    29 :             {% block userlinks %}
>
> >    30 :                  {% url django-admindocs-docroot as docsroot
> > %}
>
> >    31 :                 {% if docsroot %}
>
> >    32 :                     {% trans
> > 'Documentation' %} /
>
> >    33 :                 {% endif %}
>
> >    34 :                 {% url admin:password_change as
> > password_change_url %}
>
> >    35 :                 {% if password_change_url %}
>
> >    36 :                     
>
> >    37 :                 {% else %}
>
> >    38 :                     
>
> >    39 :                 {% endif %}
>
> >    40 :                 {% trans 'Change password' %} /
>
> > Traceback:
> > File "C:\Python25\Lib\site-packages\django\core\handlers\base.py" in
> > get_response
> >   92.                 response = callback(request, *callback_args,
> > **callback_kwargs)
> > File "C:\Python25\Lib\site-packages\django\contrib\admin\sites.py" in
> > wrapper
> >   196.                 return self.admin_view(view, cacheable)(*args,
> > **kwargs)
> > File "C:\Python25\Lib\site-packages\django\views\decorators\cache.py"
> > in _wrapped_view_func
> >   44.         response = view_func(request, *args, **kwargs)
> > File "C:\Python25\Lib\site-packages\django\contrib\admin\sites.py" in
> > inner
> >   186.             return view(request, *args, **kwargs)
> > File "C:\Python25\Lib\site-packages\django\views\decorators\cache.py"
> > in _wrapped_view_func
> >   44.         response = view_func(request, *args, **kwargs)
> > File "C:\Python25\Lib\site-packages\django\contrib\admin\sites.py" in
> > index
> >   374.             context_instance=context_instance
> > File "C:\Python25\Lib\site-packages\django\shortcuts\__init__.py" in
> > render_to_response
> >   20.     return HttpResponse(loader.render_to_string(*args,
> > **kwargs), **httpresponse_kwargs)
> > File "C:\Python25\Lib\site-packages\django\template\loader.py" in
> > render_to_string
> >   108.     return t.render(context_instance)
> > File "C:\Python25\Lib\site-packages\django\template\__init__.py" in
> > render
> >   178.         return self.nodelist.render(context)
> > File "C:\Python25\Lib\site-packages\django\template\__init__.py" in
> > render
> >   779.                 bits.append(self.render_node(node, context))
> > File 

Re: rendering a table

2009-09-27 Thread Wim Feijen

Hi Hugo,

Your template code, does it actually contains  and  ?
Like below?


{% for row in rows %}

{% for value in row %}
{{ value }}
{% endfor %}

{% endfor %}


Then, what does rows look like? Can you post your output please? To
get this output, for example, use "print rows" before you render the
template, and post the result here. That would help!

Wim

On Sep 27, 6:37 pm, jhugo  wrote:
> What i want to display as a table is the fallowing:
>
> rows---row---       row         ---row
>            |               |               |
>            number1  name1   date1
>            number2  name2   date2
>            number3  name3   date3
>
> Now when django renders my template i get this:
>
> number1  name1   date1
> number1  name1   date1 number2  name2   date2
> number1  name1   date1 number2  name2   date2 number3  name3   date3
>
> Is this better? I am not getting why i am getting this behavior?
>
> On Sep 27, 5:48 am, Léon Dignòn  wrote:
>
> > Could you post your list and your output please?
>
> > On Sep 27, 2:04 am, jhugo  wrote:
>
> > > Hi,
>
> > > I want to render a table using a list of list. What I do is create a
> > > list for the rows and append another list for the columns. I use two
> > > fors in my template to render the table and as the first loop progress
> > > the second always renders the values from the beginning and a i end up
> > > having my rows incrementing in length. Why is this?
>
> > > this is what i have:
>
> > > {% for row in rows %}
> > > 
> > > {% for value in row %}
> > > {{ value }}
> > > {% endfor %}
> > > 
> > > {% endfor %}
>
> > > Thanks,
>
> > > -- Hugo
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: OperationalError: unable to open database file, when saving existing object

2009-09-27 Thread Wim Feijen

So, if I understand correctly, creating new objects and saving them to
the database works correctly, and updating objects fails. Is that
correct? Is it an update from the admin interface or from code written
by you?

If the former, it might have something to do with db privileges. Which
back-end are you using, sqlite? In that case, are you running the
project while being the same user as the owner of the sqlite db-file?
If the back-end is another database, did you edit and modify write
privileges?

Wim


On Sep 27, 3:28 pm, pigmalione  wrote:
> Hello,
>
> When I attempt to save an existing db object I get the following
> error:
>
>   File "", line 1, in 
>   File "/usr/lib/python2.5/site-packages/django/db/models/base.py",
> line 410, in
>  save
>     self.save_base(force_insert=force_insert,
> force_update=force_update)
>   File "/usr/lib/python2.5/site-packages/django/db/models/base.py",
> line 474, in
>  save_base
>     rows = manager.filter(pk=pk_val)._update(values)
>   File "/usr/lib/python2.5/site-packages/django/db/models/query.py",
> line 444, i
> n _update
>     return query.execute_sql(None)
>   File "/usr/lib/python2.5/site-packages/django/db/models/sql/
> subqueries.py", li
> ne 120, in execute_sql
>     cursor = super(UpdateQuery, self).execute_sql(result_type)
>   File "/usr/lib/python2.5/site-packages/django/db/models/sql/
> query.py", line 23
> 69, in execute_sql
>     cursor.execute(sql, params)
>   File "/usr/lib/python2.5/site-packages/django/db/backends/util.py",
> line 19, i
> n execute
>     return self.cursor.execute(sql, params)
>   File "/usr/lib/python2.5/site-packages/django/db/backends/sqlite3/
> base.py", li
> ne 193, in execute
>     return Database.Cursor.execute(self, query, params)
> OperationalError: unable to open database file
>
> I can keep saving new objects, but once I edit an attribute and
> attempt to save, I get the above message.
>
> Can someone suggest something?
>
> Thanks a lot.
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



question about UserChangeForm

2009-06-11 Thread Wim Feijen

Hello,

In my views, I'd like to be able to rename a user using the
UserChangeForm from django.contrib.auth.forms . However, the form does
not validate. Should I use another instance than request.user?

Errorlist:

Translation: "Dit veld is verplicht." is Dutch for "This field is
required."

passwordDit veld
is verplicht.last_loginDit veld is verplicht.date_joinedDit veld is verplicht.

In views:

def rename(request):
'''Displays a form which can rename a user'''
if request.POST:
form = UserChangeForm(request.POST, instance=request.user)
if form.is_valid():
result = form.save()
return HttpResponseRedirect("/preferences")
print form.errors
else:
form = UserChangeForm(instance=request.user)
context = {
'form': form,
}
return render_to_response('rename_user.html', context)

Thanks! Wim
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



syncdb no such table: auth_group

2009-06-05 Thread Wim Feijen

Hello,

python manage.py syncdb failed for me, saying: there is no such table
auth_group. On closer examination, the error stack mentioned one of my
models: timewriting.

After commenting 5 lines of code: tada... syncdb worked!

However, I do not understand, and I am interested in: why ?

Wim

-
My code (problematic lines are commented):

from datetime import datetime, date

from django.db import models
from django.db.models import Q
from django.contrib.auth.models import User, Group
from django.conf import settings

if hasattr(settings, 'TIMEWRITING_MINUTES_LIST'):
MINUTES_LIST = settings.TIMEWRITING_MINUTES_LIST
else:
MINUTES_LIST = (
(0, '0'),
(15, '15'),
(30, '30'),
(45, '45'),
)

HOURS_LIST = [(item, unicode(item)) for item in xrange(0, 24)]

PROJECT_TYPE_LIST = (
('project', 'Project'),
('leave', 'Verlof'),
('illness', 'Ziekte'),
)

# TIMEWRITING_GROUP_ID = 5
# TIMEWRITING_GROUP = Group.objects.get(id=TIMEWRITING_GROUP_ID)

def format_hours(hours, minutes):
return '%d:%02d' % (hours, minutes)

def format_minutes(minutes):
hours = minutes // 60
minutes = minutes % 60
return format_hours(hours, minutes)

# def get_timewriting_users():
#return User.objects.filter(is_active=True,
groups__id=TIMEWRITING_GROUP_ID).exclude(username='estrate')

class ProjectManager(models.Manager):
def visible(self):
return self.filter((Q(finished_at__isnull=True)|Q
(finished_at__gte=date.today())), is_active=True,
started_at__lte=date.today())

def for_user(self, user):
return self.visible().filter((Q(allow_all_users=True)|Q
(allowed_users=user)))

class Project(models.Model):
name = models.CharField('naam', max_length=200)
short_name = models.CharField('korte naam', max_length=25,
unique=True, help_text='Korte, unieke naam om te gebruiken in
overzichten.')
description = models.TextField('omschrijving', blank=True,
help_text='Optioneel')
confirm_term = models.PositiveIntegerField('bevestigingstermijn',
default=30, help_text='Aantal dagen waarna gebruikers een herinnering
krijgen om geschreven uren te bevestigen (0=nooit).')
type = models.CharField('type', max_length=25, default='project',
choices=PROJECT_TYPE_LIST, help_text='Verlof en ziekte kunnen ook als
"projecten" worden ingevoerd zodat de gebruiker hier uren op kan
schrijven.')
started_at = models.DateField('gestart op', default=date.today,
db_index=True, help_text='Vanaf deze dag kan men urenschrijven op dit
project. Als de startdatum later wordt verlegd zullen reeds geschreven
uren NIET worden gewist.')
finished_at = models.DateField(u'be\xebindigd op', null=True,
blank=True, db_index=True, help_text='Tot en met deze dag kan men
urenschrijven op dit project. Als de begindatum later wordt verlegd
zullen reeds geschreven uren NIET worden gewist. Laat dit veld leeg
als er geen einddatum bekend is of indien niet van toepassing.')
is_active = models.BooleanField('is geactiveerd', default=True,
db_index=True, help_text='Met dit veld kan een project (tijdelijk)
worden afgesloten voor het schrijven van nieuwe uren, ongeacht de
start- en einddatum.')
allow_all_users = models.BooleanField('open voor alle gebruikers',
default=True, db_index=True, help_text='Vink dit aan indien alle
gebruikers die uren mogen schrijven, op dit project uren kunnen
schrijven. Indien dit is uitgevinkt dan kunnen alleen de gebruikers
urenschrijven die zijn geselecteerd bij "toegestane gebruikers".')
allowed_users = models.ManyToManyField(User,
verbose_name='toegestane gebruikers', db_index=True, blank=True)

objects = ProjectManager()

class Meta:
verbose_name = 'project'
verbose_name_plural = 'projecten'
ordering = ('short_name',)

def __unicode__(self):
return self.short_name

class WorkDayManager(models.Manager):
def unconfirmed(self):
return self.filter(is_confirmed=False)

def confirmed(self):
return self.filter(is_confirmed=True)


class WorkDay(models.Model):
date = models.DateField('datum', default=date.today, help_text='De
datum van deze werkdag voor de aangegeven gebruiker.', db_index=True)
user = models.ForeignKey(User, verbose_name='gebruiker',
db_index=True)
is_confirmed = models.BooleanField('is bevestigd', default=False,
db_index=True)
confirmed_at = models.DateTimeField('bevestigd op', null=True,
blank=True, editable=False)

objects = WorkDayManager()

class Meta:
verbose_name = 'werkdag'
verbose_name_plural = 'werkdagen'
ordering = ('-date',)
unique_together = (('date', 'user'),)

def __unicode__(self):
return u'%s %s' % (self.date, self.user)

def save(self, *args, **kwargs):
if self.is_confirmed and not self.confirmed_at:
 self.confirmed_at = datetime.now()
else:
self.confirmed_at = None
super(WorkDay, self).save(*args, **kwargs)

def 

Re: form fun

2009-05-30 Thread Wim Feijen

The source code for the form generator is now on github at:

http://github.com/wimfeijen/trumpet_form_generator

- Wim

On May 30, 7:29 pm, Wim Feijen <wimfei...@gmail.com> wrote:
> Hello,
>
> Several clients asked me whether they could have a form on their
> website, which displays like this:
>
> Description of field 1
> Title: (input field)
> help_text
>
> Description of field 2
> Title2: (input field2)
> help_text2
>
> etc.
>
> I was wondering whether this is a common case and I like to poll you:
>
> Did you ever encounter a situation like this?
>
> The reason I am asking is, if it indeed turns out to be a common case,
> and if it is, it might make sense to make a feature request which
> allows us to have a "description_text" in the forms.Field definition
> as well.
>
> In one use case, my clients are making forms which they generate
> themselves using a generator in the admin (if you're interested in the
> code, I will send it to you) and the logic will get very complex if I
> need to add my own desciption_field. On the other hand, I can always
> try to overwrite the Field function :) , I'll look into that.
>
> Cheers, Wim Feijen
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



form fun

2009-05-30 Thread Wim Feijen

Hello,

Several clients asked me whether they could have a form on their
website, which displays like this:

Description of field 1
Title: (input field)
help_text

Description of field 2
Title2: (input field2)
help_text2

etc.

I was wondering whether this is a common case and I like to poll you:

Did you ever encounter a situation like this?

The reason I am asking is, if it indeed turns out to be a common case,
and if it is, it might make sense to make a feature request which
allows us to have a "description_text" in the forms.Field definition
as well.

In one use case, my clients are making forms which they generate
themselves using a generator in the admin (if you're interested in the
code, I will send it to you) and the logic will get very complex if I
need to add my own desciption_field. On the other hand, I can always
try to overwrite the Field function :) , I'll look into that.

Cheers, Wim Feijen
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Forms: custom clean for DateField

2009-03-18 Thread Wim Feijen

Hi Marco,

In Django 1.0, you don't need to call clean from clean, Django will do
that automatically for you. :)

So what you can do is:

def clean(self):
data =  self.cleaned_data

if (data['firstDate'] >= data['lastDate']):
raise ValidationError("Error")

# else
return data

That should work.

For more info, see: http://docs.djangoproject.com/en/dev/ref/forms/validation/

Wim


On Mar 6, 11:46 am, MarcoS  wrote:
>  Sorry, i've posted without finishing the message :)
>
> So, if I call clean(self), Django give me this exception for the
> following line:
>
>     super(forms.DateField, self).clean()
>
> Exception Type:         TypeError
> Exception Value:
> super(type, obj): obj must be an instance or subtype of type
>
> To solve it I tried to replace
>
>     super(forms.DateField, self).clean()
>
> with:
>
>     super(DateField, self.fields['firstDate']).clean(self)
>
> but I think isn't correct and however the super class doesn't raises
> any
> exception for input that isn't in a date format.
>
> Please, give me any ideas
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



thread by latest post

2008-12-04 Thread Wim Feijen

Hello,

While writing a forum app, I ran into a problem: I am unable to sort a
list of threads by date of their latest post.

My models look like:

class Thread(models.Model):
club = models.ForeignKey(Club)
name= models.CharField(_('Thread'), max_length=100)
date = models.DateTimeField(auto_now = True )

def __unicode__(self):
return self.name

class Post(models.Model):
thread = models.ForeignKey(Thread)
date = models.DateTimeField(auto_now=True)
subject = models.CharField(_('Subject'), max_length=100)
text = models.TextField(_('Text'))

def __unicode__(self):
return self.subject

I know that I can get the date of the latest post of a thread by
using:
Thread.objects.get(id=3).post_set.all().latest('date').date

However, I do not know if there is any possibility of me using that
date to sort a QuerySet of threads, which I get by using
Thread.objects.filter(club=1). Is there any way to do this in Django?

Many thanks for your help!

Wim
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: pretty urls lost in dns

2008-09-24 Thread Wim Feijen

OK, please ignore the above.

Turns out that I am not using DNS at all, but iframes. It will take
some time for the DNS to pick up, but let's see how it works after
that.

Wim
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



pretty urls lost in dns

2008-09-24 Thread Wim Feijen

Hello,

I'm happily running a project on a Strato web server.

I've forwarded the domain name 'uwadresboek.nl' to my server, it's at
IP 85.214.104.194 . Everything works fine, except that:

1. Pretty URLs are lost.

I can type www.uwadresboek.nl/prices and everything is well. In
addition, I can click on a link, f.e. 'read more' and I get
redirected. But now the URL in my browser does not show a change,
which I find very confusing. What could be the cause of the browser
not showing the URL and what can I do about it?

Using www.go2people.net (without DNS forwarding), everything is OK.

2. The background flashes while switching screens.

Any help would be much appreciated!

Wim
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django 1.0 lighttpd FastCGI redirect issue

2008-09-16 Thread Wim Feijen

Hi Anders,

For me, removing the slash in the FORCE_SCRIPT_NAME seemed to work. I
am not using the admin interface, so I can't check on that.

So I added to settings.py:

FORCE_SCRIPT_NAME=""

I totally agree that this change with great consequences for all
lighttpd users is poorly documented.

Best regards,

Wim
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Can I loop over attributes in model.attribute?

2008-06-13 Thread Wim Feijen

Works like a charm, thank you very much!

On Jun 12, 2:09 am, Johannes Dollinger
<[EMAIL PROTECTED]> wrote:
> You are looking for setattr():http://docs.python.org/lib/built-in-
> funcs.html#l2h-66
>
> for attr in ('groupon', 'companyon', 'addressfirst', 'extendnames',  
> 'clubfieldson'):
>      setattr(settings, attr, attr in data)
>
> Am 12.06.2008 um 00:48 schriebWimFeijen:
>
>
>
> > Thanks Russell!
>
> > I suppose the code I want to get looks like:
>
> > settings = Settings.objects.get(owner=userid)
> > for switchable in ['groupon', 'companyon', 'addressfirst',
> > 'extendnames', 'clubfieldson']:
> >     if switchable in data:
> >         settings._meta.get_field(switchable). = True
> >     else:
> >        settings._meta.get_field(switchable). = False
>
> > My remaining question is, as you may have understood, what text do I
> > use instead of  ?
>
> > I imagine I could have been using a python function to list some
> > options, but I was unable to find out how. I apologize for being
> > stupid.
>
> > Yours sincerely,
>
> >Wim
>
> > PS Another thing is, _meta is apparently a hidden function I am not
> > supposed to be using. Do you recommend filing this conversation as a
> > bug/feature request? Because I would be delighted when we could
> > address object columns as settings['groupson'] = False, in order to
> > open up all kinds of possible interactions.
>
> > On Jun 10, 3:38 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]>
> > wrote:
> >> On Tue, Jun 10, 2008 at 9:25 PM,WimFeijen<[EMAIL PROTECTED]> wrote:
>
> >>> Coding happily away...
>
> >>> And wondering, can I write better code, using a loop, perhaps? In
> >>> other words: can I set settings.groupon while using a variable in
> >>> stead of groupon?
>
> >>> Thanks for any recommendations you are willing to make!
>
> >> Looks like you might want to have a look at the contents of
> >> Settings._meta, also called the Options object. This object  
> >> contains a
> >> lot of meta-data about the class, such as the various names that can
> >> be used to refer to the class, the fields on the class, and so on.  
> >> The
> >> meta object is available on the class and on instances.
>
> >> In particular, you're probably looking to iterate over
> >> settings._meta.fields; each member of this list will be a Field
> >> object, from which you can get field.name, field.attname, and many
> >> other useful details.
>
> >> Yours,
> >> Russ Magee %-)
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Can I loop over attributes in model.attribute?

2008-06-11 Thread Wim Feijen

Thanks Russell!

I suppose the code I want to get looks like:

settings = Settings.objects.get(owner=userid)
for switchable in ['groupon', 'companyon', 'addressfirst',
'extendnames', 'clubfieldson']:
if switchable in data:
settings._meta.get_field(switchable). = True
else:
   settings._meta.get_field(switchable). = False

My remaining question is, as you may have understood, what text do I
use instead of  ?

I imagine I could have been using a python function to list some
options, but I was unable to find out how. I apologize for being
stupid.

Yours sincerely,

Wim

PS Another thing is, _meta is apparently a hidden function I am not
supposed to be using. Do you recommend filing this conversation as a
bug/feature request? Because I would be delighted when we could
address object columns as settings['groupson'] = False, in order to
open up all kinds of possible interactions.


On Jun 10, 3:38 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On Tue, Jun 10, 2008 at 9:25 PM,WimFeijen<[EMAIL PROTECTED]> wrote:
>
> > Coding happily away...
>
> > And wondering, can I write better code, using a loop, perhaps? In
> > other words: can I set settings.groupon while using a variable in
> > stead of groupon?
>
> > Thanks for any recommendations you are willing to make!
>
> Looks like you might want to have a look at the contents of
> Settings._meta, also called the Options object. This object contains a
> lot of meta-data about the class, such as the various names that can
> be used to refer to the class, the fields on the class, and so on. The
> meta object is available on the class and on instances.
>
> In particular, you're probably looking to iterate over
> settings._meta.fields; each member of this list will be a Field
> object, from which you can get field.name, field.attname, and many
> other useful details.
>
> Yours,
> Russ Magee %-)
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: sessions, Internet Explorer cookies and domain forwarding

2008-06-11 Thread Wim Feijen

Many thanks Peter for your help in identifying the problem!

After making an upgrade in my domainhosting package I can use DNS and
now I am okay: setting the cookie works. Yes!

I am a very happy person now, thanks again!

Wim

On Jun 5, 5:27 pm, Peter Rowell <[EMAIL PROTECTED]> wrote:
> Sigh, brain fart.
>
> impeded => embedded
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Can I loop over attributes in model.attribute?

2008-06-10 Thread Wim Feijen

Coding happily away...

And wondering, can I write better code, using a loop, perhaps? In
other words: can I set settings.groupon while using a variable in
stead of groupon?

Thanks for any recommendations you are willing to make!

Wim Feijen

---
My not-too-pretty code:

settings = Settings.objects.get(owner=userid)
if 'groupon' in data:
settings.groupon = True
else:
settings.groupon = False
if 'companyon' in data:
settings.companyon = True
else:
settings.companyon = False
if 'addressfirst' in data:
settings.addressfirst = True
else:
settings.addressfirst = False
if 'extendnames' in data:
settings.extendnames = True
else:
settings.extendnames = False
if 'clubfieldson' in data:
settings.clubfieldson = True
else:
settings.clubfieldson = False
settings.save()
---

PS Oh, by the way, I am getting the postdata out of five checkboxes.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



sessions, Internet Explorer cookies and domain forwarding

2008-06-05 Thread Wim Feijen

Hello everyone,

Django is great. But I am experiencing a problem when trying to log in
to my site using Internet Explorer.

When I go to:
http://85.214.104.194:8098/accounts/login/
logging in works as it should.

However, at:
http://www.jouwadresboek.nl/
, which is hosted at Strato and forwarded to the above, logging in
fails, because I.E. cannot set the cookie.

How do I solve this?

Any tips and hints you can give me, would be appreciated very much,

Thanks for your help,

Wim

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: use my own widgets when creating a form out of a model

2008-06-05 Thread Wim Feijen

Hi Richard and Rishabh,

Thanks for your help.

Actually, I want all fields to show up as a textarea with 40
columns. :}  So I guess I just have to define each field separately
without using inheritance. Which is a pity. It's a solution, though.

Bye,

Wim


On 4 jun, 17:50, "Rishabh Manocha" <[EMAIL PROTECTED]> wrote:
> What you want to do is perfectly doable. If (for example) you want the
> street field to show up as a textarea with 40 columns in your form, you
> would put something like this in your forms.py:
>
> class PersonForm(ModelForm):
>street = forms.CharField(widget = forms.TextArea(attrs = {"cols":40}))
>class Meta:
>model = Person
>fields = ['name', 'notes', 'email', 'cellphone',
> 'officephone', 'skypename', 'street', 'number', 'suffix', 'zip',
> 'city', 'country', 'photo']
>
> You can of-course do this with any field and use any widget for said field.
>
> Best,
>
> R
>
> On Wed, Jun 4, 2008 at 6:49 PM, Wim Feijen <[EMAIL PROTECTED]> wrote:
>
> > Hello people,
>
> > Being able to work with Django is very helpful to me. However, I am
> > unsure whether I can create a form out of a database model and then
> > customize that form. Using widgets to increase the textarea to 40
> > would be great! But after reading  the documentation I am convinced I
> > cannot do that.
>
> > One solution I can think of, is to loop over the fields in the form
> > and start changing those? Is that possible? Then again, is that the
> > proper way to do it?
>
> > My models are below.
>
> > Thanks for any help!
>
> > Wim
>
> > 
>
> > class Person(models.Model):
> >name = models.CharField(max_length=100)
> >notes = models.CharField(max_length=100, blank=True)
> >email = models.EmailField(max_length=100, blank=True)
> >cellphone = models.CharField(max_length=100, blank=True)
> >officephone = models.CharField(max_length=100, blank=True)
> >chat = models.CharField(max_length=100, blank=True)
> >skypename = models.CharField(max_length=100, blank=True)
> >street = models.CharField(max_length=100, blank=True)
> >number = models.CharField(max_length=100, blank=True)
> >suffix = models.CharField(max_length=100, blank=True)
> >zip = models.CharField(max_length=100, blank=True)
> >city = models.CharField(max_length=100, blank=True)
> >country = models.CharField(max_length=100, blank=True)
> >photo = models.ImageField(upload_to='.', blank=True)
> >company = models.ManyToManyField(Company)
> >groups = models.ManyToManyField(Group)
> >deleted = models.BooleanField(default=False)
> >shared = models.ManyToManyField(User, related_name='shared')
> >owner = models.ForeignKey(User)
>
> >def __str__(self):
> >return self.name
>
> > class PersonForm(ModelForm):
> >class Meta:
> >model = Person
> >fields = ['name', 'notes', 'email', 'cellphone',
> > 'officephone', 'skypename', 'street', 'number', 'suffix', 'zip',
> > 'city', 'country', 'photo']
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



use my own widgets when creating a form out of a model

2008-06-04 Thread Wim Feijen

Hello people,

Being able to work with Django is very helpful to me. However, I am
unsure whether I can create a form out of a database model and then
customize that form. Using widgets to increase the textarea to 40
would be great! But after reading  the documentation I am convinced I
cannot do that.

One solution I can think of, is to loop over the fields in the form
and start changing those? Is that possible? Then again, is that the
proper way to do it?

My models are below.

Thanks for any help!

Wim



class Person(models.Model):
name = models.CharField(max_length=100)
notes = models.CharField(max_length=100, blank=True)
email = models.EmailField(max_length=100, blank=True)
cellphone = models.CharField(max_length=100, blank=True)
officephone = models.CharField(max_length=100, blank=True)
chat = models.CharField(max_length=100, blank=True)
skypename = models.CharField(max_length=100, blank=True)
street = models.CharField(max_length=100, blank=True)
number = models.CharField(max_length=100, blank=True)
suffix = models.CharField(max_length=100, blank=True)
zip = models.CharField(max_length=100, blank=True)
city = models.CharField(max_length=100, blank=True)
country = models.CharField(max_length=100, blank=True)
photo = models.ImageField(upload_to='.', blank=True)
company = models.ManyToManyField(Company)
groups = models.ManyToManyField(Group)
deleted = models.BooleanField(default=False)
shared = models.ManyToManyField(User, related_name='shared')
owner = models.ForeignKey(User)

def __str__(self):
return self.name

class PersonForm(ModelForm):
class Meta:
model = Person
fields = ['name', 'notes', 'email', 'cellphone',
'officephone', 'skypename', 'street', 'number', 'suffix', 'zip',
'city', 'country', 'photo']

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---