Re: unique=True doesn't seem to do its job

2008-04-01 Thread Kenneth Gonsalves


On 02-Apr-08, at 12:03 PM, Julien wrote:

> get() returned more than one Project -- it returned 2! Lookup
> parameters were {'slug__exact': u'hello'}
>
> I have the same issue on the front end using ModelForm.
>
> Shouldn't that raise an IntegrityError, and then reload the form page
> with an error like: "This value is already taken, please give another
> one"?
>
> I'm using the latest trunk.

mysql?

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/code/




--~--~-~--~~~---~--~~
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: unique=True doesn't seem to do its job

2008-04-01 Thread Julien

Sorry, above I meant "I would NOT get an IntegrityError but the
following:..."

On Apr 2, 5:33 pm, Julien <[EMAIL PROTECTED]> wrote:
> Hi there,
>
> I have a slug field which I'd like to be unique, so I do like this:
>
> class Project(models.Model):
> slug = models.SlugField(_('bla'), max_length=50, blank=True,
> unique=True, help_text=_('blabla'))
>
> In admin, if I saved a project with the slug 'hello', and then saved
> another one with the same slug, I would get the IntegrityError but the
> following:
>
> get() returned more than one Project -- it returned 2! Lookup
> parameters were {'slug__exact': u'hello'}
>
> I have the same issue on the front end using ModelForm.
>
> Shouldn't that raise an IntegrityError, and then reload the form page
> with an error like: "This value is already taken, please give another
> one"?
>
> I'm using the latest trunk.
>
> Thanks!
>
> Julien
--~--~-~--~~~---~--~~
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: issue with the development server

2008-04-01 Thread Evert Rol

> I have a problem with the development server. I don't know if this
> behavior is right or if there is a problem.
> I have a view which is triggered throught an url. In this view I use
> urllib2. If I start the view with the development server the process
> is never ends. But if I start the view with the apache environment
> there is no problem

I don't know the details of the development server, but I've done  
something similar, and simply found that you cannot have one request  
within another on the same port with the development server. (Looks  
like Apache can live with that.)
The easiest solution I've found is to run another development server  
on another port, and then 'run' your view from there. You can then  
also conveniently track both requests for each development server.



> def any_view(request)
>import urllib2
>req = urllib2.Request(url='http://localhost:8000/url/')
>content = urllib2.urlopen(req).read()
>
>
> Is there a problem if I use/read a url and the current request isn't
> completed?
>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



unique=True doesn't seem to do its job

2008-04-01 Thread Julien

Hi there,

I have a slug field which I'd like to be unique, so I do like this:

class Project(models.Model):
slug = models.SlugField(_('bla'), max_length=50, blank=True,
unique=True, help_text=_('blabla'))

In admin, if I saved a project with the slug 'hello', and then saved
another one with the same slug, I would get the IntegrityError but the
following:

get() returned more than one Project -- it returned 2! Lookup
parameters were {'slug__exact': u'hello'}

I have the same issue on the front end using ModelForm.

Shouldn't that raise an IntegrityError, and then reload the form page
with an error like: "This value is already taken, please give another
one"?

I'm using the latest trunk.

Thanks!

Julien
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



issue with the development server

2008-04-01 Thread Brot

Hello,

I have a problem with the development server. I don't know if this
behavior is right or if there is a problem.
I have a view which is triggered throught an url. In this view I use
urllib2. If I start the view with the development server the process
is never ends. But if I start the view with the apache environment
there is no problem

def any_view(request)
import urllib2
req = urllib2.Request(url='http://localhost:8000/url/')
content = urllib2.urlopen(req).read()


Is there a problem if I use/read a url and the current request isn't
completed?


Bernd
--~--~-~--~~~---~--~~
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: some database error?: not sure...

2008-04-01 Thread Evert Rol

>> And a slightly problematic part is sqlite, which doesn't allow you  
>> to  ALTER tables (or at least not adding a column to a table); I  
>> use  sqlite mainly for testing & developing, recreating it every  
>> time one  of my model changes (the thing there that I found the  
>> most hassle is  entering an admin login, email & pass; I cannot  
>> script that...).
>
> It doesn't?

My bad; I knew there are some restrictions on altering tables, but  
picked the wrong one. It's dropping columns (a.o.) that apparently  
cannot be done.


> sqlite> .schema products_product
> CREATE TABLE "products_product" (
>"id" integer NOT NULL PRIMARY KEY,
>"code" varchar(32) NOT NULL UNIQUE,
>"product_line_id" integer NOT NULL,
>"name" varchar(128) NOT NULL,
>"charging_cycle" varchar(16) NOT NULL,
>"price" decimal NOT NULL,
>"active" bool NOT NULL,
>"active_from" datetime NULL,
>"active_to" datetime NULL
> );
> CREATE INDEX "products_product_product_line_id" ON  
> "products_product" ("product_line_id");
> sqlite> alter table products_product add column responsible_staff  
> integer;
> sqlite> .schema products_product
> CREATE TABLE "products_product" (
>"id" integer NOT NULL PRIMARY KEY,
>"code" varchar(32) NOT NULL UNIQUE,
>"product_line_id" integer NOT NULL,
>"name" varchar(128) NOT NULL,
>"charging_cycle" varchar(16) NOT NULL,
>"price" decimal NOT NULL,
>"active" bool NOT NULL,
>"active_from" datetime NULL,
>"active_to" datetime NULL
> , responsible_staff integer);
> CREATE INDEX "products_product_product_line_id" ON  
> "products_product" ("product_line_id");
>
>
>
> -- 
>
> Darryl Ross
> Director
> AFOYI, "Information Technology Solutions"
> p 08 7127 1831
> m 0400 206 443
> f 08 8425 9607
> e [EMAIL PROTECTED]
>
>


--~--~-~--~~~---~--~~
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: 2 questions on Model

2008-04-01 Thread Malcolm Tredinnick


On Tue, 2008-04-01 at 22:10 -0700, PENPEN wrote:
> 1. About select_related():
> It is said that it will automatically "follow" foreign-key
> relationships, selecting that additional related-object data when it
> executes its query. So it is not applicable for ManyToMany
> relationship, isn't it?

That's correct. It only follows non-nullable many-to-one relations.

> And if select_related() is used,  will the queryset method on the
> related Manager access the DB later? For example:
> b = Book.objects.select_related().get(id=4)
> p = b.author # Doesn't hit the database.
> p.get(pk=3) # Will this action hit the database?

If 'author' is marked as a ForeignKey on the Book model, then b.author
is an Author object. So b.author.get() makes no sense.

> 2.  About iterator(), 'for' and 'enumerate' on queryset:
> There is a snippet from the django document page(http://
> www.djangoproject.com/documentation/db-api/):

[... snip ...]

> It seems that 'for' loop and enumerate on a QuerySet will use its
> iterator. Then if I use 'for' loop or enumerate() on a queryset to do
> some logical task and in the template it will iterate the QuerySet
> again to display all the data, will the database be hit again?

Looping over an iterable object does not call the "iterator()" method.
It calls the __iter__() method. If you have a look at the definition of
__iter__ in query.py, you'll notice that it doesn't call iterator() if
the result_cache is populated.

Regards,
Malcolm

-- 
I've got a mind like a... a... what's that thing called? 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
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: 'module' object has no attribute 'day_abbr' --Problem editing using Admin

2008-04-01 Thread Ryan Vanasse

Thanks for the reply. I checked the DB file and yes, you were correct
about the updating the table.

I updated it using the manage.py sqlreset command. Currently it
contains an event date of type "date" (in the database mind you).

However, I also commented out, and then removed for good measure, the
"ordering" part of the model. Still nothing.

The exception is relating to _strptime.py.

I am wondering if maybe there's some conflict because my app name is
calendar...is it possible that this conflicts with a calendar object
in _strptime.py?

On Apr 1, 9:09 am, "Erik Vorhes" <[EMAIL PROTECTED]> wrote:
> That's because the table storing your information doesn't have an
> "EventDate" field, and it can't be ordered by something that doesn't
> exist. You'll need to update the table before it will work correctly.
>
> On Mon, Mar 31, 2008 at 1:25 AM, Ryan Vanasse <[EMAIL PROTECTED]> wrote:
>
> >  I just commented out the ordering, and it's bringing up the same
> >  error.
>
> >  When I try looking at the Events list (to check if anything was
> >  added), and got a Template syntax error. (see below)
> >  I used an SQLite admin program to check out what was in the
> >  calendar_Events table and found nothing.
>
> >  I have a couple of other projects on the same install (for
> >  experimentation) and they all appear to be working.
> >  I'm using .96
>
> >  Template syntax error:
> >  TemplateSyntaxError at /admin/calendar/event/
> >  'admin_list' is not a valid tag library: Could not load template
> >  library from django.templatetags.admin_list, cannot import name isleap
> >  Request Method: GET
>
> > Request URL:http://127.0.0.1:8000/admin/calendar/event/
> >  Exception Type: TemplateSyntaxError
> >  Exception Value:'admin_list' is not a valid tag library: Could not
> >  load template library from django.templatetags.admin_list, cannot
> >  import name isleap
> >  Exception Location: C:\Python25\lib\site-packages\django\template
> >  \defaulttags.py in load, line 750
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



2 questions on Model

2008-04-01 Thread PENPEN

1. About select_related():
It is said that it will automatically "follow" foreign-key
relationships, selecting that additional related-object data when it
executes its query. So it is not applicable for ManyToMany
relationship, isn't it?

And if select_related() is used,  will the queryset method on the
related Manager access the DB later? For example:
b = Book.objects.select_related().get(id=4)
p = b.author # Doesn't hit the database.
p.get(pk=3) # Will this action hit the database?

2.  About iterator(), 'for' and 'enumerate' on queryset:
There is a snippet from the django document page(http://
www.djangoproject.com/documentation/db-api/):
  iterator()
  Evaluates the QuerySet (by performing the query) and returns an
iterator over the results. ...
  Note that using iterator() on a QuerySet which has already been
evaluated will force it to evaluate again, repeating the query.

And I found the following document of python on iterater and
enumarate:
iterater http://www.python.org/dev/peps/pep-0234/
This document proposes an iteration interface that objects can
provide to control the behaviour of 'for' loops.
enumerate() http://www.python.org/dev/peps/pep-0279/
It provides all iterable collections with the same advantage that
iteritems() affords to
dictionaries -- a compact, readable, reliable index notation.

It seems that 'for' loop and enumerate on a QuerySet will use its
iterator. Then if I use 'for' loop or enumerate() on a queryset to do
some logical task and in the template it will iterate the QuerySet
again to display all the data, will the database be hit again?
--~--~-~--~~~---~--~~
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: Strange login error in newforms-admin site: ViewDoesNotExist at /accounts/login/

2008-04-01 Thread Michael

I tried this today with runserver and could not duplicate this issue.
It appears to be a mod_python issue. This is interesting.

On Tue, Apr 1, 2008 at 8:51 AM, Michael <[EMAIL PROTECTED]> wrote:
> >  Yours was one of the posts I discovered when I googled this but my
>  >  problem seemed to come out of nowhere and your report seemed to imply
>  >  a more reproducible issue.
>
>  It's difficult to reproduce, because it involves a rather deep level
>  of importing and self importing. This happens every once in a while
>  with auth for me and also for another app that is quite complex. I
>  have a test app tht I have been working with for a while to try to get
>  to the smallest denomiator, but I have been unable to pull this error
>  out of the shell yet.
>
>
>  >Is this problem intermittent or dependant
>  >  on what type of Django configuration you are using? (i.e. mod_python
>  >  vs Django dev server)
>
>  I have only been able to reproduce this on mod_python, but I'll give
>  it a try on the dev server later today and see if I can't reproduce it
>  there. As I said before I cannot reproduce this error in any tests or
>  in the shell, which is troublesome, but that could be because it is a
>  mod_python error. I will play with that today. Thanks for the idea,
>
>
>  >  Anyway. I'll try your fix and report back.
>
>  Let me know how it goes,
>
>  Michael
>

--~--~-~--~~~---~--~~
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: Error adding an excluded field

2008-04-01 Thread Kenneth Gonsalves


On 02-Apr-08, at 7:59 AM, [EMAIL PROTECTED] wrote:

> def cartuchoFallado(request,  numinfo):
> if request.method == 'POST':
> data = copy(request.POST)
> data['informe'] = numinfo
> form = forms.CartuchoFalladoFrm(data)
> if form.is_valid():
> form.save()
> return HttpResponseRedirect("")

I would add it after calling is_valid

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/code/




--~--~-~--~~~---~--~~
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: Advanced Form Questions

2008-04-01 Thread spirit

you can look at those articles:
http://www.djangoproject.com/documentation/newforms/
http://code.pui.ch/2007/01/07/using-djangos-newforms/

On 4月2日, 上午5时07分, "Chris Hartjes" <[EMAIL PROTECTED]> wrote:
> Hi there.  I'm a newbie at Python but have lots of experience with PHP and
> MVC frameworks in general.  The question I have is on the proper Django way
> to solve a problem.
> I want to create a form where you can enter multiple teams and multiple
> dates in order to find out where and when they are playing a baseball game.
>  So, in the abstract you'd have stuff like this:
>
> Team 1  
> Team 2  
> Team 3  
>
> So, my question becomes this:
>
> 1) how do I get Django to generate those form elements for me so I don't
> have to do it by hand
> 2) how do I get Django to process those values when they come in.
>
> I've been using the Django Book site and the Django Project site to help me,
> and they've been great but I can't find much about how to solve this
> problem.  Maybe my Google fu is not strong enough.
>
> I'm already creating my own Form object
>
> from django import newforms as forms
> class SearchForm(forms.Form) :
>team = forms.CharField()
>gameDate = forms.DateTimeField()
>
> and already understand to a certain extent how to process the incoming POST
> data
>
> def search_results(request):
> if request.method == 'POST':
> form = SearchForm(request.POST)
>  if form.is_valid():
> team = form.cleaned_data['team']
> gameDate = form.cleaned_data['gameDate']
> team = Team.objects.get(name=team)
> games = Game.objects.order_by('game_date').filter(home_team=team,
> game_date=gameDate) | 
> Game.objects.order_by('game_date').filter(away_team=team,
> game_date=gameDate)
>  if games.count <= 30:
> showResults = True
> else:
> showResults = False
>  else:
> games = 'Hoopa'
>  return render_to_response('search/results.html', {'games': games,
> 'showResults': showResults})
> else:
> return HttpResponseRedirect('index/index.html')
>
> Any help would be greatly appreciated. Tips on doing things the Django way,
> or even just the Python way are good as well.  I'm trying hard to not write
> PHP-style code in Python.  :)
>
> --
> Chris Hartjes
--~--~-~--~~~---~--~~
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: Advanced Form Questions

2008-04-01 Thread spirit

About
"1) how do I get Django to generate those form elements for me so I
don't
have to do it by hand
2) how do I get Django to process those values when they come in. "

you can look at those articles belows:
http://www.djangoproject.com/documentation/newforms/
http://code.pui.ch/2007/01/07/using-djangos-newforms/

On 4月2日, 上午5时07分, "Chris Hartjes" <[EMAIL PROTECTED]> wrote:
> Hi there.  I'm a newbie at Python but have lots of experience with PHP and
> MVC frameworks in general.  The question I have is on the proper Django way
> to solve a problem.
> I want to create a form where you can enter multiple teams and multiple
> dates in order to find out where and when they are playing a baseball game.
>  So, in the abstract you'd have stuff like this:
>
> Team 1  
> Team 2  
> Team 3  
>
> So, my question becomes this:
>
> 1) how do I get Django to generate those form elements for me so I don't
> have to do it by hand
> 2) how do I get Django to process those values when they come in.
>
> I've been using the Django Book site and the Django Project site to help me,
> and they've been great but I can't find much about how to solve this
> problem.  Maybe my Google fu is not strong enough.
>
> I'm already creating my own Form object
>
> from django import newforms as forms
> class SearchForm(forms.Form) :
>team = forms.CharField()
>gameDate = forms.DateTimeField()
>
> and already understand to a certain extent how to process the incoming POST
> data
>
> def search_results(request):
> if request.method == 'POST':
> form = SearchForm(request.POST)
>  if form.is_valid():
> team = form.cleaned_data['team']
> gameDate = form.cleaned_data['gameDate']
> team = Team.objects.get(name=team)
> games = Game.objects.order_by('game_date').filter(home_team=team,
> game_date=gameDate) | 
> Game.objects.order_by('game_date').filter(away_team=team,
> game_date=gameDate)
>  if games.count <= 30:
> showResults = True
> else:
> showResults = False
>  else:
> games = 'Hoopa'
>  return render_to_response('search/results.html', {'games': games,
> 'showResults': showResults})
> else:
> return HttpResponseRedirect('index/index.html')
>
> Any help would be greatly appreciated. Tips on doing things the Django way,
> or even just the Python way are good as well.  I'm trying hard to not write
> PHP-style code in Python.  :)
>
> --
> Chris Hartjes
--~--~-~--~~~---~--~~
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 newbie question about views and authentication

2008-04-01 Thread SmileyChris

You can use the django.views.generic.simple "direct_to_template" view
just like you would the render_to_response shortcut - it works the
same except you pass in the request as the first argument:

direct_to_template(request, 'template/index.html')

On Apr 2, 2:42 am, Matias Surdi <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Suppose I've the following on the top of every page of my application
> (in base.html for example):
>
> {% if user.is_authenticated %}
>  Welcome, {{ user.username }}. Thanks for logging in.
> {% else %}
>  Welcome, new user. Please log in.
> {% endif %}
>
> Now, as far as I understand I must ALWAYS do the following in ALL views:
>
> def index(request):
>  render_to_response('template/index.html',{},
>  context_instance=RequestContext(request))
>
> So, I have to pass always the parameter context_instance to the
> render_to_response shortcut.
>
> ¿Is this correct? Isn't it a bit tedious to do this with all views? What
> if I forget to add the RequestContext thing in a view?
>
> Any aclaration will be appreciated.
>
> Thanksa 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Error adding an excluded field

2008-04-01 Thread jorgehugoma
heres my modelform class:

class CartuchoFalladoFrm(ModelForm):
class Meta:
model = models.CartuchoFallado
exclude = ('informe',)#My model has for fields serie, cartucho, marca, 
informe

and here is my view function:
def cartuchoFallado(request,  numinfo):
if request.method == 'POST':
data = copy(request.POST)
data['informe'] = numinfo
form = forms.CartuchoFalladoFrm(data)
if form.is_valid():
form.save()
return HttpResponseRedirect("")  

hopefully u won't have any problems with Spanglish.


Jorge Hugo Murillo


- Original Message 
From: Malcolm Tredinnick <[EMAIL PROTECTED]>
To: django-users@googlegroups.com
Sent: Tuesday, April 1, 2008 10:16:22 PM
Subject: Re: Error adding an excluded field



On Tue, 2008-04-01 at 19:09 -0700, [EMAIL PROTECTED] wrote:
> Malcom,
> 
> I looked at the ModelForm documentation and to be honest with you i
> don't understand how am i suppose to change or add a required value
> that i excluded. I should underscore that i am fairly new to django so
> please bare with me.
> I tried coping request.POST into a dictionary variable and adding the 
> required value and then create my form instance like this:
> 
> if request.method == 'POST':
> data = copy(request.POST)
> data['required_field'] = value
> form = forms.Model2Form(data)
> if form.is_valid():
> form.save()
> return HttpResponseRedirect("")
> 
> but i get the same error. As for your second suggestion i am not quite
>  sure what should i do.

Perhaps you could supply a short, complete example that demonstrates the
problem. Since Model2Form is not a Django class or function and the last
time you posted this you used Model2FromClass, it's not really clear
what is your code and what is just straight Django.

So create a simple example with a small model and a small form that
shows the problem you having. Then we can talk about specific lines of
code, rather than having to guess at the missing pieces.

Regards,
Malcolm

> 
-- 
Despite the cost of living, have you noticed how popular it remains? 
http://www.pointy-stick.com/blog/









  

You rock. That's why Blockbuster's offering you one month of Blockbuster Total 
Access, No Cost.  
http://tc.deals.yahoo.com/tc/blockbuster/text5.com
--~--~-~--~~~---~--~~
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: some database error?: not sure...

2008-04-01 Thread Darryl Ross

Evert Rol wrote:
And a slightly problematic part is sqlite, which doesn't allow you to  
ALTER tables (or at least not adding a column to a table); I use  
sqlite mainly for testing & developing, recreating it every time one  
of my model changes (the thing there that I found the most hassle is  
entering an admin login, email & pass; I cannot script that...).


It doesn't?

sqlite> .schema products_product
CREATE TABLE "products_product" (
"id" integer NOT NULL PRIMARY KEY,
"code" varchar(32) NOT NULL UNIQUE,
"product_line_id" integer NOT NULL,
"name" varchar(128) NOT NULL,
"charging_cycle" varchar(16) NOT NULL,
"price" decimal NOT NULL,
"active" bool NOT NULL,
"active_from" datetime NULL,
"active_to" datetime NULL
);
CREATE INDEX "products_product_product_line_id" ON "products_product" 
("product_line_id");

sqlite> alter table products_product add column responsible_staff integer;
sqlite> .schema products_product
CREATE TABLE "products_product" (
"id" integer NOT NULL PRIMARY KEY,
"code" varchar(32) NOT NULL UNIQUE,
"product_line_id" integer NOT NULL,
"name" varchar(128) NOT NULL,
"charging_cycle" varchar(16) NOT NULL,
"price" decimal NOT NULL,
"active" bool NOT NULL,
"active_from" datetime NULL,
"active_to" datetime NULL
, responsible_staff integer);
CREATE INDEX "products_product_product_line_id" ON "products_product" 
("product_line_id");




--

Darryl Ross
Director
AFOYI, "Information Technology Solutions"
p 08 7127 1831
m 0400 206 443
f 08 8425 9607
e [EMAIL PROTECTED]




signature.asc
Description: OpenPGP digital signature


Re: Error adding an excluded field

2008-04-01 Thread Malcolm Tredinnick


On Tue, 2008-04-01 at 19:09 -0700, [EMAIL PROTECTED] wrote:
> Malcom,
> 
> I looked at the ModelForm documentation and to be honest with you i
> don't understand how am i suppose to change or add a required value
> that i excluded. I should underscore that i am fairly new to django so
> please bare with me.
> I tried coping request.POST into a dictionary variable and adding the 
> required value and then create my form instance like this:
> 
> if request.method == 'POST':
> data = copy(request.POST)
> data['required_field'] = value
> form = forms.Model2Form(data)
> if form.is_valid():
> form.save()
> return HttpResponseRedirect("")
> 
> but i get the same error. As for your second suggestion i am not quite
>  sure what should i do.

Perhaps you could supply a short, complete example that demonstrates the
problem. Since Model2Form is not a Django class or function and the last
time you posted this you used Model2FromClass, it's not really clear
what is your code and what is just straight Django.

So create a simple example with a small model and a small form that
shows the problem you having. Then we can talk about specific lines of
code, rather than having to guess at the missing pieces.

Regards,
Malcolm

> 
-- 
Despite the cost of living, have you noticed how popular it remains? 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
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: Error adding an excluded field

2008-04-01 Thread jorgehugoma
Malcom,

I looked at the ModelForm documentation and to be honest with you i don't 
understand how am i suppose to change or add a required value that i excluded. 
I should underscore that i am fairly new to django so please bare with me.
I tried coping request.POST into a dictionary variable and adding the required 
value and then create my form instance like this:

if request.method == 'POST':
data = copy(request.POST)
data['required_field'] = value
form = forms.Model2Form(data)
if form.is_valid():
form.save()
return HttpResponseRedirect("")

but i get the same error. As for your second suggestion i am not quite sure 
what should i do.
Thanks,
 
Jorge Hugo Murillo

When a ModelForm is saved it doesn't take the data from attributes on
the form like you're guessing it does. It looks in cleaned_data.

So you could pass in your compulsory values when initialising the form
instance (make a dictionary that combines request.POST and the required
values and pass that to the constructor instead of request.POST).

Or you could write a save() method on your form that passes commit=False
to the ModelForm.save() method and then update the object instance and
save it in your own method. That's the most logical approach -- you want
different save() behaviour, so you override the default save() method.
It's all documented in the modelforms documentation.

Regards,
Malcolm

> 
-- 
Monday is an awful way to spend 1/7th of your life. 
http://www.pointy-stick.com/blog/









  

You rock. That's why Blockbuster's offering you one month of Blockbuster Total 
Access, No Cost.  
http://tc.deals.yahoo.com/tc/blockbuster/text5.com
--~--~-~--~~~---~--~~
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: Adding an "invalid" choice to a ChoiceField?

2008-04-01 Thread [EMAIL PROTECTED]

I assume he meant required=True, because being required is what causes
'' to not be allowed.

On Apr 1, 8:38 pm, Michael <[EMAIL PROTECTED]> wrote:
> > TOPIC_CHOICES=[('', '-- pick one --'), ('key1', '...'), ...]
>
> Thanks, using an empty string for the value seems to do the trick. Is
> there somewhere in the documentation that explains this behavior? I'm
> not able to locate it anywhere.
>
> > And required=False for the ChoiceField (which is the default).
>
> Are you sure? the newforms documentation [1] seems to indicate that
> required=True is the default for all Fields.
>
> [1]http://www.djangoproject.com/documentation/newforms/#required
--~--~-~--~~~---~--~~
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: Adding an "invalid" choice to a ChoiceField?

2008-04-01 Thread Michael

> TOPIC_CHOICES=[('', '-- pick one --'), ('key1', '...'), ...]

Thanks, using an empty string for the value seems to do the trick. Is
there somewhere in the documentation that explains this behavior? I'm
not able to locate it anywhere.

> And required=False for the ChoiceField (which is the default).

Are you sure? the newforms documentation [1] seems to indicate that
required=True is the default for all Fields.

[1] http://www.djangoproject.com/documentation/newforms/#required
--~--~-~--~~~---~--~~
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: JSON serializers.serialize raises DoesNotExist on recursive data structures

2008-04-01 Thread 1234
Is this model work on in admin?

2008/4/1, Legioneer <[EMAIL PROTECTED]>:
>
>
> My data model is very similar to your:
>
> class Category(models.Model):
> name = models.CharField(max_length=64)
> descr = models.CharField(max_length=255, blank=True)
> rank = models.PositiveIntegerField(default=10)
> parent = models.ForeignKey('self', null=True, blank=True,
> related_name='child_set')
>
> but because of some reason it doesn't want to to go through JSON
> serializer :(
>
> Anthony
>
>
> > this is my example
> >
> > class Type(models.Model):
> > type = models.CharField('分类名称',maxlength=50,core=True)
> > path = models.CharField
> ('url地址',maxlength=250,blank=True,editable=False)
> > typename = models.CharField('分类名称',maxlength=200,editable=False)
> > parent = models.ForeignKey('self',related_name="munchie",null=True,
> > blank=True)
> > created = models.DateTimeField(auto_now_add=True)
> >
> > order_id=models.IntegerField ('排序',default=0)
> > fid=models.IntegerField ('根ID',default=0,editable=False)
> > cengshu=models.IntegerField ('层数',default=1,editable=False)
> >
>
> >
>

--~--~-~--~~~---~--~~
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: inclusion tags and RequestContext

2008-04-01 Thread Malcolm Tredinnick


On Tue, 2008-04-01 at 07:40 -0700, Panos Laganakos wrote:
> I changed the definition of the inclusion tag to accept a second
> parameter in the form of:
> 
> def my_function(context, myparam):
> ...
> 
> but I didn't get access to the variables  in the context, I had to:
> 
> return {
> 'myparam': myparam,
> 'acontextvar': context['acontextvar']
> }
> 
> Is this normal, or am I supposed to get access to all of them once I
> include context as my first param?

It's impossible to debug something from just two lines of code, since
it's obvious there are many options that are possible and you haven't
specified what you've done or what you're trying to do. You talk about
"access" to variables and then mention the return statement, which seem
entirely disconnected.

Please post a short, complete example demonstrating what you're trying
to do so that people trying to help you can look at the whole thing.


Malcolm

-- 
Tolkien is hobbit-forming. 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
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: Just learning the ropes with Django and authentication

2008-04-01 Thread Jeremy Sandell

Probably the best way to understand how it works is to check the
source. under django/contrib/admin/views/decorators.py is the view
(_display_login_form), and under django/contrib/admin/templates/admin/
login.html is the form itself.

I'd also suggest looking at django/contrib/auth/ for futher insight as
to what's going on there.

Hope this helps.

On Mar 31, 11:26 pm, James <[EMAIL PROTECTED]> wrote:
> I am trying to figure out if there is a way to used the Django built
> in login page (the one used to get into the administration pages) and
> link that to my own site.  I am also just beginning in the website
> business as well.  Does anyone have any suggestions, or anyway that I
> can better understand the template system they used to create that
> login information.
--~--~-~--~~~---~--~~
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 newbie question about views and authentication

2008-04-01 Thread Malcolm Tredinnick


On Tue, 2008-04-01 at 15:42 +0200, Matias Surdi wrote:
[...]
> ¿Is this correct? Isn't it a bit tedious to do this with all views? What 
> if I forget to add the RequestContext thing in a view?

If you don't pass in the parameters that are required, the function
won't be able to use them. Surely that isn't confusing.

If you really find yourself making exactly the same call every single
time, write yourself a one line function that accepts a 'request'
parameter in addition to the rest and turns it into a call like the
above. I personally don't do things that way, since (a) it's pretty much
just as much typing when you use descriptive function names
(particularly since any decent editor will only require you to type a
few characters to get "RequestContext" in the code), (b) explicit coding
is clearer, (c) I rarely "just" do that one line and instead have a full
function that does all the common stuff at the end of each view. So I
end up calling finish_view(request, ...), or whatever my function is,
each time, and it calls render_to_response(...) amongst other things.

In short, if you find yourself doing something repeatedly, write a
function that captures the common stuff if you would find it easier.
There are many different ways this commonality could display itself, so
it makes sense for you to write the function that best suits your
purpose than for Django to ship half a dozen variants that still won't
be suitable for many purposes.

Regards,
Malcolm

-- 
If you think nobody cares, try missing a couple of payments. 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
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: Example application

2008-04-01 Thread Jeremy Sandell

There are some great resources available here:
http://code.djangoproject.com/wiki/DjangoResources

Though you might be better served creating a mockup site in Django,
and implementing such things using the rest of the Django
documentation (outside of the tutorials, I mean).

Anyway, good luck!

On Apr 1, 5:54 pm, "Cruskaya Smith" <[EMAIL PROTECTED]> wrote:
> Hi, I am new to django, and I programed the 4 tutorials site django, I
> want to investigate other examples for have better idea of managing
> code; someone has a small example of handling forms with newforms and
> make such basic tasks: addition, edit, display, lists (especially in
> handling forms with tables relations)
>
> Thanks
>
> Cruskaya
--~--~-~--~~~---~--~~
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: Error adding an excluded field

2008-04-01 Thread Malcolm Tredinnick


On Tue, 2008-04-01 at 16:28 -0700, [EMAIL PROTECTED] wrote:
> Hello,
> 
> How do I add a field that is required by my database but excluded in
> my forms.py? I used ModelForm class to define my forms but in the meta
> class I excluded one of the required fields so i can add it later in
> my views.py. I tried adding the value using the save(commit = False)
> like this:
> 
> if request.method == 'POST':
> form = forms.Model2FromClass(request.POST)
> if form.is_valid():
> formInstance = form.save(commit = False)
> formInstance.required_field = value
> formInstance.save()
> return HttpResponseRedirect("on/success")
> 
> I get an IntegrityError saying that the required_field cannot be null.
> I also tried defining, in the form class, a new function that sets
> this variable but results in the same error. Can somebody please help
> me i don't know what i am doing wrong or not doing.

When a ModelForm is saved it doesn't take the data from attributes on
the form like you're guessing it does. It looks in cleaned_data.

So you could pass in your compulsory values when initialising the form
instance (make a dictionary that combines request.POST and the required
values and pass that to the constructor instead of request.POST).

Or you could write a save() method on your form that passes commit=False
to the ModelForm.save() method and then update the object instance and
save it in your own method. That's the most logical approach -- you want
different save() behaviour, so you override the default save() method.
It's all documented in the modelforms documentation.

Regards,
Malcolm

> 
-- 
Monday is an awful way to spend 1/7th of your life. 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Error adding an excluded field

2008-04-01 Thread jorgehugoma
Hello,

How do I add a field that is required by my database but excluded in my 
forms.py? I used ModelForm class to define my forms but in the meta class I 
excluded one of the required fields so i can add it later in my views.py. I 
tried adding the value using the save(commit = False) like this:

if request.method == 'POST':
form = forms.Model2FromClass(request.POST)
if form.is_valid():
formInstance = form.save(commit = False)
formInstance.required_field = value
formInstance.save()
return HttpResponseRedirect("on/success")

I get an IntegrityError saying that the required_field cannot be null.
I also tried defining, in the form class,  a new function that sets this 
variable but results in the same error. Can somebody please help me i don't 
know what i am doing wrong or not doing.

Thanks in advance,
 
Jorge Hugo Murillo





  

You rock. That's why Blockbuster's offering you one month of Blockbuster Total 
Access, No Cost.  
http://tc.deals.yahoo.com/tc/blockbuster/text5.com
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Error adding an excluded field

2008-04-01 Thread jorgehugoma
Hello,

How do I add a field that is required by my database but excluded in my 
forms.py? I used ModelForm class to define my forms but in the meta class I 
excluded one of the required fields so i can add it later in my views.py. I 
tried adding the value using the save(commit = False) like this:

if request.method == 'POST':
form = forms.Model2FromClass(request.POST)
if form.is_valid():
formInstance = form.save(commit = False)
formInstance.required_field = value
formInstance.save()
return HttpResponseRedirect("on/success")

I get an IntegrityError saying that the required_field cannot be null.
I also tried defining, in the form class,  a new function that sets this 
variable but results in the same error. Can somebody please help me i don't 
know what i am doing wrong or not doing.

Thanks in advance,
 
Jorge Hugo Murillo





  

You rock. That's why Blockbuster's offering you one month of Blockbuster Total 
Access, No Cost.  
http://tc.deals.yahoo.com/tc/blockbuster/text5.com
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



mysql-devel on mac

2008-04-01 Thread stranger

Hello everyone,

  I am having problem with mysql-python installation on leopard. I
am getting errors when compiling mysql-python.

error: command 'gcc' failed with exit status 1
mysql.c:35:23: error: my_config.h: No such file or directory
_mysql.c:40:19: error: mysql.h: No such file or directory
_mysql.c:41:26: error: mysqld_error.h: No such file or directory
_mysql.c:42:20: error: errmsg.h: No such file or directory
_mysql.c:78: error: syntax error before 'MYSQL'


Can anyone suggest me how to fix mysql headers so that mysql-python
compiles and get installed.  I installed MYSQL using this article an
it worked fine. 
http://www.red91.com/articles/2007/12/14/installing-mysql-on-leopard

Any suggestions to get mysql-devel working.



--~--~-~--~~~---~--~~
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: Complicated relations

2008-04-01 Thread Russell Keith-Magee


On 01/04/2008, at 12:31 AM, R. Akerman wrote:
>
> Ah great, I thought I went over the models documentation but must have
> missed just what I was looking for... Thanks, I'll have a go at it

You may also be interested in ticket #6095 [1]. This is an effort to  
add m2m intermediary models as part of the Django core, including  
integration with the query syntax.

[1] http://code.djangoproject.com/ticket/6095

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: Calling syncdb twice

2008-04-01 Thread Russell Keith-Magee


On 31/03/2008, at 10:51 PM, Evert Rol wrote:
>
>> I was wondering why you can only call "python manage.py syncdb" to
>> create your databases but after that if you change your models file
>> it work create the changes and you have to do them manually using  
>> SQL?
>
> I think there are several threads in this discussion group that have
> some mention of the hows and whys (google for them), but basically:
> it's too complicated, or otherwise very tricky, to alter tables
> (altering or adding columns) automatically. In particular, it won't
> even work with sqlite (http://www.sqlite.org/omitted.html).

This isn't entirely correct. It can be done; it's just difficult, and  
involves the production of a temporary table.

Another poster has pointed out that Django Evolution [1] is one of  
several implementations [2] of this functionality. One of these  
implementations may eventually be merged into trunk, but this won't  
happen until they are feature complete, and a consensus exists in the  
community as to the 'best' solution.

[1] http://code.google.com/p/django-evolution/
[2] http://code.djangoproject.com/wiki/SchemaEvolution

(Full disclosure - I'm a core developer of Django Evolution)

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
-~--~~~~--~~--~--~---



Example application

2008-04-01 Thread Cruskaya Smith

Hi, I am new to django, and I programed the 4 tutorials site django, I
want to investigate other examples for have better idea of managing
code; someone has a small example of handling forms with newforms and
make such basic tasks: addition, edit, display, lists (especially in
handling forms with tables relations)


Thanks

Cruskaya

--~--~-~--~~~---~--~~
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: Adding additional needed information in to newforms post

2008-04-01 Thread timc3

On Apr 1, 10:49 pm, "Phil Davis" <[EMAIL PROTECTED]> wrote:
> On 01/04/2008, timc3 <[EMAIL PROTECTED]> wrote:

Yes I think that you are right, and I actually did that on another
form.  Trouble is on that I noticed a problem with
form.save(commit=False) when you have a multipart form it will
actually save the File when using commit=False and then again when you
just call form.save()

Thanks for the help.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Advanced Form Questions

2008-04-01 Thread Chris Hartjes
Hi there.  I'm a newbie at Python but have lots of experience with PHP and
MVC frameworks in general.  The question I have is on the proper Django way
to solve a problem.
I want to create a form where you can enter multiple teams and multiple
dates in order to find out where and when they are playing a baseball game.
 So, in the abstract you'd have stuff like this:

Team 1  
Team 2  
Team 3  

So, my question becomes this:

1) how do I get Django to generate those form elements for me so I don't
have to do it by hand
2) how do I get Django to process those values when they come in.

I've been using the Django Book site and the Django Project site to help me,
and they've been great but I can't find much about how to solve this
problem.  Maybe my Google fu is not strong enough.

I'm already creating my own Form object

from django import newforms as forms
class SearchForm(forms.Form) :
   team = forms.CharField()
   gameDate = forms.DateTimeField()

and already understand to a certain extent how to process the incoming POST
data

def search_results(request):
if request.method == 'POST':
form = SearchForm(request.POST)
 if form.is_valid():
team = form.cleaned_data['team']
gameDate = form.cleaned_data['gameDate']
team = Team.objects.get(name=team)
games = Game.objects.order_by('game_date').filter(home_team=team,
game_date=gameDate) | Game.objects.order_by('game_date').filter(away_team=team,
game_date=gameDate)
 if games.count <= 30:
showResults = True
else:
showResults = False
 else:
games = 'Hoopa'
 return render_to_response('search/results.html', {'games': games,
'showResults': showResults})
else:
return HttpResponseRedirect('index/index.html')


Any help would be greatly appreciated. Tips on doing things the Django way,
or even just the Python way are good as well.  I'm trying hard to not write
PHP-style code in Python.  :)

-- 
Chris Hartjes

--~--~-~--~~~---~--~~
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: Auth System

2008-04-01 Thread Mat

Thanks for the quick low down, very useful!

Annoyingly, I need full permission based system on objects, not an owner
setup. Objects typically have 5-15 different permissions which may or may
not be set, and these need limiting per user per object. Seems like
generic-auth was ideal in theory.

Does anyone know why it died? Technical problems, lack of time??? As this is
something I would need, it would certainly be sensible for me to look at,
and either start again, or try and complete/revive.

Also would anyone advise another solution, or would it be fool hardy to try
and revive/use it for a project?

Mat

-Original Message-
From: django-users@googlegroups.com [mailto:[EMAIL PROTECTED]
On Behalf Of James Bennett
Sent: 01 April 2008 21:47
To: django-users@googlegroups.com
Subject: Re: Auth System


On Tue, Apr 1, 2008 at 3:38 PM, Mat <[EMAIL PROTECTED]> wrote:
>  I'm looking at django for a new project, and have a quick question, I'm
>  going to need a mixture of the Query-set branch and generic-auth branch,
I
>  really need object based permissions, but it seems like generic-auth was
>  last modified ~1 year ago, does that mean its complete, the wiki seems to
>  say in-progress and docs need updating, does anyone know the state of it?

The state of it is "dead".

A quick field guide to branches of Django:

* queryset-refactor is active and will merge into trunk before Django
1.0 is released.

* newforms-admin is active and will merge into trunk before Django 1.0
is released.

* gis is active and aims to produce a 'contrib' app which can be
bundled with Django at some point.

* Branches whose names end in "bugfixes" provide security updates for
specific release versions.

* Everything else is dead or finished. If the current Django
documentation doesn't contain mention of a feature a branch was
working on, then that branch/feature never landed.

>  Also the wiki says "The authentication framework is changing to be far
more
>  flexible, and API changes may be necessary.", what is this likely to be,
>  Object based permissions??? (I hope!!), and any news on a timeframe?

99.9% of what people want "object-based permissions"
for is really to implement an admin interface where some users are
only allowed to edit things they themselves created in the first
place. The refactoring in newforms-admin makes this ludicrously easy
to do without a complex permissions system, so odds are that
"object-based permissions" are a dead end.


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of
correct."




--~--~-~--~~~---~--~~
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: Adding additional needed information in to newforms post

2008-04-01 Thread Phil Davis

On 01/04/2008, timc3 <[EMAIL PROTECTED]> wrote:
>  I thought that I could add in some additional information to a form
>  before it gets saved as a new object in the database but the following
>  isn't working:
>
>  def groupadd(request):
>
> if request.method == 'POST':
> form = GroupForm(request.POST)
> if form.is_valid():
> data = form.cleaned_data
> data['group_owner'] = request.user.id
> data['group_members'] = request.user.id
> data['group_admins'] = request.user.id
>
> newform = GroupForm(data)
> newform.save

Is this a typo or do you really have newform.save and not newform.save()?
If so then that is one of your problems since you are not actualling calling
the save method, just returning its type.

>  It doesn't return any error and it doesn't save the new object.  Is
>  there anyway of sending additional data with a form?

I believe the better way to achieve what you are trying to do is:

   if form.is_valid():
  newgroup = form.save(commit=False)
  newgroup.group_owner = request.user.id
  newgroup.group_members = request.user.id
  newgroup.group_admins = request.user.id

  newgroup.save()
  return HttpResponseRedirect("/group/list/")

--~--~-~--~~~---~--~~
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: Auth System

2008-04-01 Thread James Bennett

On Tue, Apr 1, 2008 at 3:38 PM, Mat <[EMAIL PROTECTED]> wrote:
>  I'm looking at django for a new project, and have a quick question, I'm
>  going to need a mixture of the Query-set branch and generic-auth branch, I
>  really need object based permissions, but it seems like generic-auth was
>  last modified ~1 year ago, does that mean its complete, the wiki seems to
>  say in-progress and docs need updating, does anyone know the state of it?

The state of it is "dead".

A quick field guide to branches of Django:

* queryset-refactor is active and will merge into trunk before Django
1.0 is released.

* newforms-admin is active and will merge into trunk before Django 1.0
is released.

* gis is active and aims to produce a 'contrib' app which can be
bundled with Django at some point.

* Branches whose names end in "bugfixes" provide security updates for
specific release versions.

* Everything else is dead or finished. If the current Django
documentation doesn't contain mention of a feature a branch was
working on, then that branch/feature never landed.

>  Also the wiki says "The authentication framework is changing to be far more
>  flexible, and API changes may be necessary.", what is this likely to be,
>  Object based permissions??? (I hope!!), and any news on a timeframe?

99.9% of what people want "object-based permissions"
for is really to implement an admin interface where some users are
only allowed to edit things they themselves created in the first
place. The refactoring in newforms-admin makes this ludicrously easy
to do without a complex permissions system, so odds are that
"object-based permissions" are a dead end.


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Auth System

2008-04-01 Thread Mat

Hey guys,

I'm looking at django for a new project, and have a quick question, I'm
going to need a mixture of the Query-set branch and generic-auth branch, I
really need object based permissions, but it seems like generic-auth was
last modified ~1 year ago, does that mean its complete, the wiki seems to
say in-progress and docs need updating, does anyone know the state of it?

Also the wiki says "The authentication framework is changing to be far more
flexible, and API changes may be necessary.", what is this likely to be,
Object based permissions??? (I hope!!), and any news on a timeframe?

Should I try and merge query-set and generic-auth, or would I be better
waiting for any potential new auth system? Any thoughts, I'd love to hear
them,

Thanks in Advance,
Mat


--~--~-~--~~~---~--~~
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: ImportError on login/logout

2008-04-01 Thread Michael

What version of Django are you using? Do you have django.contrib.auth
in your INSTALLED_APPS?

On Tue, Apr 1, 2008 at 12:10 PM, knack <[EMAIL PROTECTED]> wrote:
>
>  I created a brand new project and app, left the default settings
>  untouched, ran syncdb to create the user authentication tables, and
>  created a very simple view (just returns an HttpResponse object) that
>  requires login permission. Same error: "ImportError at /accounts/
>  login/: No module named login".
>
>  I'm beginning to suspect that this some kind of bug, although I'd be
>  very surprised if I'm the first person to run into this. Unfortunately
>  I haven't found anything on the web to shed any light on the
>  situation.
>
>  Is there something glaringly and stupidly obvious that I'm missing?
>  Any help or suggestions would be greatly 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-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: datetime 8 hours off

2008-04-01 Thread Simon Oberhammer


> What version of Django are you using?, what deployment method
> are you using? (mod_python, fast cgi, mod_wscgi).

i'm using mod_python and am running the current svn django. I've found
an open timezone bug, but don't think its related

http://code.djangoproject.com/changeset/7184


--~--~-~--~~~---~--~~
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 book error

2008-04-01 Thread Evert Rol

> Well... the 'Django book error' subject... is because everyone seem to
> have to go down this path and the book says nothing about having to
> install the PIL library or even what it is.
>
> Sorry to bother with such trivial questions.
>
> It seems the whole website is down for the libjpeg. Is there another
> place to find it... Do I even need it for the PIL?

Yes, you do need it; Leopard's jpeg library doesn't seem to work  
nicely with PIL (and I believe PIL unfortunately won't ignore jpeg  
support if the library not installed).
Google for it, or wait until the server's back up.


> On Apr 1, 10:53 am, Evert Rol <[EMAIL PROTECTED]> wrote:
>>> I am a newbie learning Django and so far loving the process. I'm  
>>> going
>>> through the djangobook.com and came across a problem.
>>
>>> In chapter 5 you create your first database (how exciting!)  
>>> problem is
>>> it seem like everyone that went thought this chapter(including me)  
>>> got
>>> this error:
>>
>>> "~/Documents/djangoapps/mysite$ python manage.py validate
>>> books.author: "headshot": To use ImageFields, you need to install  
>>> the
>>> Python Imaging Library. Get it athttp://www.pythonware.com/products/pil/
>>> "
>>
>>> There is a flurry of comments to the side one of which gives a  
>>> link to
>>> an example that is supposed to install the PIL. The link is:
>>> http://paul.annesley.cc/articles/2007/11/19/django-and-python-imaging 
>>> ...
>>
>>> Problem is the libjpeg link no longer exists
>>
>> How do you mean it longer exists? Best I can see, is that the ijg  
>> site
>> is down; the library is definitely out there, just the network
>> malfunctioning.
>>
>> (what does the subject 'Django book error' have to do with this,  
>> btw?)
>>
>>> I've also installed
>>> MacPort and it errored when installing the PIL
>>
>>> Does anyone know another way to install the PIL??
>>
>>> Thanks for the help,
>>> Poz
> >


--~--~-~--~~~---~--~~
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 book error

2008-04-01 Thread Poz

Well... the 'Django book error' subject... is because everyone seem to
have to go down this path and the book says nothing about having to
install the PIL library or even what it is.

Sorry to bother with such trivial questions.

It seems the whole website is down for the libjpeg. Is there another
place to find it... Do I even need it for the PIL?

Thanks for the reply Evert.

On Apr 1, 10:53 am, Evert Rol <[EMAIL PROTECTED]> wrote:
> > I am a newbie learning Django and so far loving the process. I'm going
> > through the djangobook.com and came across a problem.
>
> > In chapter 5 you create your first database (how exciting!) problem is
> > it seem like everyone that went thought this chapter(including me) got
> > this error:
>
> > "~/Documents/djangoapps/mysite$ python manage.py validate
> > books.author: "headshot": To use ImageFields, you need to install the
> > Python Imaging Library. Get it athttp://www.pythonware.com/products/pil/
> > "
>
> > There is a flurry of comments to the side one of which gives a link to
> > an example that is supposed to install the PIL. The link is:
> >http://paul.annesley.cc/articles/2007/11/19/django-and-python-imaging...
>
> > Problem is the libjpeg link no longer exists
>
> How do you mean it longer exists? Best I can see, is that the ijg site  
> is down; the library is definitely out there, just the network  
> malfunctioning.
>
> (what does the subject 'Django book error' have to do with this, btw?)
>
> > I've also installed
> > MacPort and it errored when installing the PIL
>
> > Does anyone know another way to install the PIL??
>
> > Thanks for the help,
> > Poz
--~--~-~--~~~---~--~~
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: Get number of the day

2008-04-01 Thread Esteban Saavedra L.

Hi heidi,
2008/4/1, Heidi Bustamante <[EMAIL PROTECTED]>:
>
>  Hello
>  A date anyone, how to get the number of the day that corresponds

for day of the week, you can use:

date1.isoweekday()


Esteban



-- 
M.Sc. Ing. Esteban Saavedra Lopez
CEO Opentelematics.Bolivia
Telefono:(+591.2) 5245959
Celular: +591 72450061
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
Oruro - Bolivia
_
Te Invito a Visitarme y conocer mis Areas de
Investigacion
http://jesaavedra.opentelematics.org
http://esteban.profesionales.org
Si quieres chatear ICQ: 16270256
_

--~--~-~--~~~---~--~~
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: Newbie with Django

2008-04-01 Thread Richa

Thanks karen

I had to get the svn version as I had both templates and media folders
in my admin folder. The http://127.0.0.1/admin is showing the login
screen and I am able to log in too. hehehehehe.

Richa

On Mar 31, 8:53 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Mon, Mar 31, 2008 at 11:28 PM, Richa <[EMAIL PROTECTED]> wrote:
>
> > Thanks Evert for your reply. I had tried that as well and it gave me
> > the following error.
>
> > TemplateDoesNotExist at /admin/
> > admin/login.html
> > Request Method: GET
> > Request URL:http://127.0.0.1:8000/admin/
> > Exception Type: TemplateDoesNotExist
> > Exception Value:admin/login.html
> > Exception Location: C:\Program Files\Python25\Lib\site-packages\django
> > \template\loader.py in find_template_source, line 72
>
> Your installation is missing the templates (and probably media) trees from
> the django\contrib\admin.  This was a problem with setup.py in some
> situations on Windows, fixed a little over a month ago.  You can either fix
> the install you have  by manually copying those trees from the source you
> originally used to install, or re-install with the SVN version of Django,
> which should not exhibit this problem.
>
> Karen
--~--~-~--~~~---~--~~
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: edit_inline and the Django Admin interface

2008-04-01 Thread [EMAIL PROTECTED]

I have exactly the same issue. Have you found a solution?

/mac

On Mar 27, 1:40 am, ocamljohn <[EMAIL PROTECTED]> wrote:
> My model includes a class called "Topic", and there exists a many-to-
> many relationship between Topics. This relationship between topics
> also includes a field named "source" that describes the nature of the
> relationship. Thus, I declare a model named TopicRelationship (see
> below) rather than using "models.ManyToManyField".
>
> I'd like to allow users of the Django admin interface to edit the
> relationships between topics from within any page about a Topic.
> Typically this would be done using the "edit_inline" named argument in
> the call to "models.ForeignKey". However, seemingly because my
> "TopicRelationship" models has two ForeignKey's, both of which point
> to "Topic", I get an error message when I set the edit_line named
> argument (see below). The particular error message is "TypeError" and
> "'bool' object is not callable".
>
> Is there some workaround, which will allows users of the admin
> interface to edit a Topic's relationships without leaving the admin
> page for a particular topic?
>
> Thank you,
> John
>
> ---
>
> class TopicRelationship(models.Model):
> fromTopic = models.ForeignKey(Topic, related_name="outbound",
> core=True,\
> # If I comment the line below in, I get an error message
>
> #
> edit_inline=models.TABULAR,\
> )
> toTopic = models.ForeignKey(Topic, related_name="inbound",
> core=True)
> source = models.ForeignKey(Source, core=True)
--~--~-~--~~~---~--~~
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 book error

2008-04-01 Thread Evert Rol

> I am a newbie learning Django and so far loving the process. I'm going
> through the djangobook.com and came across a problem.
>
> In chapter 5 you create your first database (how exciting!) problem is
> it seem like everyone that went thought this chapter(including me) got
> this error:
>
> "~/Documents/djangoapps/mysite$ python manage.py validate
> books.author: "headshot": To use ImageFields, you need to install the
> Python Imaging Library. Get it at http://www.pythonware.com/products/pil/
> "
>
> There is a flurry of comments to the side one of which gives a link to
> an example that is supposed to install the PIL. The link is:
> http://paul.annesley.cc/articles/2007/11/19/django-and-python-imaging-library-pil-on-leopard
>
> Problem is the libjpeg link no longer exists

How do you mean it longer exists? Best I can see, is that the ijg site  
is down; the library is definitely out there, just the network  
malfunctioning.

(what does the subject 'Django book error' have to do with this, btw?)


> I've also installed
> MacPort and it errored when installing the PIL
>
> Does anyone know another way to install the PIL??
>
> Thanks for the help,
> Poz


--~--~-~--~~~---~--~~
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: Creating Custom Admin Views

2008-04-01 Thread oliver

This I think contains the main views.
http://code.djangoproject.com/browser/django/trunk/django/contrib/admin/views/main.py
line 769
def change_list(request, app_label, model_name):

seems to be the view you need to copy and every thing that is attached
to it.

I have not gotten for in my implementation yet but will try and spend
some time on it now, will let you know if I get any progress/success
with this..

If any one else has done this would be handy  to see  how.

On 1 Apr, 16:54, Bernd <[EMAIL PROTECTED]> wrote:
> no, I didn't found any answers :-(
> Could you send me the source code you copied from the django admin? I
> also looked into the django-admin source code, but I hadn't enough time
> to look deeper into this topic.
>
> Is there a possibility in newforms-admin to solve this problem?
>
> On Tue, 2008-04-01 at 07:13 -0700, oliver wrote:
> > have you found any answers to this?
> > as i am trying to do the same thing, I just want to change the data
> > set that is send to the default template.
> > I have been looking in the srouce code and am trying to copy what
> > django admin does into my custom view, but it would be nice if there
> > was an easier way..
>
> > On 31 Mar, 10:12, Brot <[EMAIL PROTECTED]> wrote:
> > > does nobody have some helpful input?
>
> > > On 30 Mrz., 17:13, Bernd <[EMAIL PROTECTED]> wrote:
>
> > > > Hello,
>
> > > > I followed the documentationhttp://www.djangobook.com/en/1.0/chapter17/
> > > > in the section "Creating CustomAdminViews". I try to override the
> > > > change_list.html for one of my models.
>
> > > > I only would like to extend the change_list for the model with some
> > > > extra context data. All of the other functionality should be the same.
> > > > So I create the URLconf entry, the newviewand the customized template
> > > > in my template directory.
> > > > But I get this errormessagehttp://dpaste.com/42185/
>
> > > > I think the original context from theadminviewis missing now, but how
> > > > could I solve this problem?
>
> > > > Bernd
--~--~-~--~~~---~--~~
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: SelectDatewidget does not shows the correct value

2008-04-01 Thread theskyiscrape

SelectDateWidget cannot handle datetime fields. I subclassed the
widget:

class DatetimeSelectDateWidget(SelectDateWidget):
"""Overrides render to provide string value expected by
SelectDateWidget.
"""
def render(self, name, value, attrs=None):
# The SelectDateWidget in django cannot handle datetime value,
incredibly.
if value is not None:
value = str(value)
return super(FixedSelectDateWidget, self).render(name, value,
attrs)



On Apr 1, 9:22 am, "Rocio Figueroa" <[EMAIL PROTECTED]> wrote:
> Hello
> Within a form, a field date:
>
> UserForm = forms.models.form_for_instance(user)
> UserForm.base_fields [ 'record'].widget = SelectDateWidget()
>
> Does not shows the correct value, always shows the value of January 1,
> 2008, showing how to make the correct value
>
> 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Django book error

2008-04-01 Thread Poz

Hello all,

I am a newbie learning Django and so far loving the process. I'm going
through the djangobook.com and came across a problem.

In chapter 5 you create your first database (how exciting!) problem is
it seem like everyone that went thought this chapter(including me) got
this error:

"~/Documents/djangoapps/mysite$ python manage.py validate
books.author: "headshot": To use ImageFields, you need to install the
Python Imaging Library. Get it at http://www.pythonware.com/products/pil/
"

There is a flurry of comments to the side one of which gives a link to
an example that is supposed to install the PIL. The link is:
http://paul.annesley.cc/articles/2007/11/19/django-and-python-imaging-library-pil-on-leopard

Problem is the libjpeg link no longer exists I've also installed
MacPort and it errored when installing the PIL

Does anyone know another way to install the PIL??

Thanks for the help,
Poz
--~--~-~--~~~---~--~~
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: Fixture? Testing? how do you do it?

2008-04-01 Thread Prairie Dogg

I just did this for the first time last night, although I definitely
don't
know how to write good tests, at least I wrote some tests.

First thing you'll wanna check out if you haven't is:

http://www.djangoproject.com/documentation/testing/

But I assume you have, so I'll just get on to the fixtures.

Probably the easiest way to create a fixture is to enter some data
into your site from the admin interface.  Then go to your project
folder (the one with manage.py in it) and type something like:

$>python manage.py dumpdata --indent=4 --format=json >
my_text_fixture.json

Both the --indent and --format flags are optional, I think the output
is JSON by default.  For more information on dumping data into a
fixture, check out:

http://www.djangoproject.com/documentation/django-admin/#dumpdata-appname-appname

Then, when you write your unit tests for your app in tests.py, you
simply load up that fixture at the beginning of each test case.  The
docs say that the test database is flushed and restored for each
individual test case.  Here's what one of my test cases looks like:

class FormatTestCase(TestCase):
fixtures = ['book/test_data/book_test_data.json']

def setUp(self):
self.haiku = Submission.objects.get(title="A Peaceful Haiku")

def testPermalink(self):
self.assertEquals(self.haiku.get_absolute_url(), "/submission/
peaceful-haiku/")

Hope that helps.  Obviously, this only works for unit tests.  I'm not
entirely sure how you load fixtures for doctests, maybe someone more
experienced would like to tackle that.

On Apr 1, 12:31 pm, Tony <[EMAIL PROTECTED]> wrote:
> I am relatively new to Django, and I am having trouble getting my head
> around fixtures.
> The Django documentation just assumes that you should  know what a
> test fixture is and how to write one.  I understand that fixtures are
> just test data, but how is one written?
>
> Any guidance/examples on this would be great.
>
> Thanks,
> Tony
--~--~-~--~~~---~--~~
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: Get number of the day

2008-04-01 Thread Tim Chase

> A date anyone, how to get the number of the day that corresponds

from which starting point?  day of the year?  day of the week? 
day of the month?

Reading up on Python's strftime() method of datetime objects [1] 
may point you at what you need.  Small caveat regarding current 
breakage for dates earlier than 1900 (though I've heard rumblings 
about implementing a much needed/wanted unbreakification hack...yay!)

-tim

[1]
http://docs.python.org/lib/module-time.html



--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Fixture? Testing? how do you do it?

2008-04-01 Thread Tony

I am relatively new to Django, and I am having trouble getting my head
around fixtures.
The Django documentation just assumes that you should  know what a
test fixture is and how to write one.  I understand that fixtures are
just test data, but how is one written?

Any guidance/examples on this would be great.

Thanks,
Tony
--~--~-~--~~~---~--~~
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: Get number of the day

2008-04-01 Thread erob


Hi Heidi,

Perhaps you missed the part in the docs about the date filter ?

In any cases, here's the link:
http://www.djangoproject.com/documentation/templates/#date

Hope this helps,
Etienne

On Apr 1, 12:10 pm, "Heidi Bustamante" <[EMAIL PROTECTED]>
wrote:
> Hello
> A date anyone, how to get the number of the day that corresponds
>
> Thanks
>
> Heidi
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



SelectDatewidget does not shows the correct value

2008-04-01 Thread Rocio Figueroa

Hello
Within a form, a field date:

UserForm = forms.models.form_for_instance(user)
UserForm.base_fields [ 'record'].widget = SelectDateWidget()

Does not shows the correct value, always shows the value of January 1,
2008, showing how to make the correct value

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



Get number of the day

2008-04-01 Thread Heidi Bustamante

Hello
A date anyone, how to get the number of the day that corresponds

Thanks

Heidi

--~--~-~--~~~---~--~~
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: ImportError on login/logout

2008-04-01 Thread knack

I created a brand new project and app, left the default settings
untouched, ran syncdb to create the user authentication tables, and
created a very simple view (just returns an HttpResponse object) that
requires login permission. Same error: "ImportError at /accounts/
login/: No module named login".

I'm beginning to suspect that this some kind of bug, although I'd be
very surprised if I'm the first person to run into this. Unfortunately
I haven't found anything on the web to shed any light on the
situation.

Is there something glaringly and stupidly obvious that I'm missing?
Any help or suggestions would be greatly 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-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: Creating Custom Admin Views

2008-04-01 Thread Bernd

no, I didn't found any answers :-(
Could you send me the source code you copied from the django admin? I
also looked into the django-admin source code, but I hadn't enough time
to look deeper into this topic.

Is there a possibility in newforms-admin to solve this problem?


On Tue, 2008-04-01 at 07:13 -0700, oliver wrote:
> have you found any answers to this?
> as i am trying to do the same thing, I just want to change the data
> set that is send to the default template.
> I have been looking in the srouce code and am trying to copy what
> django admin does into my custom view, but it would be nice if there
> was an easier way..
> 
> 
> 
> On 31 Mar, 10:12, Brot <[EMAIL PROTECTED]> wrote:
> > does nobody have some helpful input?
> >
> > On 30 Mrz., 17:13, Bernd <[EMAIL PROTECTED]> wrote:
> >
> > > Hello,
> >
> > > I followed the documentationhttp://www.djangobook.com/en/1.0/chapter17/
> > > in the section "Creating CustomAdminViews". I try to override the
> > > change_list.html for one of my models.
> >
> > > I only would like to extend the change_list for the model with some
> > > extra context data. All of the other functionality should be the same.
> > > So I create the URLconf entry, the newviewand the customized template
> > > in my template directory.
> > > But I get this errormessagehttp://dpaste.com/42185/
> >
> > > I think the original context from theadminviewis missing now, but how
> > > could I solve this problem?
> >
> > > Bernd
> 

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Beta testers (and writers) wanted for the notmm project!

2008-04-01 Thread Etienne Robillard


Hello,

I'd be much interested in getting feedback surrounding the notmm toolkit. 

In particular, it would be great to get some inputs back from the Django 
community 
or from people that uses Paste within Django, SQLAlchemy, Mako, Pylons, etc.
 
Moreover, I'd be willing to pay up to 50.00$ USD to anyone willing to
to write and publish a short review for notmm. That review should be at least 
200 lines
long and should be written in proper english.

Thanks in advance,

Etienne

-- 
The WISN (Women Initial Sequence Number) usually starts at 0.

Etienne Robillard <[EMAIL PROTECTED]>
notmm - http://tools.assembla.com/notmm/wiki/



--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



django-survey Extracted from PyCon

2008-04-01 Thread yml

Hello,
Last week I have discovered that some of the apps composing PyCon
backend [2] have been exposed on "code.google.com". I am especially
interested by "django-survey" [1] since I have been working recently
on something similar [3]. I like how the survey from is built using
the newforms. I have been myself unable to do it and this even with
the several posts done around newforms.  :-(
I found two roadblocks on my way to do this. The first one is to be
able to present the choices with different widgets :
  * Radio List
  * Checkbox List
  * Combobox
  * ...
And  the second is to be able to change the layout of each widget. For
example I would like to be able to display the Radio List horizontally
and vertically.

The project actually available there [2] partially solved the first
issue but not the second. I try this afternoon to extend the foms.py
[4] to add ChoiceCheckbox :
"""
class ChoiceCheckbox(ChoiceAnswer):
def __init__(self, *args, **kwdargs):
super(ChoiceCheckbox, self).__init__(*args, **kwdargs)
self.fields['answer'].widget =
CheckboxSelectMultiple(choices=self.choices)
"""
Then I have also edited a tuple and a dictionary to enable this new
type of question. And : "oh surprise  !!" I can now add this type of
question in the admin interface. The survey with this type of question
is nicely rendered but I am unable to submit it succesfully .  I am
getting this error message :
"""
Select a valid choice. That choice is not one of the available
choices.
"""

I hope that one of the core developers of "django-survey" is reading
this list. Please do not hesitate to let me know if there is a more
appropriate channel to discuss about django-survey.

--yml

[1] http://code.google.com/p/django-survey/
[2] https://pycon.coderanger.net/
[3] https://launchpad.net/django-survey
[4] http://code.google.com/p/django-survey/source/browse/trunk/survey/forms.py
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



django-survey Extracted from PyCon

2008-04-01 Thread yml

Hello,
Last week I have discovered that some of the apps composing PyCon
backend [2] have been exposed on "code.google.com". I am especially
interested by "django-survey" [1] since I have been working recently
on something similar [3]. I like how the survey from is built using
the newforms. I have been myself unable to do it and this even with
the several posts done around newforms.  :-(
I found two roadblocks on my way to do this. The first one is to be
able to present the choices with different widgets :
  * Radio List
  * Checkbox List
  * Combobox
  * ...
And  the second is to be able to change the layout of each widget. For
example I would like to be able to display the Radio List horizontally
and vertically.

The project actually available there [2] partially solved the first
issue but not the second. I try this afternoon to extend the foms.py
[4] to add ChoiceCheckbox :
"""
class ChoiceCheckbox(ChoiceAnswer):
def __init__(self, *args, **kwdargs):
super(ChoiceCheckbox, self).__init__(*args, **kwdargs)
self.fields['answer'].widget =
CheckboxSelectMultiple(choices=self.choices)
"""
Then I have also edited a tuple and a dictionary to enable this new
type of question. And : "oh surprise  !!" I can now add this type of
question in the admin interface. The survey with this type of question
is nicely rendered but I am unable to submit it succesfully .  I am
getting this error message :
"""
Select a valid choice. That choice is not one of the available
choices.
"""

I hope that one of the core developers of "django-survey" is reading
this list. Please do not hesitate to let me know if there is a more
appropriate channel to discuss about django-survey.

--yml

[1] http://code.google.com/p/django-survey/
[2] https://pycon.coderanger.net/
[3] https://launchpad.net/django-survey
[4] http://code.google.com/p/django-survey/source/browse/trunk/survey/forms.py
--~--~-~--~~~---~--~~
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: Adding additional needed information in to newforms post

2008-04-01 Thread Evert Rol

> I thought that I could add in some additional information to a form
> before it gets saved as a new object in the database but the following
> isn't working:
>
> def groupadd(request):
>
>if request.method == 'POST':
>form = GroupForm(request.POST)
>if form.is_valid():
>data = form.cleaned_data
>data['group_owner'] = request.user.id
>data['group_members'] = request.user.id
>data['group_admins'] = request.user.id
>
>newform = GroupForm(data)

Rough guess, but I think you'll need to run .is_valid() again here to  
trigger validation. You just created another form, which has not yet  
been validated.

>
>newform.save
>
>newform = GroupForm()
>return HttpResponseRedirect("/group/list/")
>else:
>form = GroupForm()
>return render_to_response('groups/group_add.html', {'form': form})
>
>
> It doesn't return any error and it doesn't save the new object.  Is
> there anyway of sending additional data with a form?


--~--~-~--~~~---~--~~
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: Adding an "invalid" choice to a ChoiceField?

2008-04-01 Thread Thomas Guettler

Michael schrieb:
> When specifying the choices parameter is there a way to mark say, for
> example, the first choice as invalid?
>
> e.g.
>
> TOPIC_CHOICES = (
> ('erroneous', '-- pick one --'), # <-- I would not want this
> choice to count as being valid
> ('general', 'General enquiry'),
> ('bug', 'Bug report'),
> ('suggestion', 'Suggestion'),
> )
>
> class ContactForm(forms.Form):
> topic = forms.ChoiceField(choices=TOPIC_CHOICES)
>   
TOPIC_CHOICES=[('', '-- pick one --'), ('key1', '...'), ...]
And required=False for the ChoiceField (which is the default).

 Thomas

-- 
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de


--~--~-~--~~~---~--~~
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: Adding additional needed information in to newforms post

2008-04-01 Thread Michael

Is GroupForm a ModelForm? If not where is it supposed to be saving?

What I don't understand is why this information is being adding to the
cleaned_data outside of the form. Why don't you create a custom save
function in the form and have the form handle this. Then there is no
need to manipulate class variables outside the class. I understand why
there is outside access to cleaned_data from outside the class, but I
really think that manipulating it inside of views should be avoided.

You can pass request in the _init_ or to the save and have it
availible when you are actually saving the item you anticipate it
should be saving.

 Michael

On Tue, Apr 1, 2008 at 11:14 AM, timc3 <[EMAIL PROTECTED]> wrote:
>
>  Hi,
>
>  I thought that I could add in some additional information to a form
>  before it gets saved as a new object in the database but the following
>  isn't working:
>
>  def groupadd(request):
>
> if request.method == 'POST':
> form = GroupForm(request.POST)
> if form.is_valid():
> data = form.cleaned_data
> data['group_owner'] = request.user.id
> data['group_members'] = request.user.id
> data['group_admins'] = request.user.id
>
> newform = GroupForm(data)
> newform.save
>
> newform = GroupForm()
> return HttpResponseRedirect("/group/list/")
> else:
> form = GroupForm()
> return render_to_response('groups/group_add.html', {'form': form})
>
>
>  It doesn't return any error and it doesn't save the new object.  Is
>  there anyway of sending additional data with a form?
>  >
>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Adding additional needed information in to newforms post

2008-04-01 Thread timc3

Hi,

I thought that I could add in some additional information to a form
before it gets saved as a new object in the database but the following
isn't working:

def groupadd(request):

if request.method == 'POST':
form = GroupForm(request.POST)
if form.is_valid():
data = form.cleaned_data
data['group_owner'] = request.user.id
data['group_members'] = request.user.id
data['group_admins'] = request.user.id

newform = GroupForm(data)
newform.save

newform = GroupForm()
return HttpResponseRedirect("/group/list/")
else:
form = GroupForm()
return render_to_response('groups/group_add.html', {'form': form})


It doesn't return any error and it doesn't save the new object.  Is
there anyway of sending additional data with a form?
--~--~-~--~~~---~--~~
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: Really strange Newforms issue with Initial data.

2008-04-01 Thread Michael

Maybe redundant isn't the right word. It can be done with the code
provided by newforms so that you don't need to define things inside
your views like that. Let the form handle all of the form handling and
your view handle the processing of the request to the form and then
how to respond to the request. I find that is the best way to create
newforms.

Also be careful. I think I see a bit of old forms creeping into you
code. Don't let old blog posts trick you into using old code.

Good Luck,

Michael

On Tue, Apr 1, 2008 at 11:04 AM, oliver <[EMAIL PROTECTED]> wrote:
>
>  ok, still have to learn more (i thought i was getting to grips with
>  newforms). Every time i figure something out it reduce the code I have
>  writen before.
>
>  The complexity with this project is that this is the 1st from from
>  about 6 hence why we dump it all into request session. I looked at the
>  form wizard module which looks like it could help with this.
>
>  @Michael: why are the initial values redundant? I know the validation
>  is a bit odd but over all the way i am dealing with creating the form
>  and validating and saving it is correct or? there is just "excess"
>  code which admit ably is not very usefull ;)
>
>  Thanks any way, i am plaming this one on looking at the same code for
>  way to long :(
>
>
>  On Apr 1, 3:44 pm, Michael <[EMAIL PROTECTED]> wrote:
>  > Just briefly looking at the way that you have done this, I ask why are
>  > you using new forms in the first place? All the validation that you
>  > are doing is redundant, all the calls and initial values you are
>  > trying to accomplish is redundant.
>  >
>  > Newforms (and any python to HTML forms) are a tool to help you create
>  > and handle forms between httprequests and the python. Newforms is
>  > great in that you can have a whole form and all of it's handling done
>  > in just a few lines of code. You have about 100 lines that look like
>  > they want to handle raw data. If you want to handle raw data, handle
>  > raw data. If you want to allow newforms to help you create and handle
>  > HTML forms, read the 
> documentation:http://www.djangoproject.com/documentation/newforms/
>  >
>  > What you are trying to accomplish, if you properly implement NewForms
>  > and request sessions, should be much cleaner and more simple.
>  >
>
>
> > On Tue, Apr 1, 2008 at 10:29 AM, oliver <[EMAIL PROTECTED]> wrote:
>  >
>  > >  I just found a post where they do this ..
>  > >   testform = BookingFormOne(initial={
>  > >   'u_1stline': user.get_profile().currentAddress.street1,
>  > >   }
>  > > )
>  > >  as in call initial when the form class is called. and it seems to
>  > >  work!?!
>  >
>  > >  can any one explain why thou? as i still dont get why my way is not
>  > >  doing it right.
>  >
>  > >  On Apr 1, 3:09 pm, oliver <[EMAIL PROTECTED]> wrote:
>  > >  > Hi,
>  >
>  > >  > I have this very wired problem and I just can not figure out why it is
>  > >  > happening.
>  > >  > Newfroms seem to not send the "initial" value for a field on the 1st
>  > >  > load of the view.
>  >
>  > >  > This is the code:http://dpaste.com/42561/
>  >
>  > >  > its "just" a form
>  > >  > and a view that calls the form.
>  >
>  > >  > The problem lies with adding the initial runtime values to some of the
>  > >  > form fields. The code is from line 59 onwards.
>  >
>  > >  > What happens:
>  > >  > I load the view page for this form, and I get an empty form (again
>  > >  > this happens some times but not every time!!?), I press F5 and
>  > >  > suddenly the form has the inital data in the fields.
>  >
>  > >  > if I do a "print testform" in my view (after the data should be loaded
>  > >  > in) it prints the form in the console but I can see it is missing the
>  > >  > "Value" attribute. If i refresh it is there.
>  >
>  > >  > I dont think it is a caching issue as django it self is not sending
>  > >  > the "value" in the testform object on 1st load. but on 2nd load it
>  > >  > does.
>  >
>  > >  > I have checked with various print statements that the data is there
>  > >  > which it is!
>  > >  > I have removed the "if Post" and split the view up so I only call
>  > >  > "render a fresh form with initial data".
>  > >  > I have disabled Cache in the browser(s) (ie7,ff,safari).
>  > >  > I have disabled Cache in the view.
>  > >  > Calling the URL return html 200 code which should be correct.
>  >
>  > >  > Running the latest Django svn with the dev server (but it also happens
>  > >  > when I run it via our apache live setup).
>  >
>  > >  > Also if I get the form to load data, than log out and login as some
>  > >  > one else and go to the same form it has the Initial data of the user
>  > >  > before in it!! and I need to refresh 2 again to get the current users
>  > >  > data.
>  >
>  > >  > Once the data is in there it all works greate, validation and so on is
>  > >  > all fine.
>  >
>  > >  > I getting really frustrated with this issue and can not find any 

Re: Really strange Newforms issue with Initial data.

2008-04-01 Thread oliver

ok, still have to learn more (i thought i was getting to grips with
newforms). Every time i figure something out it reduce the code I have
writen before.

The complexity with this project is that this is the 1st from from
about 6 hence why we dump it all into request session. I looked at the
form wizard module which looks like it could help with this.

@Michael: why are the initial values redundant? I know the validation
is a bit odd but over all the way i am dealing with creating the form
and validating and saving it is correct or? there is just "excess"
code which admit ably is not very usefull ;)

Thanks any way, i am plaming this one on looking at the same code for
way to long :(

On Apr 1, 3:44 pm, Michael <[EMAIL PROTECTED]> wrote:
> Just briefly looking at the way that you have done this, I ask why are
> you using new forms in the first place? All the validation that you
> are doing is redundant, all the calls and initial values you are
> trying to accomplish is redundant.
>
> Newforms (and any python to HTML forms) are a tool to help you create
> and handle forms between httprequests and the python. Newforms is
> great in that you can have a whole form and all of it's handling done
> in just a few lines of code. You have about 100 lines that look like
> they want to handle raw data. If you want to handle raw data, handle
> raw data. If you want to allow newforms to help you create and handle
> HTML forms, read the 
> documentation:http://www.djangoproject.com/documentation/newforms/
>
> What you are trying to accomplish, if you properly implement NewForms
> and request sessions, should be much cleaner and more simple.
>
> On Tue, Apr 1, 2008 at 10:29 AM, oliver <[EMAIL PROTECTED]> wrote:
>
> >  I just found a post where they do this ..
> >   testform = BookingFormOne(initial={
> >   'u_1stline': user.get_profile().currentAddress.street1,
> >   }
> > )
> >  as in call initial when the form class is called. and it seems to
> >  work!?!
>
> >  can any one explain why thou? as i still dont get why my way is not
> >  doing it right.
>
> >  On Apr 1, 3:09 pm, oliver <[EMAIL PROTECTED]> wrote:
> >  > Hi,
>
> >  > I have this very wired problem and I just can not figure out why it is
> >  > happening.
> >  > Newfroms seem to not send the "initial" value for a field on the 1st
> >  > load of the view.
>
> >  > This is the code:http://dpaste.com/42561/
>
> >  > its "just" a form
> >  > and a view that calls the form.
>
> >  > The problem lies with adding the initial runtime values to some of the
> >  > form fields. The code is from line 59 onwards.
>
> >  > What happens:
> >  > I load the view page for this form, and I get an empty form (again
> >  > this happens some times but not every time!!?), I press F5 and
> >  > suddenly the form has the inital data in the fields.
>
> >  > if I do a "print testform" in my view (after the data should be loaded
> >  > in) it prints the form in the console but I can see it is missing the
> >  > "Value" attribute. If i refresh it is there.
>
> >  > I dont think it is a caching issue as django it self is not sending
> >  > the "value" in the testform object on 1st load. but on 2nd load it
> >  > does.
>
> >  > I have checked with various print statements that the data is there
> >  > which it is!
> >  > I have removed the "if Post" and split the view up so I only call
> >  > "render a fresh form with initial data".
> >  > I have disabled Cache in the browser(s) (ie7,ff,safari).
> >  > I have disabled Cache in the view.
> >  > Calling the URL return html 200 code which should be correct.
>
> >  > Running the latest Django svn with the dev server (but it also happens
> >  > when I run it via our apache live setup).
>
> >  > Also if I get the form to load data, than log out and login as some
> >  > one else and go to the same form it has the Initial data of the user
> >  > before in it!! and I need to refresh 2 again to get the current users
> >  > data.
>
> >  > Once the data is in there it all works greate, validation and so on is
> >  > all fine.
>
> >  > I getting really frustrated with this issue and can not find any thing
> >  > regarding this online or in the django groups. And I just can;t see
> >  > where the code is wrong or why it would not load the data every time
> >  > view is loaded with out a post.
>
> >  > Please any comments/help will be really 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-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: JSON serializers.serialize raises DoesNotExist on recursive data structures

2008-04-01 Thread Legioneer

My data model is very similar to your:

class Category(models.Model):
name = models.CharField(max_length=64)
descr = models.CharField(max_length=255, blank=True)
rank = models.PositiveIntegerField(default=10)
parent = models.ForeignKey('self', null=True, blank=True,
related_name='child_set')

but because of some reason it doesn't want to to go through JSON
serializer :(

Anthony

> this is my example
>
> class Type(models.Model):
> type = models.CharField('分类名称',maxlength=50,core=True)
> path = models.CharField('url地址',maxlength=250,blank=True,editable=False)
> typename = models.CharField('分类名称',maxlength=200,editable=False)
> parent = models.ForeignKey('self',related_name="munchie",null=True,
> blank=True)
> created = models.DateTimeField(auto_now_add=True)
>
> order_id=models.IntegerField ('排序',default=0)
> fid=models.IntegerField ('根ID',default=0,editable=False)
> cengshu=models.IntegerField ('层数',default=1,editable=False)
>
--~--~-~--~~~---~--~~
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: Really strange Newforms issue with Initial data.

2008-04-01 Thread Michael

Just briefly looking at the way that you have done this, I ask why are
you using new forms in the first place? All the validation that you
are doing is redundant, all the calls and initial values you are
trying to accomplish is redundant.

Newforms (and any python to HTML forms) are a tool to help you create
and handle forms between httprequests and the python. Newforms is
great in that you can have a whole form and all of it's handling done
in just a few lines of code. You have about 100 lines that look like
they want to handle raw data. If you want to handle raw data, handle
raw data. If you want to allow newforms to help you create and handle
HTML forms, read the documentation:
http://www.djangoproject.com/documentation/newforms/

What you are trying to accomplish, if you properly implement NewForms
and request sessions, should be much cleaner and more simple.


On Tue, Apr 1, 2008 at 10:29 AM, oliver <[EMAIL PROTECTED]> wrote:
>
>  I just found a post where they do this ..
>   testform = BookingFormOne(initial={
>   'u_1stline': user.get_profile().currentAddress.street1,
>   }
> )
>  as in call initial when the form class is called. and it seems to
>  work!?!
>
>  can any one explain why thou? as i still dont get why my way is not
>  doing it right.
>
>  On Apr 1, 3:09 pm, oliver <[EMAIL PROTECTED]> wrote:
>  > Hi,
>  >
>  > I have this very wired problem and I just can not figure out why it is
>  > happening.
>  > Newfroms seem to not send the "initial" value for a field on the 1st
>  > load of the view.
>  >
>  > This is the code:http://dpaste.com/42561/
>  >
>  > its "just" a form
>  > and a view that calls the form.
>  >
>  > The problem lies with adding the initial runtime values to some of the
>  > form fields. The code is from line 59 onwards.
>  >
>  > What happens:
>  > I load the view page for this form, and I get an empty form (again
>  > this happens some times but not every time!!?), I press F5 and
>  > suddenly the form has the inital data in the fields.
>  >
>  > if I do a "print testform" in my view (after the data should be loaded
>  > in) it prints the form in the console but I can see it is missing the
>  > "Value" attribute. If i refresh it is there.
>  >
>  > I dont think it is a caching issue as django it self is not sending
>  > the "value" in the testform object on 1st load. but on 2nd load it
>  > does.
>  >
>  > I have checked with various print statements that the data is there
>  > which it is!
>  > I have removed the "if Post" and split the view up so I only call
>  > "render a fresh form with initial data".
>  > I have disabled Cache in the browser(s) (ie7,ff,safari).
>  > I have disabled Cache in the view.
>  > Calling the URL return html 200 code which should be correct.
>  >
>  > Running the latest Django svn with the dev server (but it also happens
>  > when I run it via our apache live setup).
>  >
>  > Also if I get the form to load data, than log out and login as some
>  > one else and go to the same form it has the Initial data of the user
>  > before in it!! and I need to refresh 2 again to get the current users
>  > data.
>  >
>  > Once the data is in there it all works greate, validation and so on is
>  > all fine.
>  >
>  > I getting really frustrated with this issue and can not find any thing
>  > regarding this online or in the django groups. And I just can;t see
>  > where the code is wrong or why it would not load the data every time
>  > view is loaded with out a post.
>  >
>  > Please any comments/help will be really 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-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: Really strange Newforms issue with Initial data.

2008-04-01 Thread Evert Rol

> I just found a post where they do this ..
>  testform = BookingFormOne(initial={
>  'u_1stline': user.get_profile().currentAddress.street1,
>  }
>)
> as in call initial when the form class is called. and it seems to
> work!?!
>
> can any one explain why thou? as i still dont get why my way is not
> doing it right.

Because that's how it's explained here: 
http://www.djangoproject.com/documentation/newforms/#dynamic-initial-values 
  ?

I cannot understand why you go through such convoluted setup as you  
have; at least, that's how it appears to me...



>> I have this very wired problem and I just can not figure out why it  
>> is
>> happening.
>> Newfroms seem to not send the "initial" value for a field on the 1st
>> load of the view.
>>
>> This is the code:http://dpaste.com/42561/
>>
>> its "just" a form
>> and a view that calls the form.
>>
>> The problem lies with adding the initial runtime values to some of  
>> the
>> form fields. The code is from line 59 onwards.
>>
>> What happens:
>> I load the view page for this form, and I get an empty form (again
>> this happens some times but not every time!!?), I press F5 and
>> suddenly the form has the inital data in the fields.
>>
>> if I do a "print testform" in my view (after the data should be  
>> loaded
>> in) it prints the form in the console but I can see it is missing the
>> "Value" attribute. If i refresh it is there.
>>
>> I dont think it is a caching issue as django it self is not sending
>> the "value" in the testform object on 1st load. but on 2nd load it
>> does.
>>
>> I have checked with various print statements that the data is there
>> which it is!
>> I have removed the "if Post" and split the view up so I only call
>> "render a fresh form with initial data".
>> I have disabled Cache in the browser(s) (ie7,ff,safari).
>> I have disabled Cache in the view.
>> Calling the URL return html 200 code which should be correct.
>>
>> Running the latest Django svn with the dev server (but it also  
>> happens
>> when I run it via our apache live setup).
>>
>> Also if I get the form to load data, than log out and login as some
>> one else and go to the same form it has the Initial data of the user
>> before in it!! and I need to refresh 2 again to get the current users
>> data.
>>
>> Once the data is in there it all works greate, validation and so on  
>> is
>> all fine.
>>
>> I getting really frustrated with this issue and can not find any  
>> thing
>> regarding this online or in the django groups. And I just can;t see
>> where the code is wrong or why it would not load the data every time
>> view is loaded with out a post.
>>
>> Please any comments/help will be really 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-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: inclusion tags and RequestContext

2008-04-01 Thread Panos Laganakos

I changed the definition of the inclusion tag to accept a second
parameter in the form of:

def my_function(context, myparam):
...

but I didn't get access to the variables  in the context, I had to:

return {
'myparam': myparam,
'acontextvar': context['acontextvar']
}

Is this normal, or am I supposed to get access to all of them once I
include context as my first param?


On Apr 1, 3:26 pm, Panos Laganakos <[EMAIL PROTECTED]> wrote:
> OK, I (think!) understand that.
>
> But what if the inclusion tag requires an argument, that's not always
> in the same context?
>
> On Apr 1, 3:12 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
> wrote:
>
> > On Tue, 2008-04-01 at 04:58 -0700, Panos Laganakos wrote:
> > > Is there some way to have inclusion tags pick up on the variables
> > > available from REQUEST_CONTEXT_PROCESSORS?
>
> > > I've read about `takes_context` option, but I couldn't figure out if I
> > > could use it to get access to the above.
>
> > The context processors run before the template rendering starts and they
> > modify the context that is passed into the template. So if your tag
> > accepts the context, it will have access to all the variables in the
> > context, which includes those added by the context processors.
>
> > Regards,
> > Malcolm
>
> > --
> > Why be difficult when, with a little bit of effort, you could be
> > impossible.http://www.pointy-stick.com/blog/
--~--~-~--~~~---~--~~
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: JSON serializers.serialize raises DoesNotExist on recursive data structures

2008-04-01 Thread 1234
this is my example

class Type(models.Model):
type = models.CharField('分类名称',maxlength=50,core=True)
path = models.CharField('url地址',maxlength=250,blank=True,editable=False)
typename = models.CharField('分类名称',maxlength=200,editable=False)
parent = models.ForeignKey('self',related_name="munchie",null=True,
blank=True)
created = models.DateTimeField(auto_now_add=True)

order_id=models.IntegerField ('排序',default=0)
fid=models.IntegerField ('根ID',default=0,editable=False)
cengshu=models.IntegerField ('层数',default=1,editable=False)



2008/4/1, Legioneer <[EMAIL PROTECTED]>:
>
>
> Thank you, Michael. Tried several combinations but it doesn't work
> either.
>
> 1. First I tried to use Category.objects.all():
>   c = Category.objects.all()
>   serializers.serialize("json", c)
>
> and got the same error.
>
> 2. Then tried to init some variable with s[:5] and the result didn't
> change.
>
> 3. When I use some other model which doesn't refer to itself (is a non
> recursive) it works fine even when using with lazy filter calls
> similar to my first example.
>
> Anthony
>
>
> On Apr 1, 5:34 am, Michael <[EMAIL PROTECTED]> wrote:
> > Your error is actually coming from the fact that you are not getting
> > any results from your filter query. The reason that the error is
> > appearing on the second line of your script is because filter is a
> > lazy call and isn't really made until you ask it to return objects in
> > this bit: s[:5]. Change your filter or call Category.objects.all() it
> > should work.
> >
> > Hope that helps,
> > Michael
> >
>
> > On Mon, Mar 31, 2008 at 5:39 AM, Legioneer <[EMAIL PROTECTED]> wrote:
> >
> > >  Hi All,
> >
> > >  I'm trying to serialize recursive model (a category which refers to
> > >  itself) and get a 'DoesNotExist: Category matching query does not
> > >  exist', while other models work fine. Does anyone know a clue for
> > >  this?
> >
> > >  I'm doing like this:
> >
> > >  from django.core import serializers;
> > >  from newproject.models import Category
> >
> > >  s = Category.objects.filter(parent__exact='0')
> > >  serializers.serialize("json", s[:5])
> >
> > >  and get:
> > >  Traceback (most recent call last):
> > >   File "", line 1, in ?
> > >   File "/usr/lib/python2.3/site-packages/django/core/serializers/
> > >  __init__.py", line 72, in serialize
> > > s.serialize(queryset, **options)
> > >   File "/usr/lib/python2.3/site-packages/django/core/serializers/
> > >  base.py", line 48, in serialize
> > > self.handle_fk_field(obj, field)
> > >   File "/usr/lib/python2.3/site-packages/django/core/serializers/
> > >  python.py", line 41, in handle_fk_field
> > > related = getattr(obj, field.name)
> > >   File "/usr/lib/python2.3/site-packages/django/db/models/fields/
> > >  related.py", line 209, in __get__
> > > rel_obj = self.field.rel.to._default_manager.get(**params)
> > >   File "/usr/lib/python2.3/site-packages/django/db/models/manager.py",
> > >  line 69, in get
> > > return self.get_query_set().get(*args, **kwargs)
> > >   File "/usr/lib/python2.3/site-packages/django/db/models/query.py",
> > >  line 263, in get
> > > raise self.model.DoesNotExist, "%s matching query does not exist."
> > >  % self.model._meta.object_name
> > >  DoesNotExist: Category matching query does not exist.
> >
> > >  Anthony
> >
>

--~--~-~--~~~---~--~~
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: Really strange Newforms issue with Initial data.

2008-04-01 Thread oliver

I just found a post where they do this ..
  testform = BookingFormOne(initial={
  'u_1stline': user.get_profile().currentAddress.street1,
  }
)
as in call initial when the form class is called. and it seems to
work!?!

can any one explain why thou? as i still dont get why my way is not
doing it right.

On Apr 1, 3:09 pm, oliver <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have this very wired problem and I just can not figure out why it is
> happening.
> Newfroms seem to not send the "initial" value for a field on the 1st
> load of the view.
>
> This is the code:http://dpaste.com/42561/
>
> its "just" a form
> and a view that calls the form.
>
> The problem lies with adding the initial runtime values to some of the
> form fields. The code is from line 59 onwards.
>
> What happens:
> I load the view page for this form, and I get an empty form (again
> this happens some times but not every time!!?), I press F5 and
> suddenly the form has the inital data in the fields.
>
> if I do a "print testform" in my view (after the data should be loaded
> in) it prints the form in the console but I can see it is missing the
> "Value" attribute. If i refresh it is there.
>
> I dont think it is a caching issue as django it self is not sending
> the "value" in the testform object on 1st load. but on 2nd load it
> does.
>
> I have checked with various print statements that the data is there
> which it is!
> I have removed the "if Post" and split the view up so I only call
> "render a fresh form with initial data".
> I have disabled Cache in the browser(s) (ie7,ff,safari).
> I have disabled Cache in the view.
> Calling the URL return html 200 code which should be correct.
>
> Running the latest Django svn with the dev server (but it also happens
> when I run it via our apache live setup).
>
> Also if I get the form to load data, than log out and login as some
> one else and go to the same form it has the Initial data of the user
> before in it!! and I need to refresh 2 again to get the current users
> data.
>
> Once the data is in there it all works greate, validation and so on is
> all fine.
>
> I getting really frustrated with this issue and can not find any thing
> regarding this online or in the django groups. And I just can;t see
> where the code is wrong or why it would not load the data every time
> view is loaded with out a post.
>
> Please any comments/help will be really 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-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: JSON serializers.serialize raises DoesNotExist on recursive data structures

2008-04-01 Thread Legioneer

Thank you, Michael. Tried several combinations but it doesn't work
either.

1. First I tried to use Category.objects.all():
 c = Category.objects.all()
 serializers.serialize("json", c)

and got the same error.

2. Then tried to init some variable with s[:5] and the result didn't
change.

3. When I use some other model which doesn't refer to itself (is a non
recursive) it works fine even when using with lazy filter calls
similar to my first example.

Anthony

On Apr 1, 5:34 am, Michael <[EMAIL PROTECTED]> wrote:
> Your error is actually coming from the fact that you are not getting
> any results from your filter query. The reason that the error is
> appearing on the second line of your script is because filter is a
> lazy call and isn't really made until you ask it to return objects in
> this bit: s[:5]. Change your filter or call Category.objects.all() it
> should work.
>
> Hope that helps,
> Michael
>
> On Mon, Mar 31, 2008 at 5:39 AM, Legioneer <[EMAIL PROTECTED]> wrote:
>
> >  Hi All,
>
> >  I'm trying to serialize recursive model (a category which refers to
> >  itself) and get a 'DoesNotExist: Category matching query does not
> >  exist', while other models work fine. Does anyone know a clue for
> >  this?
>
> >  I'm doing like this:
>
> >  from django.core import serializers;
> >  from newproject.models import Category
>
> >  s = Category.objects.filter(parent__exact='0')
> >  serializers.serialize("json", s[:5])
>
> >  and get:
> >  Traceback (most recent call last):
> >   File "", line 1, in ?
> >   File "/usr/lib/python2.3/site-packages/django/core/serializers/
> >  __init__.py", line 72, in serialize
> > s.serialize(queryset, **options)
> >   File "/usr/lib/python2.3/site-packages/django/core/serializers/
> >  base.py", line 48, in serialize
> > self.handle_fk_field(obj, field)
> >   File "/usr/lib/python2.3/site-packages/django/core/serializers/
> >  python.py", line 41, in handle_fk_field
> > related = getattr(obj, field.name)
> >   File "/usr/lib/python2.3/site-packages/django/db/models/fields/
> >  related.py", line 209, in __get__
> > rel_obj = self.field.rel.to._default_manager.get(**params)
> >   File "/usr/lib/python2.3/site-packages/django/db/models/manager.py",
> >  line 69, in get
> > return self.get_query_set().get(*args, **kwargs)
> >   File "/usr/lib/python2.3/site-packages/django/db/models/query.py",
> >  line 263, in get
> > raise self.model.DoesNotExist, "%s matching query does not exist."
> >  % self.model._meta.object_name
> >  DoesNotExist: Category matching query does not exist.
>
> >  Anthony
--~--~-~--~~~---~--~~
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 font

2008-04-01 Thread Mat
Thanks, that's just what I was looking for, little pricey though

 

Thanks again,

Mat

 

From: django-users@googlegroups.com [mailto:[EMAIL PROTECTED]
On Behalf Of Justin Lilly
Sent: 01 April 2008 14:49
To: django-users@googlegroups.com
Subject: Re: Django font

 

It's a "homemade" logo, but the font is called DLT Prokyon which can be
purchased from 

 

http://www.dutchtypelibrary.nl/Prokyon_rdrct.html

 

 -justin

On Tue, Apr 1, 2008 at 9:42 AM, Mat <[EMAIL PROTECTED]> wrote:


Slightly off topic here, but I'm putting a website together at the moment,
and need a logo, I really like the django font and it would fit in with the
rest of the style wonderfully, does anyone know what its called/have a link,
or is it a homemade logo?

Mat







-- 
Justin Lilly
Web Developer/Designer
http://justinlilly.com 




--~--~-~--~~~---~--~~
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: Creating Custom Admin Views

2008-04-01 Thread oliver

have you found any answers to this?
as i am trying to do the same thing, I just want to change the data
set that is send to the default template.
I have been looking in the srouce code and am trying to copy what
django admin does into my custom view, but it would be nice if there
was an easier way..



On 31 Mar, 10:12, Brot <[EMAIL PROTECTED]> wrote:
> does nobody have some helpful input?
>
> On 30 Mrz., 17:13, Bernd <[EMAIL PROTECTED]> wrote:
>
> > Hello,
>
> > I followed the documentationhttp://www.djangobook.com/en/1.0/chapter17/
> > in the section "Creating CustomAdminViews". I try to override the
> > change_list.html for one of my models.
>
> > I only would like to extend the change_list for the model with some
> > extra context data. All of the other functionality should be the same.
> > So I create the URLconf entry, the newviewand the customized template
> > in my template directory.
> > But I get this errormessagehttp://dpaste.com/42185/
>
> > I think the original context from theadminviewis missing now, but how
> > could I solve this problem?
>
> > Bernd
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Really strange Newforms issue with Initial data.

2008-04-01 Thread oliver

Hi,

I have this very wired problem and I just can not figure out why it is
happening.
Newfroms seem to not send the "initial" value for a field on the 1st
load of the view.


This is the code:
http://dpaste.com/42561/

its "just" a form
and a view that calls the form.

The problem lies with adding the initial runtime values to some of the
form fields. The code is from line 59 onwards.

What happens:
I load the view page for this form, and I get an empty form (again
this happens some times but not every time!!?), I press F5 and
suddenly the form has the inital data in the fields.

if I do a "print testform" in my view (after the data should be loaded
in) it prints the form in the console but I can see it is missing the
"Value" attribute. If i refresh it is there.

I dont think it is a caching issue as django it self is not sending
the "value" in the testform object on 1st load. but on 2nd load it
does.

I have checked with various print statements that the data is there
which it is!
I have removed the "if Post" and split the view up so I only call
"render a fresh form with initial data".
I have disabled Cache in the browser(s) (ie7,ff,safari).
I have disabled Cache in the view.
Calling the URL return html 200 code which should be correct.

Running the latest Django svn with the dev server (but it also happens
when I run it via our apache live setup).

Also if I get the form to load data, than log out and login as some
one else and go to the same form it has the Initial data of the user
before in it!! and I need to refresh 2 again to get the current users
data.

Once the data is in there it all works greate, validation and so on is
all fine.

I getting really frustrated with this issue and can not find any thing
regarding this online or in the django groups. And I just can;t see
where the code is wrong or why it would not load the data every time
view is loaded with out a post.

Please any comments/help will be really 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-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: 'module' object has no attribute 'day_abbr' --Problem editing using Admin

2008-04-01 Thread Erik Vorhes

That's because the table storing your information doesn't have an
"EventDate" field, and it can't be ordered by something that doesn't
exist. You'll need to update the table before it will work correctly.

On Mon, Mar 31, 2008 at 1:25 AM, Ryan Vanasse <[EMAIL PROTECTED]> wrote:
>
>  I just commented out the ordering, and it's bringing up the same
>  error.
>
>  When I try looking at the Events list (to check if anything was
>  added), and got a Template syntax error. (see below)
>  I used an SQLite admin program to check out what was in the
>  calendar_Events table and found nothing.
>
>  I have a couple of other projects on the same install (for
>  experimentation) and they all appear to be working.
>  I'm using .96
>
>  Template syntax error:
>  TemplateSyntaxError at /admin/calendar/event/
>  'admin_list' is not a valid tag library: Could not load template
>  library from django.templatetags.admin_list, cannot import name isleap
>  Request Method: GET
>
> Request URL:http://127.0.0.1:8000/admin/calendar/event/
>  Exception Type: TemplateSyntaxError
>  Exception Value:'admin_list' is not a valid tag library: Could not
>  load template library from django.templatetags.admin_list, cannot
>  import name isleap
>  Exception Location: C:\Python25\lib\site-packages\django\template
>  \defaulttags.py in load, line 750
>
>
>
>  >
>

--~--~-~--~~~---~--~~
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 font

2008-04-01 Thread Justin Lilly
It's a "homemade" logo, but the font is called DLT Prokyon which can be
purchased from
http://www.dutchtypelibrary.nl/Prokyon_rdrct.html

 -justin

On Tue, Apr 1, 2008 at 9:42 AM, Mat <[EMAIL PROTECTED]> wrote:

>
> Slightly off topic here, but I'm putting a website together at the moment,
> and need a logo, I really like the django font and it would fit in with
> the
> rest of the style wonderfully, does anyone know what its called/have a
> link,
> or is it a homemade logo?
>
> Mat
>
>
> >
>


-- 
Justin Lilly
Web Developer/Designer
http://justinlilly.com

--~--~-~--~~~---~--~~
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 font

2008-04-01 Thread Antonio Cavedoni

On Tue, Apr 1, 2008 at 3:42 PM, Mat <[EMAIL PROTECTED]> wrote:
>  Slightly off topic here, but I'm putting a website together at the moment,
>  and need a logo, I really like the django font and it would fit in with the
>  rest of the style wonderfully, does anyone know what its called/have a link,
>  or is it a homemade logo?

The Django logotype is set in DTL Prokyon:

http://www.dutchtypelibrary.nl/Prokyon_rdrct.html

Here, a handy price list (per weight):

http://www.dutchtypelibrary.nl/PDF/pricelists/singleuser/DTL%20Prokyon_prlst.pdf

Cheers.
-- 
Antonio

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Django newbie question about views and authentication

2008-04-01 Thread Matias Surdi

Hi,

Suppose I've the following on the top of every page of my application 
(in base.html for example):

{% if user.is_authenticated %}
 Welcome, {{ user.username }}. Thanks for logging in.
{% else %}
 Welcome, new user. Please log in.
{% endif %}


Now, as far as I understand I must ALWAYS do the following in ALL views:


def index(request):
 render_to_response('template/index.html',{},
 context_instance=RequestContext(request))

So, I have to pass always the parameter context_instance to the 
render_to_response shortcut.

¿Is this correct? Isn't it a bit tedious to do this with all views? What 
if I forget to add the RequestContext thing in a view?


Any aclaration will be appreciated.

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



Django font

2008-04-01 Thread Mat

Slightly off topic here, but I'm putting a website together at the moment,
and need a logo, I really like the django font and it would fit in with the
rest of the style wonderfully, does anyone know what its called/have a link,
or is it a homemade logo?

Mat


--~--~-~--~~~---~--~~
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: Strange login error in newforms-admin site: ViewDoesNotExist at /accounts/login/

2008-04-01 Thread Michael

>  Yours was one of the posts I discovered when I googled this but my
>  problem seemed to come out of nowhere and your report seemed to imply
>  a more reproducible issue.

It's difficult to reproduce, because it involves a rather deep level
of importing and self importing. This happens every once in a while
with auth for me and also for another app that is quite complex. I
have a test app tht I have been working with for a while to try to get
to the smallest denomiator, but I have been unable to pull this error
out of the shell yet.

>Is this problem intermittent or dependant
>  on what type of Django configuration you are using? (i.e. mod_python
>  vs Django dev server)

I have only been able to reproduce this on mod_python, but I'll give
it a try on the dev server later today and see if I can't reproduce it
there. As I said before I cannot reproduce this error in any tests or
in the shell, which is troublesome, but that could be because it is a
mod_python error. I will play with that today. Thanks for the idea,

>  Anyway. I'll try your fix and report back.

Let me know how it goes,

Michael

--~--~-~--~~~---~--~~
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: Calling syncdb twice

2008-04-01 Thread James Matthews
Thank you!

On Tue, Apr 1, 2008 at 2:56 AM, blis102 <[EMAIL PROTECTED]> wrote:

>
> James,
>
> Django Evolution is a project that is working to take care of that
> problem (http://code.google.com/p/django-evolution/). I have not used
> it but, if what they say on their site is correct, it does what you
> are looking for:
>
> "When you run ./manage.py syncdb, Django will look for any new models
> that have been defined, and add a database table to represent those
> new models. However, if you make a change to an existing model, ./
> manage.py syncdb will not make any changes to the database.
>
> This is where Django Evolution fits in. Django Evolution is an
> extension to Django that allows you to track changes in your models
> over time, and to update the database to reflect those changes. "
>
> Hope that helps,
> Dana
>
> On Mar 31, 7:51 am, Evert Rol <[EMAIL PROTECTED]> wrote:
> > > I was wondering why you can only call "python manage.py syncdb" to
> > > create your databases but after that if you change your models file
> > > it work create the changes and you have to do them manually using SQL?
> >
> > I think there are several threads in this discussion group that have
> > some mention of the hows and whys (google for them), but basically:
> > it's too complicated, or otherwise very tricky, to alter tables
> > (altering or adding columns) automatically. In particular, it won't
> > even work with sqlite (http://www.sqlite.org/omitted.html).
> >
>


-- 
http://search.goldwatches.com/?Search=Movado+Watches
http://www.jewelerslounge.com
http://www.goldwatches.com

--~--~-~--~~~---~--~~
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: Strange login error in newforms-admin site: ViewDoesNotExist at /accounts/login/

2008-04-01 Thread AndyB

Thanks.

Yours was one of the posts I discovered when I googled this but my
problem seemed to come out of nowhere and your report seemed to imply
a more reproducible issue. Is this problem intermittent or dependant
on what type of Django configuration you are using? (i.e. mod_python
vs Django dev server)

Anyway. I'll try your fix and report back.

thanks
AndyB

On Apr 1, 2:47 am, Michael <[EMAIL PROTECTED]> wrote:
> This is an instance of the AlreadyRegistered exception rearing its
> head in the contrib.auth section, something I have been banging my
> head against since I originally rewrote the auth code for a personal
> project a few months ago. Here is the ticket and a patch that fixes
> the problem without quite knowing what that problem 
> is:http://code.djangoproject.com/ticket/6718
>
> A solution to this has been talked about and today I started writing a
> post to the Django Devs asking where things were on that, but decided
> that I would wait a few more weeks before I start nagging.
>
> Personally I register all my admin when the urls are originally loaded
> by executing this script at the end of my master urls.py:
> from django.conf import settings
>
> for a in settings.INSTALLED_APPS:
>     try:
>         __import__(a+'.admin')
>     except ImportError:
>         pass
>
> In auth make sure to remove the last line of the models.py. This
> avoids all these really vague AlreadyRegistered errors that you get
> with apps that have somewhat circular imports.
>
> Hope that helps,
>
> Michael
>
> On Mon, Mar 31, 2008 at 3:06 PM, AndyB <[EMAIL PROTECTED]> wrote:
>
> >  Some code that has previously worked fine and still works fine on my
> >  development server has started giving the following error on a
> >  production server when I try and visit my login page:
>
> >  ViewDoesNotExist at /accounts/login/
> >  Could not import django.contrib.auth.views. Error was: cannot import
> >  name UserCreationForm
>
> >  Logout works fine and it doesn't seem to make any difference what my
> >  login template contains. As long as it is there I get the same error.
>
> >  Using a fresh checkout of newforms-admin on both and no other
> >  differences that I am aware of. I can't reproduce the error from the
> >  shell or on the dev server no matter what.
>
> >  Google the problem has proved intriguing but fruitless. It's late and
> >  I am fully expecting to say 'doh' any second now but as I've been
> >  thinking that for the last hour I've decided to post in the hope
> >  someone can prod me in the right direction :(
--~--~-~--~~~---~--~~
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: inclusion tags and RequestContext

2008-04-01 Thread Panos Laganakos

OK, I (think!) understand that.

But what if the inclusion tag requires an argument, that's not always
in the same context?


On Apr 1, 3:12 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Tue, 2008-04-01 at 04:58 -0700, Panos Laganakos wrote:
> > Is there some way to have inclusion tags pick up on the variables
> > available from REQUEST_CONTEXT_PROCESSORS?
>
> > I've read about `takes_context` option, but I couldn't figure out if I
> > could use it to get access to the above.
>
> The context processors run before the template rendering starts and they
> modify the context that is passed into the template. So if your tag
> accepts the context, it will have access to all the variables in the
> context, which includes those added by the context processors.
>
> Regards,
> Malcolm
>
> --
> Why be difficult when, with a little bit of effort, you could be
> impossible.http://www.pointy-stick.com/blog/
--~--~-~--~~~---~--~~
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: inclusion tags and RequestContext

2008-04-01 Thread Malcolm Tredinnick


On Tue, 2008-04-01 at 04:58 -0700, Panos Laganakos wrote:
> Is there some way to have inclusion tags pick up on the variables
> available from REQUEST_CONTEXT_PROCESSORS?
> 
> I've read about `takes_context` option, but I couldn't figure out if I
> could use it to get access to the above.


The context processors run before the template rendering starts and they
modify the context that is passed into the template. So if your tag
accepts the context, it will have access to all the variables in the
context, which includes those added by the context processors.

Regards,
Malcolm

-- 
Why be difficult when, with a little bit of effort, you could be
impossible. 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



inclusion tags and RequestContext

2008-04-01 Thread Panos Laganakos

Is there some way to have inclusion tags pick up on the variables
available from REQUEST_CONTEXT_PROCESSORS?

I've read about `takes_context` option, but I couldn't figure out if I
could use it to get access to the above.
--~--~-~--~~~---~--~~
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: ensuring uniqueness in newforms

2008-04-01 Thread Jonathan Buchanan

On Tue, Apr 1, 2008 at 4:00 AM, msoulier <[EMAIL PROTECTED]> wrote:
>
>  If I have a field, for example a CharField named 'name', which must be
>  unique, what's the best way to ensure uniqueness whether creating a
>  new entry or editing an existing one?
>
>  By default, the form won't know if it is being used to edit or create,
>  so if you look for duplicates in the db, how would you know whether
>  any dup you found is just the current entry being edited?
>
>  Or is the form the wrong place for this kind of thing? Should this
>  instead be enforced in the model, and we should instead catch the
>  exception throw during the save attempt? I'm guessing not, as I was
>  once told that validation in the model is deprecated.
>
>  Thanks,
>  Mike

Assuming that when you're editing, the instance being edited is being
held as an "instance" attribute of the form, or None otherwise:

def clean_name(self):
try:
obj = YourModel.objects.get(name=self.cleaned_data['name'])
if not self.instance or obj.pk != self.instance.pk:
raise forms.ValidationError(u'This name is already taken.')
except YourModel.DoesNotExist:
pass
return self.cleaned_data['name']

You could trim it down to only pull back the pk of any existing
object, but that's the gist of it.

IIRC, model validation is still being worked on. I've not been in the
loop lately, so I can only suggest searching the list :)

Regards,
Jonathan.

--~--~-~--~~~---~--~~
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: datetime 8 hours off

2008-04-01 Thread Ramiro Morales

On Tue, Apr 1, 2008 at 5:46 AM, Simon Oberhammer
<[EMAIL PROTECTED]> wrote:
>
>  hey group,
>  I have an inconsistant time problem, which goes away when I restart
>  apache, but then creeps up again after some time. When writing
>  comments in my custom app the time is 8hours behind (i'm CEST) *for
>  some users*. When I login with others, its okay.
>
>  in settings.py I have
>  TIME_ZONE = 'Europe/Vienna'
>
>  [EMAIL PROTECTED]:~/pm3$ date
>  Tue Apr  1 10:44:32 CEST 2008
>
>  any ideas what I should look for? This is annyoing.. it forces my to
>  apache2ctl restart quite often :-)
>

What version of Django are you using?, what deployment method
are you using? (mod_python, fast cgi, mod_wscgi).

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
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: fetchall question

2008-04-01 Thread Malcolm Tredinnick


On Tue, 2008-04-01 at 12:06 +0200, Constantin Christmann wrote:
> Hello,
> 
> On my localhost with Postgres cursor.fetchall() returns a list of tuples 
> (one list element per row).
> And on the production server with MySQL a tuple of tuples... How can 
> that be... is there perhaps an inconsistency in the db interface?

Both are valid and consistent: the DB API says they will return a
sequence of sequences. In almost all cases you'll just be iterating over
the results returned and so any sequence will do.

This isn't at all Django related, though. It's part of the python
database wrappers.

Regards,
Malcolm

-- 
If Barbie is so popular, why do you have to buy her friends? 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



manage.py and transactions need help

2008-04-01 Thread sector119

HI All!

When I use my own command with manage.py and got any psycopg2
exception on commit, not other exception, I can't create any object in
model after rollback even if I do
transaction.enter_transaction_management() and
transaction.managed(True)

How can I save and commit data after psycopg2.OperationalError
exception?

cursor = connection.cursor()
transaction.enter_transaction_management()
transaction.managed(True)

try:
  # import log initialization
  import_log = ImportLog.objects.create(registry=registry,
md5sum=md5sum(src), size=os.   stat(src).st_size,
commit_date_begin=datetime.datetime.now())
  transaction.commit()

  # save all objects
  for obj in objects:
obj.save()

  # write data to import log
  import_log.commit_date_end = datetime.datetime.now()
  import_log.save()

  transaction.commit()
except:
  transaction.rollback()
  transaction.leave_transaction_management()

  # HOW TO CREATE SOME OBJECT HERE???
  # THIS CODE DOES NOT WORK if psycopg2.OperationalError exception
raised, WHY?
  cursor = connection.cursor()
  transaction.enter_transaction_management()
  transaction.managed(True)
  import_log = ImportLog.objects.get(registry=registry,
md5sum=source_md5sum)
  import_log.rollback_date = datetime.datetime.now()
  import_log.rollback_savepoint = object_count
  import_log.save()

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



fetchall question

2008-04-01 Thread Constantin Christmann

Hello,

On my localhost with Postgres cursor.fetchall() returns a list of tuples 
(one list element per row).
And on the production server with MySQL a tuple of tuples... How can 
that be... is there perhaps an inconsistency in the db interface?

Thanks,
Constantin


--~--~-~--~~~---~--~~
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: to_template filter

2008-04-01 Thread glopglop

On 31 mar, 18:44, peschler <[EMAIL PROTECTED]> wrote:
> Your "to_template" tag does what inclusion tags are for (not the {%
> include %} tag!).
>

Fine, I forgot about those.
Just one thing, though : this tag only has to be defined once.
After that it's only html templating, no python.

This inclusion tags is a mix of html writer/python writer . (not to
say they are useless or could serve the purpose)
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Adding an "invalid" choice to a ChoiceField?

2008-04-01 Thread Michael

When specifying the choices parameter is there a way to mark say, for
example, the first choice as invalid?

e.g.

TOPIC_CHOICES = (
('erroneous', '-- pick one --'), # <-- I would not want this
choice to count as being valid
('general', 'General enquiry'),
('bug', 'Bug report'),
('suggestion', 'Suggestion'),
)

class ContactForm(forms.Form):
topic = forms.ChoiceField(choices=TOPIC_CHOICES)

The scenario I'm trying to address is I would like to prevent users
from skipping over a particular choice field (instead of the user
blindly accepting the first value in the list).

I'm curious how you guys would address this. 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



datetime 8 hours off

2008-04-01 Thread Simon Oberhammer

hey group,
I have an inconsistant time problem, which goes away when I restart
apache, but then creeps up again after some time. When writing
comments in my custom app the time is 8hours behind (i'm CEST) *for
some users*. When I login with others, its okay.

in settings.py I have
TIME_ZONE = 'Europe/Vienna'

[EMAIL PROTECTED]:~/pm3$ date
Tue Apr  1 10:44:32 CEST 2008

any ideas what I should look for? This is annyoing.. it forces my to
apache2ctl restart quite often :-)

greetings
 simono

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



manually rendered templates not recognized for translation?

2008-04-01 Thread omat

Hi,

I am sending notification e-mails to members on some actions. The
message body comes from a template:

{% load i18n %}
{% blocktrans %}
Your application is created successfully.
Thanks.
{% endblocktrans %}

I load and render the template to form the body of the message. It
works alright but when I build the translation file, the text is not
recognized to be translated and does not appear in the translation
file.

How can I make xgettext to process those templates?


Thanks,
oMat

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Newbie: Setting up Lighttdp on Kubuntu 7:10

2008-04-01 Thread Douglas E

My stack
postgreSQL 8.3
lighttdp standard install
Python standard install 2.6?
Django SVN
Firestarter firewall
all on Kubuntu 7:10 on an amd x2 64 bit

First what works.

My static web pages work.
http://journeytothestars.webhop.net/
This is in var/www/index.html

http://127.0.0.1
this gives me the static page but without the graphics for some reason
(url.rewrite-once mistakes I would bet).

With:
~/Django/journeysite$ python manage.py runserver 8080
http://127.0.0.1:8080/
I get the it worked django page. Nice!

But with :
~/Django/journeysite$./manage.py runfcgi daemonize=false
host=127.0.0.1 port=3080
http://127.0.0.1:3080/
I get nothing just the firefox waiting symbol.
Other things I have tried ether get a 404 or nothing or etc. Does not
work.
What is the proper thing to try anyway?

What I want to have happen.
I want and thing ending in .html  or with no ending to go to var/www
and have all my static web pages there.
http://journeytothestars.webhop.net/
or http://journeytothestars.webhop.net/index.html

And anything with
http://journeytothestars.webhop.net/admin
should go to my Django admin pages
http://journeytothestars.webhop.net/player
should go to my Django pages for player stuff
http://journeytothestars.webhop.net/game_master
should go to my Django game master stuff.

This is /etc/lighttpd/lighttpd.conf
After that is my settings.py file for ~/Django/journeysite$ which has
stars_app in it with models. Everything else has been unchanged.

Firewall has port 80 open. I hope that is all it needs??

Thanks lots for any help. I have been working on this for a week,
reading every link I can. I have learned a lot but can't get it to
work at all. I am getting nowhere fast. I know I suck at this part, I
am a programmer and don't know much about networking or servers yet
and my regex skills suck .

Thanks to anyone that can help get this up and working so I can get
back to programming!!

Douglas E Knapp

PS This only will work when my computer is on. Daytime Germany mostly.
http://journeytothestars.webhop.net/


# Debian lighttpd configuration file
#

 Options you really have to take care of


## modules to load
# mod_access, mod_accesslog and mod_alias are loaded by default
# all other module should only be loaded if neccesary
# - saves some time
# - saves memory

server.modules = (
"mod_access",
"mod_alias",
"mod_compress",
"mod_rewrite",
"mod_fastcgi",
"mod_accesslog",
#   "mod_redirect",
#   "mod_status",
#   "mod_evhost",
#   "mod_usertrack",
#   "mod_rrdtool",
#   "mod_webdav",
#   "mod_expire",
#   "mod_flv_streaming",
#   "mod_evasive"
)


server.document-root = "/var/www"
#$HTTP["host"] == "journeytothestars.webhop.net"{server.document-root
= "/var/www/"}

fastcgi.server = (
"/journeysite.fcgi" => (
"main" => (
# Use host / port instead of socket for TCP fastcgi
 "host" => "127.0.0.1",
 "port" => 3080,
#"socket" => "/home/user/mysite.sock",
#"check-local" => "disable",
)
),
)
alias.url = (
"/media/" => "/home/douglas/django_trunk/django/contrib/admin/media/",
)

url.rewrite-once = (
"^/$" => "/index.html",
".*/images.*" => "$0",
".*\.css" => "$0",
"^(/media.*)$" => "$1",
".*\.html($|\?)" => "$0",# This will make mod_rewrite "ignore" all
requests of html files (or rather rewrite them to themselves, which
makes it effectively ignore them)
"^/favicon\.ico$" => "/media/favicon.ico",
"^(/.*)$" => "/journeysite.fcgi$1",
)


## where to send error-messages to
server.errorlog= "/var/log/lighttpd/error.log"

## files to check for if .../ is requested
index-file.names   = ( "index.php", "index.html",
   "index.htm", "default.htm",
   "index.lighttpd.html" )


## Use the "Content-Type" extended attribute to obtain mime type if
possible
# mimetype.use-xattr = "enable"

 accesslog module
accesslog.filename = "/var/log/lighttpd/access.log"

## deny access the file-extensions
#
# ~is for backupfiles from vi, emacs, joe, ...
# .inc is often used for code includes which should in general not be
part
#  of the document-root
url.access-deny= ( "~", ".inc" )

##
# which extensions should not be handle via static-file transfer
#
# .php, .pl, .fcgi are most often handled by mod_fastcgi or mod_cgi
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )


# Options that are good to be but not neccesary to be changed
###

## bind to port (default: 80)
# server.port   = 81

## bind to localhost only (default: all interfaces)
## server.bind= "localhost"

## error-handler for status 404
#server.error-handler-404  = "/error-handler.html"
#server.error-handler-404  = "/error-handler.php"

## to he

Re: "clever" fields

2008-04-01 Thread Grupo Django

Yes, of course I know, but it's not suitable for my projects as I need
per row level permissions.


On 1 abr, 07:59, martyn <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Do you know the class Admin, a subclass of your model 
> ?http://www.djangobook.com/en/1.0/appendixB/#cn311
>
> Maybe it could help you.
>
> On 31 mar, 13:46, Grupo Django <[EMAIL PROTECTED]> wrote:
>
> > Hi!
> > I'm trying to create a generic form template for a custom admin zone.
> > I'm doing it this 
> > way:http://www.djangoproject.com/documentation/newforms/#complex-template...
>
> > But I need to modify the output depending of the field type.
> > It's easy to add a javascript calendar in a DateField if you add a
> > custom class to it, but I need to go further.
> > I want to check within the template if the field type is a ImageField,
> > and if True, add:
> > 
> > Thumbnail
> > 
> > 
>
> > The problem here is that I can't determine the field type within the
> > {% for field in form %}{% endfor %} loop.
>
> > I'd like something like this  (this is a simplified version):
>
> > {% for field in form %}
> > {{ field.label_tag }}
> > {{ field }}
> >  
> > {% ifequal field.type 'ImageField' %}
> >   Thumbnail
> >
> >  {% endif %}
> > {% endfor %}
>
> > Is there any workaround to make it work?
>
> > 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---