Do you really need a CharField here or would a simply string variable be
enough? So you could simply do something like
class Message(models.Model):
description = models.CharField(maxlength=200)
author = models.ForeignKey(User)
temp = ""
and it should never get stored in the database as far as I know... Or do
you need to have a CharField for a specific reason?
anders conbere schrieb:
> well like I said you can either make that particular field not a model
> object, or you could just add the attributes at run time. I'm not
> familiar with using the json serializer so I'm not sure about the
> specifics there, but for simply adding attributes to the model that
> wouldn't be saved to the db, both of those options are viable.
>
> ~ Anders
>
> On 3/10/07, Kenny Lee <[EMAIL PROTECTED]> wrote:
>> I need a model as i will need to save to the database. Just that i need to
>> serialize the object to send it to json, and it will be helpful to have some
>> custom attributes for temporary processing, but will not be saved to the db.
>>
>>
>>
>> On 3/10/07, anders conbere <[EMAIL PROTECTED]> wrote:
>>> I would just not make it a model.* since you don't want that value to
>>> be part of the Database, just don't use the ORM for it.
>>>
>>> ~ Anders
>>>
>>> On 3/10/07, shevken <[EMAIL PROTECTED]> wrote:
>>>> class Message(models.Model):
>>>> description = models.CharField(maxlength=200)
>>>> author = models.ForeignKey(User)
>>>> temp = models.CharField(maxlength=100)
>>>>
>>>>
>>>> When i syncdb, i do not want the column temp to be created. Is there
>>>> any arguments i can pass to enable this?
>>>>
>>>> Eg.
>>>>
>>>> temp = models.CharField(maxlength=100, persist=False)
>>>>
>>>>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---