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: javascript in django

2008-03-28 Thread David Marquis
document.getElementById("field_id")
OR
if you use Prototype library : $("field_id")

--
David

On 28-Mar-08, at 10:49 AM, didia lim wrote:

> hi baxter, how can JS get the texfield by ID.. is there any  
> documentation or example? sorry i'm still new in django
>
> - Original Message 
> From: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> To: Django users 
> Sent: Friday, March 28, 2008 7:45:57 AM
> Subject: Re: javascript in django
>
>
> A custom widget would work, but you don't need to do that. Just have
> your JS get the textfield by ID. Done.
> Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  
> Try it now.
> >


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



Fwd: How to display a date in my template as Mar. 1 2008...not 2008-03-01?

2008-03-02 Thread David Marquis

Or rather :


{% for a in entries %}
 Date: {{ a.date|date:"jS o\f F" }}
{% endfor %}




--
David


Begin forwarded message:


From: David Marquis <[EMAIL PROTECTED]>
Date: March 2, 2008 8:15:00 PM EST (CA)
To: django-users@googlegroups.com
Subject: Re: How to display a date in my template as Mar. 1  
2008...not  2008-03-01?


You forgot the pipe | character and the colon :


{% for a in entries %}
 Date: {% a.date|date:"jS o\f F" %}
{% endfor %}



If a is your date, then:


{% for a in entries %}
 Date: {% a|date:"jS o\f F" %}
{% endfor %}



Have you read the docs? They are pretty clear about the syntax of  
template filters.


--
David

On 2-Mar-08, at 1:14 PM, Greg wrote:



Alex,
I tried that however I get the following error: TemplateSyntaxError:
Invalid block tag: 'a.date'

Here is my template

{% for a in entries %}
 Date: {% a.date "jS o\f F" %}
{% endfor %}



On Mar 2, 12:03 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:

Use the date filter:http://www.djangoproject.com/documentation/templates/#date

On Mar 2, 11:57 am, Greg <[EMAIL PROTECTED]> wrote:


I'm querying a table in my db.  Each record that gets returned
contains a DateField (the date it was created).  I'm able to show  
the
date in the template...however I want to change the format it's  
being
displayed as.  In this case it's 2008-03-01.  I want the date to  
show

Mar. 1 2008.



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







smime.p7s
Description: S/MIME cryptographic signature


Re: How to display a date in my template as Mar. 1 2008...not 2008-03-01?

2008-03-02 Thread David Marquis

You forgot the pipe | character and the colon :


{% for a in entries %}
  Date: {% a.date|date:"jS o\f F" %}
{% endfor %}



If a is your date, then:


{% for a in entries %}
  Date: {% a|date:"jS o\f F" %}
{% endfor %}



Have you read the docs? They are pretty clear about the syntax of  
template filters.


--
David

On 2-Mar-08, at 1:14 PM, Greg wrote:



Alex,
I tried that however I get the following error: TemplateSyntaxError:
Invalid block tag: 'a.date'

Here is my template

{% for a in entries %}
  Date: {% a.date "jS o\f F" %}
{% endfor %}



On Mar 2, 12:03 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:

Use the date filter:http://www.djangoproject.com/documentation/templates/#date

On Mar 2, 11:57 am, Greg <[EMAIL PROTECTED]> wrote:


I'm querying a table in my db.  Each record that gets returned
contains a DateField (the date it was created).  I'm able to show  
the
date in the template...however I want to change the format it's  
being
displayed as.  In this case it's 2008-03-01.  I want the date to  
show

Mar. 1 2008.



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





smime.p7s
Description: S/MIME cryptographic signature


Re: Assigning Dates to DateField instances

2008-02-25 Thread David Marquis

Hi Tim,

> lEvent = Event(request.POST)

Are you sure it's not that line causing trouble ?


--
David

On 21-Feb-08, at 5:16 PM, Tim Sawyer wrote:



I'm not sure I understand what I'm doing here.  I'm trying to create  
an Event
object from the data in a form (a simple html form, not a django  
form).


I want to do this:

   lDay = int(request.POST['DayNo'])
   lMonth = int(request.POST['MonthNo'])
   lYear = int(request.POST['YearNo'])
   lEvent = Event(request.POST)
   if lEvent.id == 0:
   lEvent.id = None
   lEvent.date = datetime(lYear,lMonth,lDay)
   lEvent.save()

and I'm getting the error

Exception Type: ProgrammingError
Exception Value:can't adapt
Exception
Location: 	/usr/lib/python2.5/site-packages/django/db/backends/ 
util.py in

execute, line 12

where the last bit of my code it hit was the save method.

Have I obviously done something wrong or is the problem data  
related?  I

suspect it's caused by the date assignment?  Any thoughts/pointers
appreciated.

Thanks,

Tim.

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





smime.p7s
Description: S/MIME cryptographic signature


Re: Issues with IE7 and {% for %} {% endfor %} tag

2008-02-21 Thread David Marquis
Malcom is right, this has absolutely nothing to do with the {% for %}  
tag.


My guess is that your IE7 might be more restrictive on cookies and not  
allowing the server to create a session cookie.
If your view code assumes that there is a session and you fetch  
"prize" from the session, then "prize" might simply be empty in IE.


--
David

On 21-Feb-08, at 8:26 AM, merric wrote:



I have a template that uses  {% for i in prize %}  {{ i.description }}
{% endfor %}

This iterates fine in Firefox, but in IE7 it keeps coming up blank.
I can't see any html issues.  I am working off my localhost.   Is this
a IE7 security issue or something else I have not thought of?

Cheers

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





smime.p7s
Description: S/MIME cryptographic signature


Re: Code upgrade

2008-02-05 Thread David Marquis
If you didn't make any change to the Django source base, you can  
simply download the latest release and install the new version.
If needed, you could also download the latest development version  
through the Subversion repository.




On 5-Feb-08, at 12:51 PM, Chris wrote:



Hello, does anyone have a script that will upgrade django code from .
91 to .96.  I know that there are upgrade scripts out there just not
sure where I can obtain them. Would very much like to upgrade code
repository to 96.

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





smime.p7s
Description: S/MIME cryptographic signature


Re: Capability Problem With Django ORM

2008-01-24 Thread David Marquis

Hi xunSir,

Personally, I can't understand your question.
You will have to get some help with english speaking because what you  
wrote there is merely understandable.


Thank you,

--
David

On 24-Jan-08, at 12:04 AM, xunSir wrote:



class Person(models.Model):
PIN = models.CharField(maxlength=20, primary_key=True)
Name = models.CharField(maxlength=20)

class Burse(models.Model):
PIN = models.ForeignKey(Person)
Cash = models.IntegerField()


With HTML Page:   show Burse

A person maybe has many Burse:
   Per query Burse,  per query The person by the way, query All
Person(guess).
May:
  Per query Burse, query it's Person in cache;
  If not,  query Person in db, and save it to cache.
  Is it OK ?

I know a little relation in django's models (ORM).
Who can explain them ?
Note: Speaking  chinese is had best



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





smime.p7s
Description: S/MIME cryptographic signature


Re: Sending SMS messages

2008-01-18 Thread David Marquis

Hi,

You know that you can send SMS messages to most phones using an e-mail  
address ?


[EMAIL PROTECTED]

The exact domain name is specific to each mobile phone provider. This  
information can be obtained from the provider's web site.

For more : http://en.wikipedia.org/wiki/SMS_gateways
I don't know if this would fit your requirement, but it is a quick and  
easy solution.


Otherwise there are several SMS gateways (with remote API) that will  
charge a fee for every relayed SMS message.

I am thinking of Clickatell (http://www.clickatell.com/)

--
David

On 18-Jan-08, at 1:31 PM, Marinho Brandao wrote:



sorry, the [1] is this:

http://code.google.com/p/django-sms/

2008/1/18, Marinho Brandao <[EMAIL PROTECTED]>:

Hello everybody,

I need to write an app to send SMS messages to the most mobile
companies I can, like Gmail does.

I'd see this app [1], but it has no files in the repository.

Does somebody knows a code, tool or something about this? (I wanna
write only what is left)

--
Marinho Brandão (José Mário)
http://marinho.webdoisonline.com/




--
Marinho Brandão (José Mário)
http://marinho.webdoisonline.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
-~--~~~~--~~--~--~---





smime.p7s
Description: S/MIME cryptographic signature


"Can't pickle function objects" in Sessions middleware. Any help ?

2008-01-18 Thread David Marquis

Hi folks,

My first post on the forum! I've been watching the threads for a  
while, but now I need your help :)

For a recent project, my users sometimes get the following error:
(this error is output raw to the user, as text sent back to the  
browser as the response content)

**
Mod_python error: "PythonHandler django.core.handlers.modpython"
Traceback (most recent call last):
   File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line  
299, in HandlerDispatch
 result = object(req)
   File "/var/lib/python-support/python2.4/django/core/handlers/ 
modpython.py", line 177, in handler
 return ModPythonHandler()(req)
   File "/var/lib/python-support/python2.4/django/core/handlers/ 
modpython.py", line 154, in __call__
 response = middleware_method(request, response)
   File "/var/lib/python-support/python2.4/django/contrib/sessions/ 
middleware.py", line 99, in process_response
 datetime.datetime.now() +  
datetime.timedelta(seconds=settings.SESSION_COOKIE_AGE))
   File "/var/lib/python-support/python2.4/django/contrib/sessions/ 
models.py", line 44, in save
 s = self.model(session_key, self.encode(session_dict), expire_date)
   File "/var/lib/python-support/python2.4/django/contrib/sessions/ 
models.py", line 10, in encode
 pickled = pickle.dumps(session_dict)
   File "copy_reg.py", line 69, in _reduce_ex
 raise TypeError, "can't pickle %s objects" % base.__name__
TypeError: can't pickle function objects
**

'Can't pickle function objects'

I can't seem to understand why on earth Django is trying to pickle a  
'function' into the user's session.
This error often happens when users leave their browser open and try  
to continue the process later on (a few hours later).

I did not change the settings.SESSION_COOKIE_AGE parameter, which  
means that it is set at the default value (2 weeks from the  
documentation). So the problem is not about the session's age.

Now I'm left thinking that it might be my fault : have I put something  
wrong in the session ?
In this case, the session contains, at most, one or two strings and 1  
or 2 unsaved or saved (persisted) model instances.
Is it right (or legal) to put an unsaved model instance in a user's  
session ?

Thanks for your help !

--
David


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