Re: 'module' object has no attribute 'day_abbr' --Problem editing using Admin

2008-03-30 Thread Kenneth Gonsalves


On 31-Mar-08, at 10:28 AM, Ryan Vanasse wrote:

> class Event(models.Model):
>   eventName = models.CharField(maxlength=63)
>   #eventDate = models.DateField()
>   start_time = models.DateTimeField()
>   end_time = models.DateTimeField()
>   eventLocation = models.CharField(maxlength = 63)
>   eventDetails = models.TextField()
>
>   def __str__(self):
>   return self.eventName
>
>   class Admin:
>   list_display = ('eventName', 'eventLocation',)
>   list_filter = ('eventLocation',)
>   ordering = ('-eventDate',)
>   search_fields =('eventName','eventLocation',)

you have eventDate commented out in the model, but are specifying  
ordering by eventDate. I am sure the model is getting saved, and this  
error arises on generating the change list after the save.

-- 

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



paginator.get_page(0) returning empty list

2008-03-30 Thread linnewbie

Hi,

I'm using Django .96 and I am having a problem with pagination which I
find very strange.

My model is something like this and I have objects in the database:


class Conference(models.Model):
conf_no = models.CharField(maxlength=200)
country = models.CharField(maxlength=2,choices=country_choices)
summary  = models.TextField()
date = models.DateField()

def __str__(self):
return self.conf_no


>>> paginator.hits
6

>>> paginator.pages
2

>>> paginator.get_page(0)
[ , ]

I'm getting an empty list!!!

Any help would be great






--~--~-~--~~~---~--~~
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: Localizing URLs

2008-03-30 Thread [EMAIL PROTECTED]

Perhaps you could try doing a per request url conf:
http://www.b-list.org/weblog/2007/nov/06/urlconf/ I'm not sure how
this would work, but I think it might help, although I guess you'd
need a URL conf for each languages :/

On Mar 30, 11:58 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Fri, 2008-03-28 at 06:13 -0300, Marinho Brandao wrote:
> > Hi,
>
> > I had tryied several ways a lot of time trying to localize my URLs,
> > like in django-authopenid [1]
>
> > but I had have the same result: when I change the current language,
> > everything works but URLs stills in old language. When I restart
> > server, it works, but when I change again, the same happens...
>
> > am I wrong trying to localize URLs or am I forgotting something important?
>
> > example of my URLs:
>
> > urlpatterns = patterns('',
> > url(r'^%s' % _('channels/'), include('apps.videos.urls.channels')),
> > }
>
> That code is only going to be executed once: when the URL configuration
> is imported. Not on every request. So it won't work as you expect.
>
> If you really want to supply URL aliases like this, you'll need to do
> the processing in your view to work out which URL they really requested
> and dispatch that appropriately. That would be a very large amount of
> work, since you'd have to accept pretty much any legal string and then
> the view works out if it's valid or not and you would essentially be
> reimplementing the URL dispatcher from Django.
>
> This isn't impossible, but it's not something Django provides out of the
> box.
>
> Regards,
> Malcolm
>
> --
> The cost of feathers has risen; even down is 
> up!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: Localizing URLs

2008-03-30 Thread Malcolm Tredinnick


On Fri, 2008-03-28 at 06:13 -0300, Marinho Brandao wrote:
> Hi,
> 
> I had tryied several ways a lot of time trying to localize my URLs,
> like in django-authopenid [1]
> 
> but I had have the same result: when I change the current language,
> everything works but URLs stills in old language. When I restart
> server, it works, but when I change again, the same happens...
> 
> am I wrong trying to localize URLs or am I forgotting something important?
> 
> example of my URLs:
> 
> urlpatterns = patterns('',
> url(r'^%s' % _('channels/'), include('apps.videos.urls.channels')),
> }

That code is only going to be executed once: when the URL configuration
is imported. Not on every request. So it won't work as you expect.

If you really want to supply URL aliases like this, you'll need to do
the processing in your view to work out which URL they really requested
and dispatch that appropriately. That would be a very large amount of
work, since you'd have to accept pretty much any legal string and then
the view works out if it's valid or not and you would essentially be
reimplementing the URL dispatcher from Django.

This isn't impossible, but it's not something Django provides out of the
box.

Regards,
Malcolm

-- 
The cost of feathers has risen; even down is up! 
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
-~--~~~~--~~--~--~---



'module' object has no attribute 'day_abbr' --Problem editing using Admin

2008-03-30 Thread Ryan Vanasse

I'm sorry for writing at such an early, clueless time in my learning
process (both with python and django) but this problem appears to be
in code I didn't write and I'm not sure what the best way to work
around this problem is. I'm sorry for not having lurked more to
understand the norms of this group, but I need to jump right into
learning this.

If there is a better way for me to look for help for something like
this, please let me know.


When saving an event model in the built-in Django Admin, I get this
error:

AttributeError at /admin/calendar/event/add/
'module' object has no attribute 'day_abbr'
Request Method: POST
Request URL:http://127.0.0.1:8000/admin/calendar/event/add/
Exception Type: AttributeError
Exception Value:'module' object has no attribute 'day_abbr'
Exception Location: C:\Python25\lib\_strptime.py in __calc_weekday,
line 94

My model code is as follows:

from django.db import models

class Event(models.Model):
eventName = models.CharField(maxlength=63)
#eventDate = models.DateField()
start_time = models.DateTimeField()
end_time = models.DateTimeField()
eventLocation = models.CharField(maxlength = 63)
eventDetails = models.TextField()

def __str__(self):
return self.eventName

class Admin:
list_display = ('eventName', 'eventLocation',)
list_filter = ('eventLocation',)
ordering = ('-eventDate',)
search_fields =('eventName','eventLocation',)

I don't know if the traceback is helpful here, but I figured it was
easier to include now rather than later. (If this is not the cultural
norm here, please let me know.)

Traceback (most recent call last):
File "C:\Python25\lib\site-packages\django\core\handlers\base.py" in
get_response
  77. response = callback(request, *callback_args, **callback_kwargs)
File "C:\Python25\lib\site-packages\django\contrib\admin\views
\decorators.py" in _checklogin
  55. return view_func(request, *args, **kwargs)
File "C:\Python25\lib\site-packages\django\views\decorators\cache.py"
in _wrapped_view_func
  39. response = view_func(request, *args, **kwargs)
File "C:\Python25\lib\site-packages\django\contrib\admin\views
\main.py" in add_stage
  251. manipulator.do_html2python(new_data)
File "C:\Python25\lib\site-packages\django\oldforms\__init__.py" in
do_html2python
  103. field.convert_post_data(new_data)
File "C:\Python25\lib\site-packages\django\oldforms\__init__.py" in
convert_post_data
  335. converted_data = [self.__class__.html2python(data) for data in
d]
File "C:\Python25\lib\site-packages\django\oldforms\__init__.py" in
html2python
  822. time_tuple = time.strptime(data, '%Y-%m-%d')
File "C:\Python25\lib\_strptime.py" in
  272. _TimeRE_cache = TimeRE()
File "C:\Python25\lib\_strptime.py" in __init__
  191. self.locale_time = LocaleTime()
File "C:\Python25\lib\_strptime.py" in __init__
  74. self.__calc_weekday()
File "C:\Python25\lib\_strptime.py" in __calc_weekday
  94. a_weekday = [calendar.day_abbr[i].lower() for i in range(7)]

  AttributeError at /admin/calendar/event/add/
  'module' object has no attribute 'day_abbr'

Thank you for your assistance?
--~--~-~--~~~---~--~~
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: how to force char field instead varchar to be created

2008-03-30 Thread Malcolm Tredinnick


On Thu, 2008-03-27 at 13:06 -0700, eat wrote:
> I want to have char fields (db storage reason) instead of varchar
> how to force that in the models.py ??
> 
> django seems to create only varchar

You'll need to create a custom model field or a custom database backend.

Malcolm

-- 
Atheism is a non-prophet organization. 
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: Using Django for Teaching

2008-03-30 Thread Kenneth Gonsalves


On 31-Mar-08, at 9:58 AM, Todd O'Bryan wrote:

> Sorry this is two weeks late (it's been a bear of a two weeks), but  
> I use Django with high school students who've done the equivalent  
> of a year of college programming--the AP Computer Science AB  
> curriculum.

what age would these students be?
>
>
> You have to be careful and you have to lead students by the nose,  
> making sure that students get HTML and basic concepts of databases,  
> but Django is a great way to get a class working together on a  
> project.

do you use version control and teach them to use it? How are they at  
finding solutions through the docs, mailing lists and IRC?

-- 

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: Using Django for Teaching

2008-03-30 Thread Todd O'Bryan
Sorry this is two weeks late (it's been a bear of a two weeks), but I use
Django with high school students who've done the equivalent of a year of
college programming--the AP Computer Science AB curriculum.

We've been working on a webapp for two years that has evolved into something
with 8 apps, tens of thousands of lines of view code, several hundred
templates, and has already saved the school over $1000 by providing
functionality the administration was prepared to buy commercial software
for.

You have to be careful and you have to lead students by the nose, making
sure that students get HTML and basic concepts of databases, but Django is a
great way to get a class working together on a project.

As to taking things live, just don't. Show everyone how to run things using
the development server and only think about taking the product live at
certain milestone events.

If you'd like more info, feel free to email me.

Todd

--~--~-~--~~~---~--~~
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: synchronization problem

2008-03-30 Thread PENPEN

I checked the transaction module of django. I think it could work.
But why do you prefer this version column solution? Does it have
better performance?

On 3月31日, 上午9时54分, meppum <[EMAIL PROTECTED]> wrote:
> I found this thread helpful.
>
> http://groups.google.com/group/django-users/browse_thread/thread/e9db...
>
> On Mar 30, 9:11 pm, Mark Green <[EMAIL PROTECTED]> wrote:
>
> > On Sun, 2008-03-30 at 17:49 -0700, meppum wrote:
> > > The easiest way to deal with this is to create a "version" column that
> > > gets updated with the current version number of the row in the
> > > database. Increment this column value each time a save is performed on
> > > that row. Override the save method on the model you want to perform
> > > this check on (in your example the poll model), and check on commit
> > > check that the value of the "version" colum in the database is LESS
> > > THEN the value of the "verson" column you are about to commit. If it
> > > is not, then throw an error. and rollback the transaction.
>
> > Ehm, and how would you "check on commit"?
>
> > -mark
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



JSON-compatible query filter specification and code

2008-03-30 Thread Michael Halle

Hello,

I've just uploaded a snippet for specifying Django query filters using
a nested list syntax. This representation enables query filters to be
built by a client-side JavaScript application and sent to a server app
using JSON.

The code included in the snippet transforms this query filter
specification into a Q filter object suitable for use in standard
Django queries, like this:

# request.POST['filter'] = '["and", ["in", "id", [1, 2, 5]], ["not",
["range", "date", ["2008-02-12", "2008-02-20"'
from django.utils import simplejson
filterSpec = simplejson.loads(request.POST['filter'])
q = build_query_filter_from_spec(filterSpec)
result_set = Thing.objects.filter(q)

All of Django's primitive filter operators ("contains", "range",
"in", ...) are supported, in addition to "not", "or", and "and"
boolean operators. Django's existing query filter mechanism made this
code pretty straightforward and concise.

http://www.djangosnippets.org/snippets/676/

I hunted around for a while, but I didn't see any existing code that
implemented this functionality.

--Mike


--~--~-~--~~~---~--~~
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: Model Inheritance

2008-03-30 Thread David Marquis

I think that Django does not support model inheritance (yet).
The dev team seems to have thought about it :
http://code.djangoproject.com/wiki/ModelInheritance

You might want to ask Google for "django model inheritance" for all  
the information you need.

--
David

On 30-Mar-08, at 4:27 PM, jurian wrote:
>
> How would I go about implementing a model that only exists to be
> inherited from and not used on it's own?
>
> Example:
>
> class Animal(models.Model):
> name = models.CharField()
>
> class Dog(Animal):
> x = models.CharField()
>
> class Cat(Animal):
> y = models.CharField()
>
>
> In the example I want to create and manipulate dog and cat objects,
> but I will never need to use animal objects, so the animal table
> doesn't need to be created at all.
> >


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

2008-03-30 Thread David Marquis

Using the Django admin on a WAP browser would involve serious  
usability issues.
I just can't imagine myself filling a django edit form with a numeric  
keypad, I would quickly throw the phone out the window.
I really don't understand why would anyone want to endure such a  
thing, except from the sheer pleasure of destroying a (old) cell phone.

--
David

On 30-Mar-08, at 9:15 PM, leonel wrote:
>
> Jeff Anderson wrote:
>> leonel wrote:
>>> Hello:
>>>
>>> Is there a WAP admin for django ??  Been searching and didn't found
>>> anything about it
>>>
>> I'm fairly certain that there is no such thing.
>>
>> I am curious as to why you need it though. What specifically are you
>> trying to accomplish?
>>
>> Jeff Anderson
>>
> I can use the django admin on my cel phone  ( N73 )  It has a nice
> browser based
> but I tested on another cel phone and it only knows WAP not full  
> html /
> css / javascript
>
> Leonel
>
>
> >


--~--~-~--~~~---~--~~
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: many to many field problem

2008-03-30 Thread didia lim
Hi evert,

the transparency is inside class tableSlot, when i'm looping tableSlot, it 
works fine... but when i add the columnsetup or querysetup, i got the error.. 
maybe my query is wrong? :(

- Original Message 
From: Evert Rol <[EMAIL PROTECTED]>
To: django-users@googlegroups.com
Sent: Saturday, March 29, 2008 2:15:22 AM
Subject: Re: many to many field problem


Where or what is the Transparency member in the tableslots you call  
below? I guess I forgot to ask for that previously.
You may also want to check how your Align is defined (in choices=Align).

> >{%for tableslots in tableslots_list%}
> > {{tableslots.Transparency}} 
> >{%endfor%}
> >{%for querysetups in querysetups_list%}
> >{{querysetups.dbTemp}} 
> >{%endfor%}


Lastly, for simple debugging purposes, you could comment out either  
one of the two above for loops (or even both). You mentioned the error  
occurs when looping through that, although I didn't get if it happens  
for both individually, or that you've only tried them together.
If it happens in only one of the two for-loops, that makes it a lot  
easier to track down the problem.

Oh, if listings get long, you could use http://dpaste.com/ for code  
listings. (Probably also helps with the indentation, because it  
appears a bit mixed up below).

Cheers,

   Evert



> hi this is my class for columnsetup and querysetup.. thanks a lot  
> for your help
>
> class columnSetup(models.Model):
> name=models.CharField("Name",max_length=50)
> width   =models.IntegerField("Width",max_length=3)
> align  
> =models.CharField("Align",max_length=1,choices=Align)
> tableList  =models.ManyToManyField(tableSlot)
>
> def __unicode__(self):
> return self.name
>
> def save(self):# update lastupdate  
> in all possible DS setting
> super(columnSetup, self).save() # Call the  
> "real" save() method.
>
> class Meta:
> verbose_name = ('Column Setup')
>
> class Admin:
> fields = (
> ('Column Setup', {
> 'fields' : (('name', 'width', 'align'), 'tableList')
> }),
> )
> list_display=('name','width','align')
> save_as=True
>
> class querySetup(models.Model):
> sqlQue=models.CharField("SQL Query",max_length=200)
> dbTemp=models.CharField("Database",max_length=50)
> tableList  =models.ManyToManyField(tableSlot)
>
> def __unicode__(self):
> return self.sqlQue
>
> def save(self):# update lastupdate  
> in all possible DS setting
> super(querySetup, self).save() # Call the "real"  
> save() method.
> for tl in self.tableList.all():
> tl.setting.lastUpdate = datetime.now()
> tl.setting.save()
>
> class Meta:
> verbose_name = ('Query Setup')
>
> class Admin:
> fields = (
> ('Query Setup', {
> 'fields' : (('sqlQue','dbTemp'), 'tableList')
> }),
> )
> list_display=('sqlQue','dbTemp')
> save_as=True
>
>
> - Original Message 
> From: Evert Rol <[EMAIL PROTECTED]>
> To: django-users@googlegroups.com
> Sent: Saturday, March 29, 2008 1:34:21 AM
> Subject: Re: many to many field problem
>
>
> >ds = DigitalSignage.objects.get(pk=ds_id)
> > #Digital Signage config & setting
> >setting = ds.setting
> >textslots = ds.textslot_set.all()
> >slots = ds.slot_set.all()
> >tableslots = tableSlot.objects.filter(DS_List=ds)
> >columnsetups = columnSetup.objects.filter(tableList=tableslots)
> >querysetups = querySetup.objects.filter(tableList=tableslots)
> >
> > but bumps into another problems.. really headache when i call the
> > columnsetups or querysetups it will gave me error
> >
> >{%for tableslots in tableslots_list%}
> > {{tableslots.Transparency}} 
> >{%endfor%}
> >{%for querysetups in querysetups_list%}
> >{{querysetups.dbTemp}} 
> >{%endfor%}
> >
> > Request Method:
> > GET
> > Request URL:
> > http://localhost/reed/1/ds.xml
> > Exception Type:
> > InterfaceError
> > Exception Value:
> > Error binding parameter 0 - probably unsupported type.
> > Exception Location:
> > C:\Python25\lib\site-packages\django\db\backends\sqlite3\base.py in
> > execute, line 133
> > Python Executable:
> > C:\Program Files\Apache Software Foundation\Apache2.2\bin\httpd.exe
> > Python Version: 2.5.1
>
> Bit of blank guessing from the error message, but there may just be
> some awkward/exotic field in one of your models that sqlite cannot
> handle; or it's a genuine Django backend bug. What do your model
> definitions look like for columnSetup and querySetup?
>
>
> >
> > > thanks for reply, but i don't quite understand :( sorry i'm newbie
> > > here
> > > First my models.py 

Re: mark_safe for a html field

2008-03-30 Thread Kenneth Gonsalves


On 31-Mar-08, at 7:20 AM, Marc Garcia wrote:

> does anybody know a simple way to mark a model field as safe html (and
> tell django not to escape this field content)?

http://www.djangoproject.com/documentation/templates/#automatic-html- 
escaping

-- 

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



mark_safe for a html field

2008-03-30 Thread Marc Garcia

Hi,

does anybody know a simple way to mark a model field as safe html (and
tell django not to escape this field content)?

I can create a method in the model that outputs the return of
mark_safe applied to field content, and it should work. But may be
there is something more simple that I'm missing.

Thanks,
  Marc
--~--~-~--~~~---~--~~
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: Google Maps API

2008-03-30 Thread Michael

I would search for "google maps API." Really though the integration
with google maps is mostly a front end application. So you would
create it all with front end javascript.

The only real django knowledge to pass here would be to make store the
longitude and latitude values that google gives you with the address
to submit. This generally involves an extra 2 fields in the database,
but saves on valuable calls to Google. I used geopy to get to the
google api from python. It has worked without an issues on my server.

Hope that helps,

Michael

On Sun, Mar 30, 2008 at 9:08 PM,  <[EMAIL PROTECTED]> wrote:
>
>  I have a field I'm using that shows where events are around our area
>  for sports collectors, what I'd like to do is implement Google Maps,
>  kind of like the Washington Post does here:
>
>  
> http://projects.washingtonpost.com/2008-presidential-candidates/tracker/dates/2008/apr/09/6741/
>
>  Where/what would I need to search for?
>  >
>

--~--~-~--~~~---~--~~
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: Google Maps API

2008-03-30 Thread Ramiro Morales

On Sun, Mar 30, 2008 at 10:08 PM,  <[EMAIL PROTECTED]> wrote:
>
>  I have a field I'm using that shows where events are around our area
>  for sports collectors, what I'd like to do is implement Google Maps,
>  kind of like the Washington Post does here:
>
>  
> http://projects.washingtonpost.com/2008-presidential-candidates/tracker/dates/2008/apr/09/6741/
>
>  Where/what would I need to search for?

I'd start by going to the Google web site and searching with the
following three words: django google maps

Good luck,

-- 
 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: Django Admin WAP

2008-03-30 Thread leonel

Jeff Anderson wrote:
> leonel wrote:
>> Hello:
>>
>> Is there a WAP admin for django ??  Been searching and didn't found 
>> anything about it
>>   
> I'm fairly certain that there is no such thing.
>
> I am curious as to why you need it though. What specifically are you 
> trying to accomplish?
>
> Jeff Anderson
>
I can use the django admin on my cel phone  ( N73 )  It has a nice 
browser based
but I tested on another cel phone and it only knows WAP not full html / 
css / javascript

Leonel


--~--~-~--~~~---~--~~
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: synchronization problem

2008-03-30 Thread Mark Green

On Sun, 2008-03-30 at 17:49 -0700, meppum wrote:
> The easiest way to deal with this is to create a "version" column that
> gets updated with the current version number of the row in the
> database. Increment this column value each time a save is performed on
> that row. Override the save method on the model you want to perform
> this check on (in your example the poll model), and check on commit
> check that the value of the "version" colum in the database is LESS
> THEN the value of the "verson" column you are about to commit. If it
> is not, then throw an error. and rollback the transaction.

Ehm, and how would you "check on commit"?


-mark



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



Google Maps API

2008-03-30 Thread cmccomas80

I have a field I'm using that shows where events are around our area
for sports collectors, what I'd like to do is implement Google Maps,
kind of like the Washington Post does here:

http://projects.washingtonpost.com/2008-presidential-candidates/tracker/dates/2008/apr/09/6741/

Where/what would I need to search for?
--~--~-~--~~~---~--~~
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 Admin WAP

2008-03-30 Thread Jeff Anderson

leonel wrote:

Hello:

Is there a WAP admin for django ??  Been searching and didn't found 
anything about it
  

I'm fairly certain that there is no such thing.

I am curious as to why you need it though. What specifically are you 
trying to accomplish?


Jeff Anderson



signature.asc
Description: OpenPGP digital signature


Django Admin WAP

2008-03-30 Thread leonel

Hello:

Is there a WAP admin for django ??  Been searching and didn't found 
anything about it

Thank you

Leonel


--~--~-~--~~~---~--~~
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: localflavor in admin

2008-03-30 Thread erikankrom

Sorry, I was referring to the state and zip fields.  After modifying
my model, doing a sqlreset, and implementing the changes, they now
show up.  Thanks!

I was confused between the functionality of the forms and the fields
in models.  I'll get into the widget usage in the forms when building
more of the frontend I assume.

Why is this functionality not implemented in admin as easily as it is
in the forms usage?  To me, this would be pretty useful in the admin
area as well, just a thought.

On Mar 30, 3:55 pm, Evert Rol <[EMAIL PROTECTED]> wrote:
> > I have a model:
>
> > from django.db import models
> > from django import newforms as forms
> > from django.contrib.localflavor.us import forms as us_forms
>
> > class Address(models.Model):
> >    member                  = models.ForeignKey(Member, unique=True)
> >    street                  = models.CharField(max_length=50)
> >    city                    = models.CharField(max_length=30)
> >    state                   = us_forms.USStateSelect()
> >    zip                     = us_forms.USZipCodeField()
> >    description             = models.CharField(max_length=50)
> >    is_preferred            = models.BooleanField(default=False)
>
> > I can't get Address.city or Address.state to show up in admin forms.
> > What am I missing here?
>
> The only reason I can think of right now, is that you added those  
> later, after you initially created your models and the database.
> Since city is practically the same as street, there shouldn't  
> otherwise be any difference between the two telling the admin not to  
> show the first. Unless you have code elsewhere that may prevent this.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Multiple sites on shared host

2008-03-30 Thread Brandon Taylor

Hi everyone,

I'm on shared hosting and can't modify any Apache settings. So, I'm
assuming I need to specify which settings file to use in .htaccess.

I have two projects on my server. The first one is working correctly,
the second is not. The problem with the second is that it seems to be
loading project settings from the first project.

Here is my .htaccess file:

RewriteEngine On
RewriteBase /
RewriteRule ^(media/.*)$ - [L]
RewriteRule ^(admin_media/.*)$ - [L]
RewriteRule ^(dispatch\.fcgi/.*)$ - [L]
RewriteRule ^(.*)$ dispatch.fcgi/$1 [L]


Here is my dispatch.fcgi:

import sys
sys.path += ['/home/brandon/django/django_src']
sys.path += ['/home/brandon/django/django_projects']
from fcgi import WSGIServer
from django.core.handlers.wsgi import WSGIHandler
import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings'
WSGIServer(WSGIHandler()).run()

I'm sure the problem is the os.environ['DJANGO_SETTINGS_MODULE']
setting not getting specified for the individual websites. Can someone
please share their recipe for multiple sites in a shared environment?
I would really appreciate it!

Brandon
--~--~-~--~~~---~--~~
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: localflavor in admin

2008-03-30 Thread Evert Rol

> I have a model:
>
> from django.db import models
> from django import newforms as forms
> from django.contrib.localflavor.us import forms as us_forms
>
> class Address(models.Model):
>   member  = models.ForeignKey(Member, unique=True)
>   street  = models.CharField(max_length=50)
>   city= models.CharField(max_length=30)
>   state   = us_forms.USStateSelect()
>   zip = us_forms.USZipCodeField()
>   description = models.CharField(max_length=50)
>   is_preferred= models.BooleanField(default=False)
>
> I can't get Address.city or Address.state to show up in admin forms.
> What am I missing here?

The only reason I can think of right now, is that you added those  
later, after you initially created your models and the database.
Since city is practically the same as street, there shouldn't  
otherwise be any difference between the two telling the admin not to  
show the first. Unless you have code elsewhere that may prevent this.


--~--~-~--~~~---~--~~
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: localflavor in admin

2008-03-30 Thread Daniel Roseman

On Mar 30, 8:49 pm, erikankrom <[EMAIL PROTECTED]> wrote:
> I have a model:
>
> from django.db import models
> from django import newforms as forms
> from django.contrib.localflavor.us import forms as us_forms
>
> class Address(models.Model):
> member  = models.ForeignKey(Member, unique=True)
> street  = models.CharField(max_length=50)
> city= models.CharField(max_length=30)
> state   = us_forms.USStateSelect()
> zip = us_forms.USZipCodeField()
> description = models.CharField(max_length=50)
> is_preferred= models.BooleanField(default=False)
>
> I can't get Address.city or Address.state to show up in admin forms.
> What am I missing here?

The Localflavor fields are form fields, not model fields. You can't
use them in a model definition. (I presume it's Address.zip you can't
see, not Address.city.)

If you are using newforms_admin, you could override
formfield_for_dbfield in your model form definition and return the
relevant formfields. Otherwise, you can use the built-in USStateField
model field, but there is no equivalent USZipCodeField - although
there's nothing to stop you rolling your own, see
http://www.djangoproject.com/documentation/custom_model_fields/
--
DR.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Model Inheritance

2008-03-30 Thread jurian

How would I go about implementing a model that only exists to be
inherited from and not used on it's own?

Example:

class Animal(models.Model):
 name = models.CharField()

class Dog(Animal):
 x = models.CharField()

class Cat(Animal):
 y = models.CharField()


In the example I want to create and manipulate dog and cat objects,
but I will never need to use animal objects, so the animal table
doesn't need to be created at all.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



localflavor in admin

2008-03-30 Thread erikankrom

I have a model:

from django.db import models
from django import newforms as forms
from django.contrib.localflavor.us import forms as us_forms

class Address(models.Model):
member  = models.ForeignKey(Member, unique=True)
street  = models.CharField(max_length=50)
city= models.CharField(max_length=30)
state   = us_forms.USStateSelect()
zip = us_forms.USZipCodeField()
description = models.CharField(max_length=50)
is_preferred= models.BooleanField(default=False)

I can't get Address.city or Address.state to show up in admin forms.
What am I missing here?
--~--~-~--~~~---~--~~
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: generic views - newforms

2008-03-30 Thread Michael

They are two very different animals really.

Generic views work as a way to cut code from your views code (the code
that creates the httpresponse, between the url handling and the
template rendering). Newforms is the way that Django creates and
handles forms. You will generally need to use a new form inside a
view.

Documentation on each is great:
http://www.djangoproject.com/documentation/generic_views/
http://www.djangoproject.com/documentation/newforms/

hope that helps,
Michael



On Sun, Mar 30, 2008 at 3:22 PM, Victor Quiroz <[EMAIL PROTECTED]> wrote:
>
>  Hello, what is the difference (advantage) to use generic  views or newforms
>
>
>  Victor
>
>  >
>

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



generic views - newforms

2008-03-30 Thread Victor Quiroz

Hello, what is the difference (advantage) to use generic  views or newforms


Victor

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

2008-03-30 Thread Michael

That is whoafully lacking in information.

Here's a quick example of how data moves in newforms:
>>> from registration.forms import RegistrationForm
>>> form = RegistrationForm({'username':'jlennon','email':'[EMAIL 
>>> PROTECTED]','password1':'password','password2':'password'})
>>> form.cleaned_data
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'RegistrationForm' object has no attribute 'cleaned_data'
>>> form.data
{'username': 'jlennon', 'password1': 'password', 'password2':
'password', 'email': '[EMAIL PROTECTED]'}
>>> form.fields
{'username': ,
'email': ,
'password1': ,
'password2': }
>>> form.is_valid()
True
>>> form.cleaned_data
{'username': u'jlennon', 'password1': u'password', 'password2':
u'password', 'email': u'[EMAIL PROTECTED]'}

What exactly are you looking to do? That could help.

Michael


On Sun, Mar 30, 2008 at 5:17 AM, Rufman <[EMAIL PROTECTED]> wrote:
>
>  if I do form = SothmeForm(fields) and fields is a dictionary, I don't
>  get fields in the form object. Why is this?
>
>
>  Stephane
>  >
>

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



Funny video! Sexi girl!

2008-03-30 Thread romki

Funny video! Sexi girl!

http://rozrywka.yeba.pl/show.php?id=1030
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



users online

2008-03-30 Thread dall

Can someone help me how to get users online thingy done right ?
--~--~-~--~~~---~--~~
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: Need Help Thinking Through How to Setup URLS and VIEWS

2008-03-30 Thread Rob Hudson

On Mar 29, 2:54 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Specifically, i need help with:
> 1. How do I test to see what a slug is? I.E. In my case, is it a
> section or a page.
>
> Finally, am I barking up the wrong tree? Would it be simpler to just
> write a custom view that does what I want? Any advice is much
> appreciated.

I think the flow could go something like the following.  I'm guessing
that it makes sense to check the Section slug before the Page slug but
that could easily be reversed...

def section_or_page(request, slug):
# Look for section and call section_detail if found
try:
section = Section.objects.get(slug=slug)
except Section.DoesNotExist:
pass # Check for page down below
else:
return section_detail(request, section) # another view
# Look for page and call page_detail if found
try:
page = Page.objects.get(slug=slug)
except Page.DoesNotExist:
pass # return 404 below
else:
return page_detail(request, page)
# Otherwise, return 404
raise Http404, "No page or section found matching the slug: %s" %
(slug)

Then your detail views can do what you'd normally do, for example:

def section_detail(request, section):
# get other pieces from other models?
return render_to_response('section/blah.html', {'section':
section, 'other': other_model},
context_instance=RequestContext(request))

Hope that helps,
Rob
--~--~-~--~~~---~--~~
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: Permissions get automatically created without class Admin in models

2008-03-30 Thread James Bennett

On Sun, Mar 30, 2008 at 10:47 AM, Karen Tracey <[EMAIL PROTECTED]> wrote:
> Note ticket #5926 has been hanging around for a few months on this issue,
> with at least 3 people (one who provided a patch) hoping the fix would be to
> change the code to match the docs versus changing the docs to match the
> code.

I went ahead and wontfixed that; it's easy enough to just remove the
permissions if you don't want them, and it's just silly to have them
tied to the inner Admin class when that class will soon be part of
history.


-- 
"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: Permissions get automatically created without class Admin in models

2008-03-30 Thread Karen Tracey
On Sun, Mar 30, 2008 at 9:36 AM, James Bennett <[EMAIL PROTECTED]>
wrote:

>
> On Sun, Mar 30, 2008 at 8:06 AM, Carl <[EMAIL PROTECTED]> wrote:
> >  I will open a ticket right away...
>
> Fixed in changeset 7388.
>

Note ticket #5926 has been hanging around for a few months on this issue,
with at least 3 people (one who provided a patch) hoping the fix would be to
change the code to match the docs versus changing the docs to match the
code.

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: synchronization problem

2008-03-30 Thread Karen Tracey
On Sun, Mar 30, 2008 at 8:45 AM, PENPEN <[EMAIL PROTECTED]> wrote:

>
> Hi Carl,
> I didn't mention to the syncdb of manage.py.
> I'm talking about the problem that may happen when trying to access
> the db.
>
> Take a poll for exmaple. It may happen that 2 users vote at the same
> time. A vote action is made in the three steps:
> 1. read the old counter
> 2. add the counter by 1
> 3. save the counter
>
> I denote the two users as A and B, and A1 means the 1st step of A's
> progress, and B2 means the 2nd step of B, etc.
>
> I don't know how django deal with the requests of A and B. I suppose
> they are independent. So I think the scenario may happen like this:
> A1 B1 A2 A3 B2 B3
> or
> A1 A2 A3 B1 B2 B3
> or others
>
> If B1 happens after A3, there is no problem, and the counter is
> increased by 2. But if B1 is before A3, then B will read the old value
> again. And at last, the counter is only increased by 1, not 2.
>
> That's my concern. So how Django handle with such case? Many thanks!


Django allows you to hook into your database's underlying transaction
support:

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

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: Unexpected TypeError in m2m relationship

2008-03-30 Thread Karen Tracey
On Sun, Mar 30, 2008 at 8:38 AM, J. Clifford Dyer <[EMAIL PROTECTED]>
wrote:

> >[details snipped]
> >
> > Well I can still take your posted model file, simply add "class Admin:
> > pass" to the models so I can dummy up some data in the admin, and then
> > run your interactive session without error.  But, I am using Python
> > 2.5, not 2.3.  Searching for problems like this in Django's tracker
> > revealed this:
> >
> > http://code.djangoproject.com/ticket/3894
> >
> > which looks pretty similar and mentions Python 2.3 specifically as a
> > problem.  It was closed as a dup of this:
> >
> > http://code.djangoproject.com/ticket/1796
> >
> > which has a looong history but ultimately seems to have been
> > fixed by changeset 5919.  Unfortunately since you are running 0.96
> > (tagged around revision 4810), you don't have that fix.  Can you
> > consider upgrading either to a later Python or the SVN version of
> > Django?
> >
> > Karen
>
> Karen,
>
> Thanks for the pointer.  I think that bug is the issue here.  I'm not
> sure if I can get trunk installed or not.  It's not impossible, but it
> will be a challenge, persuading the sysadmins.  I'll give that a shot,
> and if it doesn't work, I don't think it'll kill me to explicitly define
> an association table with FKs back to each of the other tables.  If I do
> it in such a way that it uses the same table and column names as a m2m,
> it should save me some work if we do use many to many later.
>

Note for test purposes you can simply check out the svn version of Django
into your own space, alongside the code you are developing, and set your
PYTHONPATH environment variable to point to it ahead of whatever is
"officially installed" on the box.  Then with the development server you can
verify that the later version of Django does in fact fix the problem.  That
could then give you some concrete information to help convince the sysadmins
to make the change.

Note also that upgrading to the SVN version isn't hassle-free, if you've got
a bunch of code written to run on 0.96.  There have been a number of
backwards-incompatible changes (unicode support and autoescaping are the
biggies that come to mind), so if you've got an existing code base that
mostly works fine with 0.96 you'll likely have some breakage that you'll
need to fix before it runs properly on the SVN version.  But these changes
are all well-documented (
http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges), so it's
pretty straightforward to migrate your code.

If you are just starting out and don't have the worries of upgrading an old
code base, I'd say the SVN version of Django is the way to go.  Besides the
two very big improvements I mentioned above there are hundreds of bug fixes
and little improvements that have been made.  For new code, the only thing
you "gain" by starting out on 0.96 is a long list of known bugs that you
don't have the fix for as opposed to the unknown/unfixed ones that exist in
current SVN.  I know for sysadmins unfamiliar with how Djanog operates that
second list is a big red flag, but in practice the Django trunk is not
riddled with show-stopper newly-introduced bugs.  Any random checkout is
likely to work as well or better than what is now a quite old frozen
"official release".

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



Creating Custom Admin Views

2008-03-30 Thread Bernd

Hello,

I followed the documentation http://www.djangobook.com/en/1.0/chapter17/
in the section "Creating Custom Admin Views". 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 new view and the customized template
in my template directory.
But I get this errormessage http://dpaste.com/42185/

I think the original context from the admin view is 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: render_to_response syntax

2008-03-30 Thread Karen Tracey
On Sun, Mar 30, 2008 at 5:23 AM, Jaap <[EMAIL PROTECTED]> wrote:

>
> render_to_response('template', *args, **kwargs):
> kwargs looks like a dictionary but if I refer to a dictionary, it is
> ignored:
>
> In
>names = {}
>names['my_name'] = "somename"
>render_to_response('template.html', names)
>
> names is equivalent to {'my_name': 'somename'}, so I would expect the
> render_to_response to work - but it doesn't: why?
>

I'm guessing (since you don't give any details of how "doesn't work"
manifests itself) that the problem is not the dictionary you pass to
render_to_response, but rather that you are throwing away the return value
of render_to_response.  It returns an HttpResposne, which is what your view
function needs to return.  Assuming that last line is the last line of your
view function, it should be:

   names = {}
   names['my_name'] = "somename"
   return render_to_response('template.html', names)

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: Admin page doesn't show calendar popup

2008-03-30 Thread Evert Rol

> I just installed Django 96.1 on my Mac.  When I follow the tutorial
> and get to the Admin page, the calendar pop ups don't show up.  Is
> there a problem with the install.  I'm using Leopard.

Could be your browser (javascript problem). What browser & version are  
you using; have you tried another browser?
Alternatively, check that the admin javascript code is properly  
installed (although I'm guessing if the css is, the javascript code  
should be there as well).


--~--~-~--~~~---~--~~
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: render_to_response syntax

2008-03-30 Thread Evert Rol

> render_to_response('template', *args, **kwargs):
> kwargs looks like a dictionary but if I refer to a dictionary, it is
> ignored:
>
> In
>names = {}
>names['my_name'] = "somename"
>render_to_response('template.html', names)
>
> names is equivalent to {'my_name': 'somename'}, so I would expect the
> render_to_response to work - but it doesn't: why?

http://en.wikipedia.org/wiki/Varargs#Variadic_functions_in_Python


--~--~-~--~~~---~--~~
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: Shell reloading

2008-03-30 Thread Evert Rol

Have you tried installing iPython? I can remembers your history across  
sessions, and has lots of other niceties (eg, you can define a default  
set of import statements on startup).
If installed, python manage.py shell will automatically pick it up.


> Thanks Christian, that's a great tip!
>
> On 30 Mrz., 11:29, "Christian Vest Hansen" <[EMAIL PROTECTED]>
> wrote:
>> Try
>>
> help(reload)
>>
>> Instead of restarting the entier shell.
>>
>> On 3/30/08, Jorge Sousa <[EMAIL PROTECTED]> wrote:
>>
>>> Hi,
>>
>>> I'm using Django on windows.
>>> Is it possible to, once inside the Django Shell (manage.py shell)  
>>> while
>>> testing some bint and changing the code in a model method to have it
>>> available to the shell?
>>> Kind of autoreload thing.
>>> It only work by exiting the shell and entering again. But then  
>>> have to
>>> import everything again.
>>
>>> Thanks
>>
>>> Jorge Sousa
>>
>> --
>> Venlig hilsen / Kind regards,
>> Christian Vest Hansen.
> >


--~--~-~--~~~---~--~~
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: Permissions get automatically created without class Admin in models

2008-03-30 Thread James Bennett

On Sun, Mar 30, 2008 at 8:06 AM, Carl <[EMAIL PROTECTED]> wrote:
>  The only problem is, that those automatically created permissions have
>  english descriptions and I'm building something for a german-only
>  speaking user base. But i think i'll just change the descriptions
>  manually in the database. That's just a few lines of SQL at the end...

When you do that, the value you want to change is the "name" column,
which can be any value you'd like; the automatic bits, and the admin
interface and other built-in things which check for the default
permissions, won't look at that; they care about the unique
combination of the "codename" column (which must, for these purposes,
be of the form "(add|change|delete)_modelname") and the foreign key to
ContentType. So long as those are left alone, you can change "name" to
anything you want.


-- 
"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: Permissions get automatically created without class Admin in models

2008-03-30 Thread James Bennett

On Sun, Mar 30, 2008 at 8:06 AM, Carl <[EMAIL PROTECTED]> wrote:
>  I will open a ticket right away...

Fixed in changeset 7388.


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



Anyone Interested in writing an article for Digital Web Magazine?

2008-03-30 Thread William Hicks

Hi Kids,

I'm one of the new editors at Digital-Web Magazine, a weekly online
publication for web designers and developers.  We're always looking
for new authors and I was curious if anyone might want to do an intro
to Django for our readers.  We published a "Ruby on Rails for the rest
of us" a while back and It would be nice to see something similar for
Django.   If you are interested in this (or an other relevant idea),
can you email me off list and I'll give you more details of what we
are looking for.

Best,
Will

--~--~-~--~~~---~--~~
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: Permissions get automatically created without class Admin in models

2008-03-30 Thread Carl

Thanks again!

The only problem is, that those automatically created permissions have
english descriptions and I'm building something for a german-only
speaking user base. But i think i'll just change the descriptions
manually in the database. That's just a few lines of SQL at the end...

I will open a ticket right away...

On 30 Mrz., 15:02, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On Sun, Mar 30, 2008 at 8:41 PM, Carl <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > and fast thanks for the super fast reply!
> > Just to make sure that I understood it correctly ---> those standard
> > permissions are unevitable if I use django.contrib.auth?
>
> Yes.
>
> > That would really be inconvinient!
>
> Why? They don't take up much space; if you don't like the built-in
> permissions, but you still want users, etc, you can ignore them.
> Alternatively, you can set up your own permissions and ignore the
> built-in permissions. What are the automatically added permissions
> preventing you from doing?
>
> > And moreover, the documentation
> > would be misleading as it states:
>
> > "Three basic permissions -- add, change and delete -- are automatically
> > created for each Django model that has a class Admin set."
>
> Hrm... that's interesting, and definitely wrong. This might be a
> hangover from an early incarnation. Permissions are definitely created
> as part of contrib.auth synchronization. Could you please open a
> ticket reporting this fact so that this can be corrected.
>
> 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: Permissions get automatically created without class Admin in models

2008-03-30 Thread Russell Keith-Magee

On Sun, Mar 30, 2008 at 8:41 PM, Carl <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> and fast thanks for the super fast reply!
> Just to make sure that I understood it correctly ---> those standard
> permissions are unevitable if I use django.contrib.auth?

Yes.

> That would really be inconvinient!

Why? They don't take up much space; if you don't like the built-in
permissions, but you still want users, etc, you can ignore them.
Alternatively, you can set up your own permissions and ignore the
built-in permissions. What are the automatically added permissions
preventing you from doing?

> And moreover, the documentation
> would be misleading as it states:
>
> "Three basic permissions -- add, change and delete -- are automatically
> created for each Django model that has a class Admin set."

Hrm... that's interesting, and definitely wrong. This might be a
hangover from an early incarnation. Permissions are definitely created
as part of contrib.auth synchronization. Could you please open a
ticket reporting this fact so that this can be corrected.

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: synchronization problem

2008-03-30 Thread PENPEN

Hi Carl,
I didn't mention to the syncdb of manage.py.
I'm talking about the problem that may happen when trying to access
the db.

Take a poll for exmaple. It may happen that 2 users vote at the same
time. A vote action is made in the three steps:
1. read the old counter
2. add the counter by 1
3. save the counter

I denote the two users as A and B, and A1 means the 1st step of A's
progress, and B2 means the 2nd step of B, etc.

I don't know how django deal with the requests of A and B. I suppose
they are independent. So I think the scenario may happen like this:
A1 B1 A2 A3 B2 B3
or
A1 A2 A3 B1 B2 B3
or others

If B1 happens after A3, there is no problem, and the counter is
increased by 2. But if B1 is before A3, then B will read the old value
again. And at last, the counter is only increased by 1, not 2.

That's my concern. So how Django handle with such case? Many 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
-~--~~~~--~~--~--~---



Re: Permissions get automatically created without class Admin in models

2008-03-30 Thread Carl

Hi,

and fast thanks for the super fast reply!
Just to make sure that I understood it correctly ---> those standard
permissions are unevitable if I use django.contrib.auth?
That would really be inconvinient! And moreover, the documentation
would be misleading as it states:

"Three basic permissions -- add, change and delete -- are automatically
created for each Django model that has a class Admin set."

:(

Best regards,
Carl

On 30 Mrz., 14:23, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On Sun, Mar 30, 2008 at 8:18 PM, Carl <[EMAIL PROTECTED]> wrote:
>
> > Hi Djangonauts,
>
> > just observed that the standard edit/update/delete-permissions get
> > created for all my models without me having given them the inner class
> > Admin. Anyone an idea why this happens?
>
> Because model permissions are part of the contrib.auth application,
> not contrib.admin. If you don't want the Django built-in permissions,
> you need to remove django.contrib.auth from your INSTALLED_APPS list
> (although this will prevent you from using contrib.admin, and many
> other applications).
>
> 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: Unexpected TypeError in m2m relationship

2008-03-30 Thread J. Clifford Dyer

On Wed, 2008-03-26 at 19:11 -0400, Karen Tracey wrote:
> On Wed, Mar 26, 2008 at 5:16 PM, J. Cliff Dyer <[EMAIL PROTECTED]>
> wrote:
> 
> 
> So it did.  I had stripped down my original one to get rid of
> a couple
> hundred lines of unimportant cruft, but accidentally created
> some
> inconsistencies.  However, I ran it again before submitting
> and didn't
> get any errors except the one I mentioned before.  I just now
> went in
> and deleted all my .pyc files and tried again, and still got
> the
> TypeError I reported originally.
> 
> However, just to be sure, I cleaned up the models, deleted the
> pyc
> again, and re-dpasted my models and a fresh interactive
> session.
> 
> http://dpaste.com/41467/ -- models.py
> http://dpaste.com/41468/ -- complete interactive session (via
> django's
> manage.py shell)
> 
> Python 2.3.4 (#1, Nov 20 2007, 15:18:15)
> 
> >>> django.VERSION
> (0, 96, None)
> 
> Running on RHEL5 with a MySQL db.
> 
> Thanks for your patience.
> 
> Well I can still take your posted model file, simply add "class Admin:
> pass" to the models so I can dummy up some data in the admin, and then
> run your interactive session without error.  But, I am using Python
> 2.5, not 2.3.  Searching for problems like this in Django's tracker
> revealed this:
> 
> http://code.djangoproject.com/ticket/3894
> 
> which looks pretty similar and mentions Python 2.3 specifically as a
> problem.  It was closed as a dup of this:
> 
> http://code.djangoproject.com/ticket/1796
> 
> which has a looong history but ultimately seems to have been
> fixed by changeset 5919.  Unfortunately since you are running 0.96
> (tagged around revision 4810), you don't have that fix.  Can you
> consider upgrading either to a later Python or the SVN version of
> Django?
> 
> Karen

Karen,

Thanks for the pointer.  I think that bug is the issue here.  I'm not
sure if I can get trunk installed or not.  It's not impossible, but it
will be a challenge, persuading the sysadmins.  I'll give that a shot,
and if it doesn't work, I don't think it'll kill me to explicitly define
an association table with FKs back to each of the other tables.  If I do
it in such a way that it uses the same table and column names as a m2m,
it should save me some work if we do use many to many later.



Cheers,
Cliff




--~--~-~--~~~---~--~~
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: Permissions get automatically created without class Admin in models

2008-03-30 Thread Russell Keith-Magee

On Sun, Mar 30, 2008 at 8:18 PM, Carl <[EMAIL PROTECTED]> wrote:
>
> Hi Djangonauts,
>
> just observed that the standard edit/update/delete-permissions get
> created for all my models without me having given them the inner class
> Admin. Anyone an idea why this happens?

Because model permissions are part of the contrib.auth application,
not contrib.admin. If you don't want the Django built-in permissions,
you need to remove django.contrib.auth from your INSTALLED_APPS list
(although this will prevent you from using contrib.admin, and many
other applications).

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: Shell reloading

2008-03-30 Thread Carl

Thanks Christian, that's a great tip!

On 30 Mrz., 11:29, "Christian Vest Hansen" <[EMAIL PROTECTED]>
wrote:
> Try
>
> >>> help(reload)
>
> Instead of restarting the entier shell.
>
> On 3/30/08, Jorge Sousa <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I'm using Django on windows.
> > Is it possible to, once inside the Django Shell (manage.py shell) while
> > testing some bint and changing the code in a model method to have it
> > available to the shell?
> > Kind of autoreload thing.
> >  It only work by exiting the shell and entering again. But then have to
> > import everything again.
>
> > Thanks
>
> > Jorge Sousa
>
> --
> Venlig hilsen / Kind regards,
> Christian Vest Hansen.
--~--~-~--~~~---~--~~
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: synchronization problem

2008-03-30 Thread Carl

Hi PenPen,

what do you mean with 'the multi-thread scenario'?
I assume you already know the syncdb param for the manage.py?

Best regards,

Carl

On 30 Mrz., 13:12, PENPEN <[EMAIL PROTECTED]> wrote:
> Does Django provide any method to handle the synchronization problems
> with DB? How does it keep the DB's consistency in the multi-thread
> scenario?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Permissions get automatically created without class Admin in models

2008-03-30 Thread Carl

Hi Djangonauts,

just observed that the standard edit/update/delete-permissions get
created for all my models without me having given them the inner class
Admin. Anyone an idea why this happens?

Best regards,

Carl
--~--~-~--~~~---~--~~
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: selenium versus django app

2008-03-30 Thread Russell Keith-Magee

On Sat, Mar 29, 2008 at 12:45 AM, Robin Becker <[EMAIL PROTECTED]> wrote:
>
> I have a bunch of really weird errors coming from selenium built with the IDE
> when running in proper selenium. The page in question is an admin form coming
> from the python django framework
>
> >  info: Executing: |type | ctyhocn | gathi |
> >  debug: Command found, going to execute type
> >  error: Unexpected Exception: A script from "http://127.0.0.1:8000; was 
> > denied UniversalFileRead privileges.
>
> The field in question appears to be completely unexceptional; it's just an 
> input
> text box
>
> > 
>
> following this message there appears to be a large amount of debug info 
> related
> to some kind of string functions eg camelize, gsub etc etc.
>
> Can anybody tell me what's going on?

This is a new one for me. A few questions to help narrow things down:

Is this error appearing when running a selenium script, or a selenium
script inside a test case, or a test case in Django's test framework?

How is the debug info manifesting itself? A stack trace in the script?
In the browser?

If you can provide a reproducible test case (cut down selenium script,
minimal application, etc) and a copy of any errors/stack traces you
are getting, it may help us to track this down.

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: Problem with django unit testing

2008-03-30 Thread Russell Keith-Magee

On Sat, Mar 29, 2008 at 11:00 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> but when I run unit test to test the failed function use:
>  $ ./manage.py test apps.test.test_template
> there will be ok:
> """
> .
> --
> Ran 1 test in 1.336s

I can't say I've seen this myself. One immediate cause for concern is
your app and testcase naming - apps and test are names prone to
clashing with other modules. Try renaming the app and test case to be
"myapp" and "MyTest" and see if that makes a difference.

Other than that, my only suggestion would be that the successes and
failures that are being reported aren't actually for the same tests.
Try turning up verbosity on the test run; this will tell you
explicitly which tests are succeeding or failing. You may find that
the test that is being executed isn't the same in each case.

If neither of these suggestions help, I would suggest opening a ticket
so that this issue isn't forgotten.

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



synchronization problem

2008-03-30 Thread PENPEN

Does Django provide any method to handle the synchronization problems
with DB? How does it keep the DB's consistency in the multi-thread
scenario?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



render_to_response syntax

2008-03-30 Thread Jaap

render_to_response('template', *args, **kwargs):
kwargs looks like a dictionary but if I refer to a dictionary, it is
ignored:

In
names = {}
names['my_name'] = "somename"
render_to_response('template.html', names)

names is equivalent to {'my_name': 'somename'}, so I would expect the
render_to_response to work - but it doesn't: why?

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



News about GoFlow (workflow engine for django)

2008-03-30 Thread MiloZ

Some interesting new features:

- fast user switch in debug/test mode
- simulation mode with no code
- refactoring

Try it (again).
Don't hesitate asking questions in the FAQ (http://
code.djangoproject.com/wiki/goflow%3AFAQ)


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

2008-03-30 Thread Rufman

if I do form = SothmeForm(fields) and fields is a dictionary, I don't
get fields in the form object. Why is this?


Stephane
--~--~-~--~~~---~--~~
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: Problem with django unit testing

2008-03-30 Thread Kenneth Gonsalves


On 30-Mar-08, at 1:31 PM, [EMAIL PROTECTED] wrote:

> Any one who can help me? Thank you so much!

be patient - it is a weekend ;-)

-- 

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: Problem with django unit testing

2008-03-30 Thread [EMAIL PROTECTED]

Any one who can help me? Thank you so much!

On Mar 29, 11:00 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Hi, all,
>
> I meet a strangely problem on django unittesting. I use django svn
> version, the test code like this:
>
> """
> from django.test import TestCase
> ...
>
> class test(TestCase):
>   ...
>   def setUp(self):
>     ...
>
>   def test_template(self):
>     # Test Templates for register
>     response = self.client.get('/accounts/register/')
>     self.assertTemplateUsed(response, "account/register.html")
>     ...
> """
>
> When I run unit test to test the class use:
>   $ ./manage.py test apps.test
>
> I'll get a failed info:
> """
> F
> ==
> FAIL:  test_template(apps.tests)
> --
> Traceback (most recent call last):
>   File ".../apps/tests.py", line 486, in test_template
>     self.assertTemplateUsed(response, "account/register.html")
>   File ".../django/test/testcases.py", line 185, in assertTemplateUsed
>     self.fail('No templates used to render the response')
> AssertionError: No templates used to render the response
> """
>
> but when I run unit test to test the failed function use:
>   $ ./manage.py test apps.test.test_template
> there will be ok:
> """
> .
> --
> Ran 1 test in 1.336s
>
> OK
> """
>
> and I use "print respone.context" to see the template context of
> response,
> when I test the class, it won't get nothing(the value of
> respone.context is "None"), while I test the funtion, it will get a
> correct value...
>
> Any one can tell me that's why? Thank you so much!
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



xsex ....... xanal.......xfuck.......ineresting

2008-03-30 Thread XxX

Hot World -- XXX
***
http://myprofile96321.blogspot.com/
http://freewebs.com/7tracks/
http://freewebs.com/zbeauti/
***
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



natural love become evershine sexual

2008-03-30 Thread XxX

Hot World -- XXX
***
http://myprofile96321.blogspot.com/
http://freewebs.com/7tracks/
http://freewebs.com/zbeauti/
***
--~--~-~--~~~---~--~~
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: distinct UPDATE / INSERT before save() without select to DB

2008-03-30 Thread Amit Ramon

* eat <[EMAIL PROTECTED]> [2008-03-29 05:24 -0700]:
> 
> How to distinct in save() method of the model if the save operation
> will be update or insert.
> 
> I want to know it BEFORE doing the save().
> I want to know it WITHOUT doing a select to a database.
> 
> THe reason for that : i want to check the database conditions for the
> insert to initiate.
> 
> Currently i can only imagine i could do my own function save_insert()
> save_update() and initiate them when needed , isnt there any simpler
> method??


Have you looked at this:
http://www.djangoproject.com/documentation/db-api/#how-django-knows-to-update-vs-insert

It seems that if the object's primary key is not set, it'll be an insert; if it 
is set, according to the docs, you'll have to chack against the database.

--- Amit

> 
> 
> 

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