Jobbet symfony like tutorial?

2009-11-13 Thread Xan
Hi,

I'm new in django. I gone from symfony. I decide to give a try to
django. Well, for starting I want a jobbet ([http://www.symfony-
project.org/jobeet/1_2/Doctrine/en/]) tutorial in django (30 days or
less in symfony for constructing a real project). And if it's possible
in pdf format for printing and consulting.

Is there any tutorial like that?

Thanks a lot,
Xan.

--

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




Models problem: put references of change in all fields

2009-10-11 Thread Xan

Hi,

I have a trouble with model definition: I have several classes, for
example a Car class:

class Car(models.Model):
numberplate = models.CharField(max_length=20)
color = models.CharField(max_length=100)
places = models.IntegerField()
reparation = models.DateTimeField()

I want to add Reference (like a book reference:name, date, reference
number, etc) in any change of this fields: for example, the bill
reference paper of color change, or the bill for the reparation, etc.

How can I add the references to all fields without defining a class
for each fields that only contains the field and the reference?

Thanks in advance,
Xan.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Are Dynamic fields possible?

2009-01-03 Thread Xan

Hi,

I just want to know if django support dynamic fields, that is the
option of not specied the type of field in the model and that user
could specify in application.

I think for examples about an application for doing notes. In one
note, one want to have: title, body, media, etc. but the number of
fields (and its type) is variable. What about something like:

class Note(models.Note):
title = models.CharField(max_length=200)
anything = models.ManyToManyField(DynamicField)

and when user create a class specifies title and adds want he/she
wants (body, pictures, etc. with the type of the field).

Is it possible?
Thanks a lot,
Xan.

PS: Happy new year.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Visualization of databases

2008-07-12 Thread Xan

Hi,

Is there any tool for visualizing database data? I mean for example,
to build graphics like piechart, linechart, classification of database
data in a frequency table (for example creating preaty diagrams like
piwik [http://piwik.org/), or with R [http://www.r-project.org/], or
gnuplot, )

Thanks a lot,
Xan.

PS: I want to apply in activities done for my organization (typically
I have a database of one class Action with the following fields:
Title, Description, Type, DateofStart, DateofEnd, Location, ) and
I want to classify and "draw" the actions by different type of fields)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Autoupdate field?

2008-07-12 Thread Xan

Yes, but if mary is a Person and Smith is a Family, and mary belongs
to Smith Family (that is mary.family = Smith), how to change
mary.hometelephone if Smith.hometelephone change?

Thanks a lot,
Xan.

On Jul 6, 10:02 pm, Juanjo Conti <[EMAIL PROTECTED]> wrote:
> I you want your data to be normalized, telephone_home char(9) should not
> be an attribute of Person.
>
> If mary is a Person you always can do:
>
> mary.family.telephone_home to get her telephone_home.
>
> Juanjo
> --
> mi blog:http://www.juanjoconti.com.ar
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Autoupdate field?

2008-07-06 Thread Xan

Hi,

I think in family class and person class.

I put in pseudocode:

Class Family
 string name
 telephon-home char(9)
 

Class Person
 string name
 string surname
 telephone-home char(9)
 mobile-phone char(9)

Every Person belongs to a Family.

How can I update Person.telephone-home and automatically updates
Family.telephone-home?

Thanks a lot,
Xan.
--~--~-~--~~~---~--~~
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: Multiple fields without manytomanyfield?

2008-07-06 Thread Xan

Thanks a lot,
Xan.

On Jun 25, 5:49 pm, Joel Bernstein <[EMAIL PROTECTED]> wrote:
> I don't suppose a CommaSeparatedIntegerField would work, would it?
>
> You'd lose some querying options that you'd have with a foreign key
> relationship, but that may not be important to you.
>
> On Jun 25, 10:37 am, Xan <[EMAIL PROTECTED]> wrote:
>
> > sorry models.list(integer, max=unlimited)
>
> > On Jun 25, 5:37 pm, Xan <[EMAIL PROTECTED]> wrote:
>
> > > Yes, I'm looking for that but without defining the ManyToManyField.
> > > Could I wrote something like:
>
> > > > class A(models.Model):
> > > >     integers = models.list(Integer, max=unlimited)
>
> > > Thanks,
>
> > > On Jun 23, 9:10 pm, "Richard Dahl" <[EMAIL PROTECTED]> wrote:
>
> > > > I am a bit confused, are you looking for this:
>
> > > > class IntegerRelation(models.Model):
> > > >     content = models.IntegerField()
>
> > > > class A(models.Model):
> > > >     integers = models.ManyToManyField(IntegerRelation)
>
> > > > -richard
>
> > > > On 6/22/08, Xan <[EMAIL PROTECTED]> wrote:
>
> > > > > Hi,
>
> > > > > Suposing you want a model A with several and indetermined number of
> > > > > integer fields. Is there any possibility of defining A without
> > > > > creating a Integer class and then add ManyToManyField(Integer) in
> > > > > class A?
>
> > > > > Thanks a lot!
> > > > > Xan.
--~--~-~--~~~---~--~~
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: Multiple fields without manytomanyfield?

2008-06-25 Thread Xan

sorry models.list(integer, max=unlimited)

On Jun 25, 5:37 pm, Xan <[EMAIL PROTECTED]> wrote:
> Yes, I'm looking for that but without defining the ManyToManyField.
> Could I wrote something like:
>
> > class A(models.Model):
> >     integers = models.list(Integer, max=unlimited)
>
> Thanks,
>
> On Jun 23, 9:10 pm, "Richard Dahl" <[EMAIL PROTECTED]> wrote:
>
> > I am a bit confused, are you looking for this:
>
> > class IntegerRelation(models.Model):
> >     content = models.IntegerField()
>
> > class A(models.Model):
> >     integers = models.ManyToManyField(IntegerRelation)
>
> > -richard
>
> > On 6/22/08, Xan <[EMAIL PROTECTED]> wrote:
>
> > > Hi,
>
> > > Suposing you want a model A with several and indetermined number of
> > > integer fields. Is there any possibility of defining A without
> > > creating a Integer class and then add ManyToManyField(Integer) in
> > > class A?
>
> > > Thanks a lot!
> > > Xan.
--~--~-~--~~~---~--~~
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: Multiple fields without manytomanyfield?

2008-06-25 Thread Xan

Yes, I'm looking for that but without defining the ManyToManyField.
Could I wrote something like:

> class A(models.Model):
> integers = models.list(Integer, max=unlimited)

Thanks,



On Jun 23, 9:10 pm, "Richard Dahl" <[EMAIL PROTECTED]> wrote:
> I am a bit confused, are you looking for this:
>
> class IntegerRelation(models.Model):
>     content = models.IntegerField()
>
> class A(models.Model):
>     integers = models.ManyToManyField(IntegerRelation)
>
> -richard
>
> On 6/22/08, Xan <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi,
>
> > Suposing you want a model A with several and indetermined number of
> > integer fields. Is there any possibility of defining A without
> > creating a Integer class and then add ManyToManyField(Integer) in
> > class A?
>
> > Thanks a lot!
> > Xan.
--~--~-~--~~~---~--~~
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 fields without manytomanyfield?

2008-06-22 Thread Xan

Hi,

Suposing you want a model A with several and indetermined number of
integer fields. Is there any possibility of defining A without
creating a Integer class and then add ManyToManyField(Integer) in
class A?

Thanks a lot!
Xan.

--~--~-~--~~~---~--~~
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: __str__(self) for ManyToManyField

2007-11-11 Thread Xan



On Nov 11, 1:16 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Sat, 2007-11-10 at 11:26 -0800, Xan wrote:
>
> > On Nov 10, 6:01 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
> > wrote:
> > > On Fri, 2007-11-09 at 08:19 -0800, Xan wrote:
>
> > > > On Nov 9, 2:36 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
> > > > wrote:
> > > > > On Thu, 2007-11-08 at 09:11 -0800, Xan wrote:
> > > > > > Hi,
>
> > > > > > I have these models:
>
> > > > > > class A(models.Model):
>
> > > > > > [...]
> > > > > >def __str__(self):
> > > > > >return "(%s, %s)" % (self.estudi, self.curs)
>
> > > > > >class Admin:
> > > > > >pass
>
> > > > > > and
>
> > > > > > class B(models.Model):
>
> > > > > >estudi_oferit = models.ManyToManyField('A', blank=True, 
> > > > > > null=True)
>
> > > > > >class Admin:
> > > > > >list_display = ('tipus', 'codi', 'nom', 'adreca', 
> > > > > > 'localitat', 'cp',
> > > > > > 'zona_concurs', 'ordre_concurs', 'estudi_oferit')
>
> > > > > > and when I list B elements in admin mode, in puts me address memory 
> > > > > > of
> > > > > > objects instead of displaying field A as I define in __str__
>
> > > > > You have not defined __str__ on B, so this isn't entirely unexpected
> > > > > (although I am not completely sure what you're seeing, but anything is
> > > > > not unexpected here).
>
> > > > > Note that the estudi_oferit field is many-to-many, so it has no
> > > > > "natural" way to be represented as a string. After all, it could be
> > > > > referring to 10,000 objects at the other end. There's no way to 
> > > > > display
> > > > > that naturally.
>
> > > > I'mt not agree with you: there is a natural way for displaying
> > > > "estudi_oferit": list all of estudi_oferit's that has one instance.
>
> > > Since it's a many-to-many relationship, there could be millions of
> > > related objects for a single B instance, so this would be a very poor
> > > default representation.
>
> > Yes, but I mean that it should be that way.
> > We could be restrict the number of objects displaying in admin mode
> > by:
> > list_display = ('tipus', 'codi', 'nom', 'adreca', 'localitat',
> > 'cp', 'zona_concurs', 'ordre_concurs', 'estudi_oferit':30)
>
> > and admin mode only show almost 30 first objects of estudi_oferit?
>
> > It's the natural way for displaying it I think. For the problem of
> > millions of objects we could put a restriction of displaying in list.
> > It could be done?
>
> I've explained why this wouldn't be a good idea (and the documentation
> extends that explanation). You want to impose extra database hits and
> computation on every single Django user just so that you don't have to
> write on extra method. That's not going to happen.
>
> Django provides you with a sensible default and also documents how you
> can change this. You really have the best of both worlds here.

Can you pointing me where is the exact location of this documentation?

I think I will change it

Xan.
>
> Best wishes,
> Malcolm
>
> --
> If it walks out of your refrigerator, LET IT 
> GO!!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: __str__(self) for ManyToManyField

2007-11-10 Thread Xan



On Nov 10, 6:01 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Fri, 2007-11-09 at 08:19 -0800, Xan wrote:
>
> > On Nov 9, 2:36 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
> > wrote:
> > > On Thu, 2007-11-08 at 09:11 -0800, Xan wrote:
> > > > Hi,
>
> > > > I have these models:
>
> > > > class A(models.Model):
>
> > > > [...]
> > > >def __str__(self):
> > > >return "(%s, %s)" % (self.estudi, self.curs)
>
> > > >class Admin:
> > > >pass
>
> > > > and
>
> > > > class B(models.Model):
>
> > > >estudi_oferit = models.ManyToManyField('A', blank=True, null=True)
>
> > > >class Admin:
> > > >list_display = ('tipus', 'codi', 'nom', 'adreca', 
> > > > 'localitat', 'cp',
> > > > 'zona_concurs', 'ordre_concurs', 'estudi_oferit')
>
> > > > and when I list B elements in admin mode, in puts me address memory of
> > > > objects instead of displaying field A as I define in __str__
>
> > > You have not defined __str__ on B, so this isn't entirely unexpected
> > > (although I am not completely sure what you're seeing, but anything is
> > > not unexpected here).
>
> > > Note that the estudi_oferit field is many-to-many, so it has no
> > > "natural" way to be represented as a string. After all, it could be
> > > referring to 10,000 objects at the other end. There's no way to display
> > > that naturally.
>
> > I'mt not agree with you: there is a natural way for displaying
> > "estudi_oferit": list all of estudi_oferit's that has one instance.
>
> Since it's a many-to-many relationship, there could be millions of
> related objects for a single B instance, so this would be a very poor
> default representation.

Yes, but I mean that it should be that way.
We could be restrict the number of objects displaying in admin mode
by:
list_display = ('tipus', 'codi', 'nom', 'adreca', 'localitat',
'cp', 'zona_concurs', 'ordre_concurs', 'estudi_oferit':30)

and admin mode only show almost 30 first objects of estudi_oferit?

It's the natural way for displaying it I think. For the problem of
millions of objects we could put a restriction of displaying in list.
It could be done?




> Django doesn't do that. All your other problems
> seem to stem from this assumption. Note that this is actually documented
> behaviour, too. You're expecting something to happen that we explicitly
> say won't happen (read the docs for list_display again). We also
> document how to emulate the behaviour if you really want it.

Were it's _exactly_ documented? I did not find it

Thanks in advance,
Xan.

>
> Malcolm
>
> --
> If at first you don't succeed, destroy all evidence that you 
> tried.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: __str__(self) for ManyToManyField

2007-11-09 Thread Xan



On Nov 9, 2:36 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Thu, 2007-11-08 at 09:11 -0800, Xan wrote:
> > Hi,
>
> > I have these models:
>
> > class A(models.Model):
>
> > [...]
> >def __str__(self):
> >return "(%s, %s)" % (self.estudi, self.curs)
>
> >class Admin:
> >pass
>
> > and
>
> > class B(models.Model):
>
> >estudi_oferit = models.ManyToManyField('A', blank=True, null=True)
>
> >class Admin:
> >list_display = ('tipus', 'codi', 'nom', 'adreca', 'localitat', 
> > 'cp',
> > 'zona_concurs', 'ordre_concurs', 'estudi_oferit')
>
> > and when I list B elements in admin mode, in puts me address memory of
> > objects instead of displaying field A as I define in __str__
>
> You have not defined __str__ on B, so this isn't entirely unexpected
> (although I am not completely sure what you're seeing, but anything is
> not unexpected here).
>
> Note that the estudi_oferit field is many-to-many, so it has no
> "natural" way to be represented as a string. After all, it could be
> referring to 10,000 objects at the other end. There's no way to display
> that naturally.

I'mt not agree with you: there is a natural way for displaying
"estudi_oferit": list all of estudi_oferit's that has one instance.

>
> Explicitly define a __str__ method on B that displays the fields you
> want. Django's default __str__ is rarely the right thing to use.

If I put __str__ in B, then I don't use admin list_display (because it
overwrites it).

I consider that I only have to define __str__ in A, not in B, because
I want to display A objects not B. I'm not sure if you understand it?

Thanks in advance,
Xan.


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



__str__(self) for ManyToManyField

2007-11-08 Thread Xan

Hi,

I have these models:

class A(models.Model):

[...]
def __str__(self):
return "(%s, %s)" % (self.estudi, self.curs)


class Admin:
pass

and

class B(models.Model):

estudi_oferit = models.ManyToManyField('A', blank=True, null=True)

   class Admin:
list_display = ('tipus', 'codi', 'nom', 'adreca', 'localitat', 
'cp',
'zona_concurs', 'ordre_concurs', 'estudi_oferit')

and when I list B elements in admin mode, in puts me address memory of
objects instead of displaying field A as I define in __str__

How can I modify it?
I use 0.96

Thanks in advance,
Xan.


--~--~-~--~~~---~--~~
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: deseb installation in ubuntu

2007-10-14 Thread Xan

Okay, Derek, it's fixed _effectively_ in 0.2.2. It works for me!

Thank you VERY MUCH for your support,
Xan.

On Oct 13, 12:12 am, Derek Anderson <[EMAIL PROTECTED]> wrote:
> xan,
>
> this is fixed in the latest version of deseb.  (v0.2.2)
>
> feel free to pm me if you have any further problems, or 
> join:http://groups.google.com/group/deseb-discuss
>
> or use the issue tracker at:http://code.google.com/p/deseb/
>
> thanks,
> derek
>
>
>
> Xan wrote:
> > Okay. Say something
> > If you need some files, I will be charmed to give
>
> > Regards,
> > Xan.
>
> > On Oct 11, 9:53 pm, Derek Anderson <[EMAIL PROTECTED]> wrote:
> >> your previous bug was a standard import issue unrelated to deseb.
> >> however this looks like it may be a real one.  let me look into it.
>
> >> derek
>
> >> Xan wrote:
>
> >>> On Oct 11, 5:13 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
> >>> wrote:
> >>>> On Thu, 2007-10-11 at 07:21 -0700, Xan wrote:
> >>>> [...]
> >>>>> Perhaps I have to read python doc, but my intention is only follow
> >>>>> deseb/django documentation. If normal user have to read python doc,
> >>>>> then django became not simple, I think
> >>>> Django is a framework for *Python programmers*. You do need to have some
> >>>> understanding of Python in order to be able to diagnose anything but the
> >>>> most trivial problems. It would be redundant for us to repeat
> >>>> information that is already in the Python documentation, so if your
> >>>> expectations are that you will never have to read anything beyond
> >>>> Django's documentation, then you are going to find things fairly
> >>>> difficult.
> >>>> Even if the required knowledge is only how import paths work and how to
> >>>> configure them, you need to do some background work here. We aren't
> >>>> going to cover a lot of that information in Django's documentation
> >>>> because it is so fundamental to the way Python works that it is covered
> >>>> in the standard docs already.
> >>>> The concept of a "normal user" is fairly nebulous, since that could mean
> >>>> somebody developing with Django or just using a Django application (an
> >>>> installer -- the role you are playing -- would not typically be the
> >>>> normal target audience for something like this). Unless you are
> >>>> installing pre-packaged versions of everything (which you aren't), you
> >>>> at least need to have a sys-admin's understanding of Python (which means
> >>>> knowing about standard import paths, etc) to get things working.
> >>>> I'm also a bit concerned about what you expect to happen at the end of
> >>>> this project. Something like deseb is *only* useful if you are
> >>>> developing with Django, and only in semi-advanced situations. Which
> >>>> means writing Python code. It's not really a tool for somebody just
> >>>> starting out.
> >>> I don't want to discuss for discuss, but I'm not in agreement with you
> >>> with this last paragraph. deseb is useful for database evolution (for
> >>> example for adding models to modeles file), that I think it's very
> >>> frequent request for normal users, not only developers.
> >>> For this reason is for that I want to install deseb. For migrate my
> >>> database more easyly
> >>> For the other hand, how do you know that my error using deseb is path
> >>> python error?. After I put "import deseb" in settings.py and run
> >>> "python manage sqlevolve analisi" I get the following error:
> >>>  python manage.py sqlevolve analisi
> >>> BEGIN;
> >>> Traceback (most recent call last):
> >>>   File "manage.py", line 11, in 
> >>> execute_manager(settings)
> >>>   File "/var/lib/python-support/python2.5/django/core/management.py",
> >>> line 1672, in execute_manager
> >>> execute_from_command_line(action_mapping, argv)
> >>>   File "/usr/lib/python2.5/site-packages/deseb/__init__.py", line 90,
> >>> in inner
> >>> return func(*args, **kwargs)
> >>>   File "/var/lib/python-support/python2.5/django/core/management.py",
> >>>

Re: deseb installation in ubuntu

2007-10-12 Thread Xan

Okay. Say something
If you need some files, I will be charmed to give

Regards,
Xan.

On Oct 11, 9:53 pm, Derek Anderson <[EMAIL PROTECTED]> wrote:
> your previous bug was a standard import issue unrelated to deseb.
> however this looks like it may be a real one.  let me look into it.
>
> derek
>
>
>
> Xan wrote:
>
> > On Oct 11, 5:13 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
> > wrote:
> >> On Thu, 2007-10-11 at 07:21 -0700, Xan wrote:
>
> >> [...]
>
> >>> Perhaps I have to read python doc, but my intention is only follow
> >>> deseb/django documentation. If normal user have to read python doc,
> >>> then django became not simple, I think
> >> Django is a framework for *Python programmers*. You do need to have some
> >> understanding of Python in order to be able to diagnose anything but the
> >> most trivial problems. It would be redundant for us to repeat
> >> information that is already in the Python documentation, so if your
> >> expectations are that you will never have to read anything beyond
> >> Django's documentation, then you are going to find things fairly
> >> difficult.
>
> >> Even if the required knowledge is only how import paths work and how to
> >> configure them, you need to do some background work here. We aren't
> >> going to cover a lot of that information in Django's documentation
> >> because it is so fundamental to the way Python works that it is covered
> >> in the standard docs already.
>
> >> The concept of a "normal user" is fairly nebulous, since that could mean
> >> somebody developing with Django or just using a Django application (an
> >> installer -- the role you are playing -- would not typically be the
> >> normal target audience for something like this). Unless you are
> >> installing pre-packaged versions of everything (which you aren't), you
> >> at least need to have a sys-admin's understanding of Python (which means
> >> knowing about standard import paths, etc) to get things working.
>
> >> I'm also a bit concerned about what you expect to happen at the end of
> >> this project. Something like deseb is *only* useful if you are
> >> developing with Django, and only in semi-advanced situations. Which
> >> means writing Python code. It's not really a tool for somebody just
> >> starting out.
>
> > I don't want to discuss for discuss, but I'm not in agreement with you
> > with this last paragraph. deseb is useful for database evolution (for
> > example for adding models to modeles file), that I think it's very
> > frequent request for normal users, not only developers.
>
> > For this reason is for that I want to install deseb. For migrate my
> > database more easyly
>
> > For the other hand, how do you know that my error using deseb is path
> > python error?. After I put "import deseb" in settings.py and run
> > "python manage sqlevolve analisi" I get the following error:
>
> >  python manage.py sqlevolve analisi
> > BEGIN;
> > Traceback (most recent call last):
> >   File "manage.py", line 11, in 
> > execute_manager(settings)
> >   File "/var/lib/python-support/python2.5/django/core/management.py",
> > line 1672, in execute_manager
> > execute_from_command_line(action_mapping, argv)
> >   File "/usr/lib/python2.5/site-packages/deseb/__init__.py", line 90,
> > in inner
> > return func(*args, **kwargs)
> >   File "/var/lib/python-support/python2.5/django/core/management.py",
> > line 1632, in execute_from_command_line
> > output = action_mapping[action](mod)
> >   File "/usr/lib/python2.5/site-packages/deseb/__init__.py", line 83,
> > in inner
> > return schema_evolution.get_sql_evolution_v0_96(*args, **kwargs)
> >   File "/usr/lib/python2.5/site-packages/deseb/schema_evolution.py",
> > line 242, in get_sql_evolution_v0_96
> > return get_sql_evolution(app, management.style)
> >   File "/usr/lib/python2.5/site-packages/deseb/schema_evolution.py",
> > line 248, in get_sql_evolution
> > return get_sql_evolution_detailed(app, style)[2]
> >   File "/usr/lib/python2.5/site-packages/deseb/schema_evolution.py",
> > line 334, in get_sql_evolution_detailed
> > sql, references = _get_sql_model_create(model, seen_models, style)
> >   File "/usr/lib/python2.5/site-packages/deseb/schema_evolution.py",
> > line

Re: deseb installation in ubuntu

2007-10-11 Thread Xan



On Oct 11, 5:13 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Thu, 2007-10-11 at 07:21 -0700, Xan wrote:
>
> [...]
>
> > Perhaps I have to read python doc, but my intention is only follow
> > deseb/django documentation. If normal user have to read python doc,
> > then django became not simple, I think
>
> Django is a framework for *Python programmers*. You do need to have some
> understanding of Python in order to be able to diagnose anything but the
> most trivial problems. It would be redundant for us to repeat
> information that is already in the Python documentation, so if your
> expectations are that you will never have to read anything beyond
> Django's documentation, then you are going to find things fairly
> difficult.
>
> Even if the required knowledge is only how import paths work and how to
> configure them, you need to do some background work here. We aren't
> going to cover a lot of that information in Django's documentation
> because it is so fundamental to the way Python works that it is covered
> in the standard docs already.
>
> The concept of a "normal user" is fairly nebulous, since that could mean
> somebody developing with Django or just using a Django application (an
> installer -- the role you are playing -- would not typically be the
> normal target audience for something like this). Unless you are
> installing pre-packaged versions of everything (which you aren't), you
> at least need to have a sys-admin's understanding of Python (which means
> knowing about standard import paths, etc) to get things working.
>
> I'm also a bit concerned about what you expect to happen at the end of
> this project. Something like deseb is *only* useful if you are
> developing with Django, and only in semi-advanced situations. Which
> means writing Python code. It's not really a tool for somebody just
> starting out.

I don't want to discuss for discuss, but I'm not in agreement with you
with this last paragraph. deseb is useful for database evolution (for
example for adding models to modeles file), that I think it's very
frequent request for normal users, not only developers.

For this reason is for that I want to install deseb. For migrate my
database more easyly

For the other hand, how do you know that my error using deseb is path
python error?. After I put "import deseb" in settings.py and run
"python manage sqlevolve analisi" I get the following error:

 python manage.py sqlevolve analisi
BEGIN;
Traceback (most recent call last):
  File "manage.py", line 11, in 
execute_manager(settings)
  File "/var/lib/python-support/python2.5/django/core/management.py",
line 1672, in execute_manager
execute_from_command_line(action_mapping, argv)
  File "/usr/lib/python2.5/site-packages/deseb/__init__.py", line 90,
in inner
return func(*args, **kwargs)
  File "/var/lib/python-support/python2.5/django/core/management.py",
line 1632, in execute_from_command_line
output = action_mapping[action](mod)
  File "/usr/lib/python2.5/site-packages/deseb/__init__.py", line 83,
in inner
return schema_evolution.get_sql_evolution_v0_96(*args, **kwargs)
  File "/usr/lib/python2.5/site-packages/deseb/schema_evolution.py",
line 242, in get_sql_evolution_v0_96
return get_sql_evolution(app, management.style)
  File "/usr/lib/python2.5/site-packages/deseb/schema_evolution.py",
line 248, in get_sql_evolution
return get_sql_evolution_detailed(app, style)[2]
  File "/usr/lib/python2.5/site-packages/deseb/schema_evolution.py",
line 334, in get_sql_evolution_detailed
sql, references = _get_sql_model_create(model, seen_models, style)
  File "/usr/lib/python2.5/site-packages/deseb/schema_evolution.py",
line 413, in _get_sql_model_create
 
style.SQL_FIELD(ops.quote_name(f.rel.to._meta.get_field(f.rel.field_name).column))
+ ')' #+
AttributeError: DatabaseOperations instance has no attribute
'quote_name'


If you see, it appears that deseb is starting (BEGIN line). So, the
path seems to be good (at least it detects deseb). Isn't ?
How can I know if it's path problem or another thing?

Thanks in advance, and sorry for long thread but I'm newbee user (yes,
django users include newbees ;-))
Xan.

PS: My export command output is:

export
declare -x COLORTERM="Terminal"
declare -x DBUS_SESSION_BUS_ADDRESS="unix:abstract=/tmp/dbus-
xp4BcYOtii,guid=915223fcae6fa13470f8cc00470e66b6"
declare -x DESKTOP_SESSION="xfce4"
declare -x DISPLAY=":0.0"
declare -x GDMSESSION="xfce4"
declare -x GDM_XSERVER_LOCATION="local"
declare -x GNOME_KEYRING_SOCKET="/tmp/keyring-oidSB3/socket"
declare -x HISTCONTROL="ignoredups&qu

Re: deseb installation in ubuntu

2007-10-11 Thread Xan



On Oct 9, 8:41 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On 10/9/07, Xan <[EMAIL PROTECTED]> wrote:
>
> > Where is the error?
>
> In all seriousness, judging from your last several emails, it's time
> for you to sit down and read the official documentation for Python;
> most of your problems seem to stem from not understanding how Python's
> import path works.
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of correct."

Sorry James, but I'm not a programmer. I only want to run deseb easyly
as I run django.
The think I like to django is that it's simple: no SQL knowledge is
required, no programming language knowledge required, 

I choose django among others (ruby on rails requires SQL, symphony
have more complicate organization, etc. )for this reason

Perhaps I have to read python doc, but my intention is only follow
deseb/django documentation. If normal user have to read python doc,
then django became not simple, I think

But, thanks for your recommendation

Regards,
Xan.

PS: Not offend intention


--~--~-~--~~~---~--~~
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: deseb installation in ubuntu

2007-10-11 Thread Xan



On Oct 9, 9:50 pm, Derek Anderson <[EMAIL PROTECTED]> wrote:
> well, is 7.04, site-packages is here:
> /usr/lib/python2.5/site-packages/
>
> but your problem obviously precedes this.  did you muck with you
> manage.py file?
>
> or, when you say "import setting.py", you're not literally typing
> "import setting.py" are you?  make sure you're not including the
> extension in your manage.py, or anywhere else you're calling it.  (same
> goes for DJANGO_SETTINGS_MODULE)

In theory (following instructions) I have only to touch settings.py
Why now I have to change manage.py?

What change I have to put in DJANGO_SETTINGS_MODULE?

Thanks in advance,
Xan.

>
> derek
>
>
>
> Xan wrote:
> > Hi,
>
> > * I have installed django 0.96 in ubuntu 7.04 [http://
> > packages.ubuntu.com/gutsy/python/python-django] (when I run dpkg -l I
> > get version "0.96-1~feisty1")
>
> > * I want to install deseb and I follow installation instructions
> > [http://code.google.com/p/deseb/wiki/Installation]
>
> > * The problem is that, after I do import als setting.py, I get the
> > following error:
>
> > python manage.py runserver
> > Error: Can't find the file 'settings.py' in the directory containing
> > 'manage.py'. It appears you've customized things.
> > You'll have to run django-admin.py, passing it your settings module.
> > (If the file settings.py does indeed exist, it's causing an
> > ImportError somehow.)
>
> > * I think that the problem is that I don't know where is
> > "/site-packages".  I created the directory  "site-
> > packages" in /usr/share/python/ and I put "deseb" as a subdirectory
>
> > Where is the error?
>
> > Thanks in advance,
> > Xan.
>
> --
>   looking to buy or sell anything?
>
>  try:http://allurstuff.com
>
>   it's a classified ads service that
>   shows on a map where the seller is
>   (think craigslist + google maps)
>
>   plus it's 100% free :)


--~--~-~--~~~---~--~~
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: deseb installation in ubuntu

2007-10-10 Thread Xan



On Oct 9, 9:50 pm, Derek Anderson <[EMAIL PROTECTED]> wrote:
> well, is 7.04, site-packages is here:
> /usr/lib/python2.5/site-packages/
>

Well, not I put deseb directory here

> but your problem obviously precedes this.  did you muck with you
> manage.py file?

No, I did not touch manage.py. manage.py is:

#!/usr/bin/python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the
directory containing %r. It appears you've customized things.\nYou'll
have to run django-admin.py, passing it your settings module.\n(If the
file settings.py does indeed exist, it's causing an ImportError
somehow.)\n" % __file__)
sys.exit(1)

if __name__ == "__main__":
execute_manager(settings)

My settings.py is:

# Django settings for analitzador project.

# Us de deseb
import deseb
# S'acaba l'us de deseb

DEBUG = True
TEMPLATE_DEBUG = DEBUG
[...]

So, what fails?
I don't know!

Thanks,
Xan.

>
> or, when you say "import setting.py", you're not literally typing
> "import setting.py" are you?  make sure you're not including the
> extension in your manage.py, or anywhere else you're calling it.  (same
> goes for DJANGO_SETTINGS_MODULE)
>
> derek
>
>
>
> Xan wrote:
> > Hi,
>
> > * I have installed django 0.96 in ubuntu 7.04 [http://
> > packages.ubuntu.com/gutsy/python/python-django] (when I run dpkg -l I
> > get version "0.96-1~feisty1")
>
> > * I want to install deseb and I follow installation instructions
> > [http://code.google.com/p/deseb/wiki/Installation]
>
> > * The problem is that, after I do import als setting.py, I get the
> > following error:
>
> > python manage.py runserver
> > Error: Can't find the file 'settings.py' in the directory containing
> > 'manage.py'. It appears you've customized things.
> > You'll have to run django-admin.py, passing it your settings module.
> > (If the file settings.py does indeed exist, it's causing an
> > ImportError somehow.)
>
> > * I think that the problem is that I don't know where is
> > "/site-packages".  I created the directory  "site-
> > packages" in /usr/share/python/ and I put "deseb" as a subdirectory
>
> > Where is the error?
>
> > Thanks in advance,
> > Xan.
>
> --
>   looking to buy or sell anything?
>
>  try:http://allurstuff.com
>
>   it's a classified ads service that
>   shows on a map where the seller is
>   (think craigslist + google maps)
>
>   plus it's 100% free :)


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



deseb installation in ubuntu

2007-10-09 Thread Xan

Hi,

* I have installed django 0.96 in ubuntu 7.04 [http://
packages.ubuntu.com/gutsy/python/python-django] (when I run dpkg -l I
get version "0.96-1~feisty1")

* I want to install deseb and I follow installation instructions
[http://code.google.com/p/deseb/wiki/Installation]

* The problem is that, after I do import als setting.py, I get the
following error:

python manage.py runserver
Error: Can't find the file 'settings.py' in the directory containing
'manage.py'. It appears you've customized things.
You'll have to run django-admin.py, passing it your settings module.
(If the file settings.py does indeed exist, it's causing an
ImportError somehow.)

* I think that the problem is that I don't know where is
"/site-packages".  I created the directory  "site-
packages" in /usr/share/python/ and I put "deseb" as a subdirectory

Where is the error?

Thanks in advance,
Xan.


--~--~-~--~~~---~--~~
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: python script

2007-10-09 Thread Xan



On Oct 9, 6:50 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Tue, 2007-10-09 at 09:35 -0700, Xan wrote:
> > How?
>
> > I have my django app in:
> > /home/xan/anadoc/analitzador/
>
> > and my script in:
>
> > /home/xan/anadoc/transformacions/script.py
>
> > My script code is:
>
> > import os, sys
> > sys.path.append('/home/xan/anadoc/analitzador/')
> > os.environ['DJANGO_SETTINGS_MODULE'] = 'analitzador.settings'
> > from django.conf import settings
> > from analitzador.analisi.models import Centre
>
> > print Centre.objects.all()
>
> > but when I run it, I get:
> > python prova2.py
> > Traceback (most recent call last):
> >   File "prova2.py", line 5, in 
> > from analitzador.analisi.models import Centre
> > ImportError: No module named analitzador.analisi.models
>
> > but if I run in /home/xan/anadoc/ (super directory of my app) all
> > works
>
> Python automatically puts the current working directory into the paths
> it searchs (sys.path). So when you are in /home/xan/anadoc/, it gets
> added to the search path for imports, so "import analitzador" works.
>
> When you are in /home/xan/anadoc/transformacions/, "import analitzador"
> won't work unless you add /home/xan/anadoc to your python path. You have
> only added /home/xan/anadoc/analitzador/ to the search path, which
> doesn't help you here (although it does help you import things *inside*
> of analitzador/)
>
> Regards,
> Malcolm

Malcom, thanks for answering.
Changed sys.path.append('/home/xan/anadoc/analitzador') for
sys.path.append('/home/xan/anadoc')

:-)

Xan.


--~--~-~--~~~---~--~~
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: python script

2007-10-09 Thread Xan

How?

I have my django app in:
/home/xan/anadoc/analitzador/

and my script in:

/home/xan/anadoc/transformacions/script.py

My script code is:

import os, sys
sys.path.append('/home/xan/anadoc/analitzador/')
os.environ['DJANGO_SETTINGS_MODULE'] = 'analitzador.settings'
from django.conf import settings
from analitzador.analisi.models import Centre

print Centre.objects.all()


but when I run it, I get:
python prova2.py
Traceback (most recent call last):
  File "prova2.py", line 5, in 
from analitzador.analisi.models import Centre
ImportError: No module named analitzador.analisi.models

but if I run in /home/xan/anadoc/ (super directory of my app) all
works

Thanks,
Xan.

On Oct 3, 6:12 pm, "Joseph Heck" <[EMAIL PROTECTED]> wrote:
> just modify sys.path as you need...
>
> On 10/3/07, Xan <[EMAIL PROTECTED]> wrote:
>
>
>
> > Inhttp://code.djangoproject.com/ticket/5534there is a howto for
> > doing that.
> > But it's only when the script is in the root project directory.
> > What happens if we want the script in other location? What line we
> > have to add?
>
> > Thanks a lot,
> > Xan.
>
> > On Sep 18, 8:27 pm, Horst Gutmann <[EMAIL PROTECTED]> wrote:
> > > You mean an error telling you that you need to set the
> > > DJANGO_SETTINGS_MODULE environment variable? Or something else?
>
> > > os.environ['DJANGO_SETTINGS_MODULE']='mysite.settings'
>
> > > right at the top of yourscript(after the #! and the import for os ;) )
> > > should solve this.
>
> > > Then you should probably also add the parent directory of your project
> > > to sys.path :-)
>
> > > - Horst
>
> > > Xan wrote:
> > > > Hi,
>
> > > > If we have the models models.py:
>
> > > > from django.db import models
>
> > > > class Poll(models.Model):
> > > > question = models.CharField(max_length=200)
> > > > pub_date = models.DateTimeField('date published')
>
> > > > class Choice(models.Model):
> > > > poll = models.ForeignKey(Poll)
> > > > choice = models.CharField(max_length=200)
> > > > votes = models.IntegerField()
>
> > > > [example extracted 
> > > > frohttp://www.djangoproject.com/documentation/tutorial01/]
>
> > > > how can I write apythonscriptfor create various polls?
>
> > > > I tried:
>
> > > > a.py:
>
> > > > #!/usr/bin/python
> > > > from mysite.polls.models import Poll
> > > > import datetime
>
> > > > i = 0
> > > > while i<4:
> > > > a = str(i)
> > > > print a
> > > > Poll.create(question=a, data=datetime.date.today())
> > > > i = i+1
>
> > > > but when I runpythona.py in bash, there are problems with imports.
> > > > What lines of imports we need for running a standalonepythonscript?
>
> > > > Thanks in advance,
> > > > Xan.
>
> > > > PS: There is no doc in official site mentioning that. Maybe good to
> > > > add it to site.


--~--~-~--~~~---~--~~
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: python script

2007-10-03 Thread Xan

In http://code.djangoproject.com/ticket/5534 there is a howto for
doing that.
But it's only when the script is in the root project directory.
What happens if we want the script in other location? What line we
have to add?

Thanks a lot,
Xan.

On Sep 18, 8:27 pm, Horst Gutmann <[EMAIL PROTECTED]> wrote:
> You mean an error telling you that you need to set the
> DJANGO_SETTINGS_MODULE environment variable? Or something else?
>
> os.environ['DJANGO_SETTINGS_MODULE']='mysite.settings'
>
> right at the top of yourscript(after the #! and the import for os ;) )
> should solve this.
>
> Then you should probably also add the parent directory of your project
> to sys.path :-)
>
> - Horst
>
> Xan wrote:
> > Hi,
>
> > If we have the models models.py:
>
> > from django.db import models
>
> > class Poll(models.Model):
> > question = models.CharField(max_length=200)
> > pub_date = models.DateTimeField('date published')
>
> > class Choice(models.Model):
> > poll = models.ForeignKey(Poll)
> > choice = models.CharField(max_length=200)
> > votes = models.IntegerField()
>
> > [example extracted 
> > frohttp://www.djangoproject.com/documentation/tutorial01/]
>
> > how can I write apythonscriptfor create various polls?
>
> > I tried:
>
> > a.py:
>
> > #!/usr/bin/python
> > from mysite.polls.models import Poll
> > import datetime
>
> > i = 0
> > while i<4:
> > a = str(i)
> > print a
> >     Poll.create(question=a, data=datetime.date.today())
> > i = i+1
>
> > but when I runpythona.py in bash, there are problems with imports.
> > What lines of imports we need for running a standalonepythonscript?
>
> > Thanks in advance,
> > Xan.
>
> > PS: There is no doc in official site mentioning that. Maybe good to
> > add it to site.


--~--~-~--~~~---~--~~
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: Add field in models django 0.96

2007-09-29 Thread Xan

Hi,

It worked but I HAVE A PROBLEM:
After done it, the database have strange caracters: it displays
"Convocatòria" instead of "Convocatòria"
I presume that it's an encoding problem. How can I solve that?

Please, anwer me
Xan.

On Sep 26, 11:33 pm, DJango Fett <[EMAIL PROTECTED]> wrote:
> Here are the steps I would use to add a field to an existing model
> without having to write your own SQL and without the risk of getting
> your model code out of sync with your database table.  This code uses
> the same objects in the Tutorial 
> onhttp://www.djangoproject.com/documentation/0.96/tutorial01/.
> Open up a Command Prompt window and change the drive/directory to your
> project.  Then do something similar to the following:
>
> > python manage.py dumpdata polls > polls.json
> > python manage.py sqlclear polls > polls_drop.sql
> > mysql -u root -p pypoll < polls_drop.sql
>
> enter your password for the root user (change for your specific
> username)
>
> edit mysite/polls/models.py and add the field to the Poll model
>
> > python manage.py syncdb
> > python manage.py loaddata polls.json
>
> Hope this helps.
>
> On Sep 25, 2:41 pm, Xan <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I use django 0.96. I have a simple model and I just want to add one
> > field to my existing model. How can I do that? I think that I can't do
> > that without SQL code. But unfortunely I don't know it.
>
> > Anyone could give me a example of SQL code for adding one field to one
> > model?
>
> > If I only have the solution to upgrade to django-cvs, how can I pass
> > all my data from django 0.96 models to svn django models?
>
> > Thanks in advance,
> > Xan.


--~--~-~--~~~---~--~~
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: Add field in models django 0.96

2007-09-28 Thread Xan

Sorry so,
I will try it.

Thank you very much for your support,
Xan.

On Sep 28, 2:48 pm, DJango Fett <[EMAIL PROTECTED]> wrote:
> I am using 0.96 version too.  I tested the steps I provided before I
> posted.  Check out the 0.96 documentation yourself about the loaddata
> option:http://www.djangoproject.com/documentation/0.96/django-admin/#loaddat...
>
> On Sep 27, 11:20 am, Xan <[EMAIL PROTECTED]> wrote:
>
> > On Sep 26, 11:33 pm, DJango Fett <[EMAIL PROTECTED]> wrote:
>
> > > Here are the steps I would use to add a field to an existing model
> > > without having to write your own SQL and without the risk of getting
> > > your model code out of sync with your database table.  This code uses
> > > the same objects in the Tutorial 
> > > onhttp://www.djangoproject.com/documentation/0.96/tutorial01/.
> > > Open up a Command Prompt window and change the drive/directory to your
> > > project.  Then do something similar to the following:
>
> > > > python manage.py dumpdata polls > polls.json
> > > > python manage.py sqlclear polls > polls_drop.sql
> > > > mysql -u root -p pypoll < polls_drop.sql
>
> > > enter your password for the root user (change for your specific
> > > username)
>
> > > edit mysite/polls/models.py and add the field to the Poll model
>
> > > > python manage.py syncdb
> > > > python manage.py loaddata polls.json
>
> > > Hope this helps.
>
> > Okay, but I have 0.96 version (I have no loaddata option)
> > But, thanks very much,
> > Xan.
>
> > > On Sep 25, 2:41 pm, Xan <[EMAIL PROTECTED]> wrote:
>
> > > > Hi,
>
> > > > I use django 0.96. I have a simple model and I just want to add one
> > > > field to my existing model. How can I do that? I think that I can't do
> > > > that without SQL code. But unfortunely I don't know it.
>
> > > > Anyone could give me a example of SQL code for adding one field to one
> > > > model?
>
> > > > If I only have the solution to upgrade to django-cvs, how can I pass
> > > > all my data from django 0.96 models to svn django models?
>
> > > > Thanks in advance,
> > > > Xan.


--~--~-~--~~~---~--~~
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: Add field in models django 0.96

2007-09-27 Thread Xan



On Sep 26, 11:33 pm, DJango Fett <[EMAIL PROTECTED]> wrote:
> Here are the steps I would use to add a field to an existing model
> without having to write your own SQL and without the risk of getting
> your model code out of sync with your database table.  This code uses
> the same objects in the Tutorial 
> onhttp://www.djangoproject.com/documentation/0.96/tutorial01/.
> Open up a Command Prompt window and change the drive/directory to your
> project.  Then do something similar to the following:
>
> > python manage.py dumpdata polls > polls.json
> > python manage.py sqlclear polls > polls_drop.sql
> > mysql -u root -p pypoll < polls_drop.sql
>
> enter your password for the root user (change for your specific
> username)
>
> edit mysite/polls/models.py and add the field to the Poll model
>
> > python manage.py syncdb
> > python manage.py loaddata polls.json
>
> Hope this helps.

Okay, but I have 0.96 version (I have no loaddata option)
But, thanks very much,
Xan.

>
> On Sep 25, 2:41 pm, Xan <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I use django 0.96. I have a simple model and I just want to add one
> > field to my existing model. How can I do that? I think that I can't do
> > that without SQL code. But unfortunely I don't know it.
>
> > Anyone could give me a example of SQL code for adding one field to one
> > model?
>
> > If I only have the solution to upgrade to django-cvs, how can I pass
> > all my data from django 0.96 models to svn django models?
>
> > Thanks in advance,
> > Xan.


--~--~-~--~~~---~--~~
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: Add field in models django 0.96

2007-09-26 Thread Xan

Thanks, what the equivalent in mysql?

Meanwhile, I think I will try patch to 0.96 found in
http://code.djangoproject.com/wiki/SchemaEvolutionDocumentation

Thanks another time,
Xan.


On Sep 26, 12:27 am, Joe <[EMAIL PROTECTED]> wrote:
> The easiest way to to this is look at the create table SQL generated
> by the manager.
>
> python manage.py --settings=my_settings sql my_app
>
> Then, run the appropriate query once you know the datatype created
> when you added the column.
>
> For example, in postgres:
>
> ALTER TABLE myapp_mymodel ADD COLUMN mycol INT NOT NULL;
>
> On Sep 25, 2:41 pm, Xan <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I use django 0.96. I have a simple model and I just want to add one
> > field to my existing model. How can I do that? I think that I can't do
> > that without SQL code. But unfortunely I don't know it.
>
> > Anyone could give me a example of SQL code for adding one field to one
> > model?
>
> > If I only have the solution to upgrade to django-cvs, how can I pass
> > all my data from django 0.96 models to svn django models?
>
> > Thanks in advance,
> > Xan.


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



Add field in models django 0.96

2007-09-25 Thread Xan

Hi,

I use django 0.96. I have a simple model and I just want to add one
field to my existing model. How can I do that? I think that I can't do
that without SQL code. But unfortunely I don't know it.

Anyone could give me a example of SQL code for adding one field to one
model?

If I only have the solution to upgrade to django-cvs, how can I pass
all my data from django 0.96 models to svn django models?

Thanks in advance,
Xan.


--~--~-~--~~~---~--~~
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: python script

2007-09-19 Thread Xan

Yes, I refering to that.
Many thanks,
Xan.

PS: There is a ticket for that, that "officially" say that you
say. ;-)
http://code.djangoproject.com/ticket/5534

On Sep 18, 8:27 pm, Horst Gutmann <[EMAIL PROTECTED]> wrote:
> You mean an error telling you that you need to set the
> DJANGO_SETTINGS_MODULE environment variable? Or something else?
>
> os.environ['DJANGO_SETTINGS_MODULE']='mysite.settings'
>
> right at the top of your script (after the #! and the import for os ;) )
> should solve this.
>
> Then you should probably also add the parent directory of your project
> to sys.path :-)
>
> - Horst
>
> Xan wrote:
> > Hi,
>
> > If we have the models models.py:
>
> > from django.db import models
>
> > class Poll(models.Model):
> > question = models.CharField(max_length=200)
> > pub_date = models.DateTimeField('date published')
>
> > class Choice(models.Model):
> > poll = models.ForeignKey(Poll)
> > choice = models.CharField(max_length=200)
> > votes = models.IntegerField()
>
> > [example extracted 
> > frohttp://www.djangoproject.com/documentation/tutorial01/]
>
> > how can I write a python script for create various polls?
>
> > I tried:
>
> > a.py:
>
> > #!/usr/bin/python
> > from mysite.polls.models import Poll
> > import datetime
>
> > i = 0
> > while i<4:
> > a = str(i)
> > print a
> >     Poll.create(question=a, data=datetime.date.today())
> > i = i+1
>
> > but when I run python a.py in bash, there are problems with imports.
> > What lines of imports we need for running a standalone python script?
>
> > Thanks in advance,
> > Xan.
>
> > PS: There is no doc in official site mentioning that. Maybe good to
> > add it to site.


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



python script

2007-09-18 Thread Xan

Hi,

If we have the models models.py:

from django.db import models

class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')

class Choice(models.Model):
poll = models.ForeignKey(Poll)
choice = models.CharField(max_length=200)
votes = models.IntegerField()

[example extracted fro http://www.djangoproject.com/documentation/tutorial01/]

how can I write a python script for create various polls?

I tried:

a.py:

#!/usr/bin/python
from mysite.polls.models import Poll
import datetime

i = 0
while i<4:
a = str(i)
print a
Poll.create(question=a, data=datetime.date.today())
i = i+1


but when I run python a.py in bash, there are problems with imports.
What lines of imports we need for running a standalone python script?

Thanks in advance,
Xan.

PS: There is no doc in official site mentioning that. Maybe good to
add it to site.


--~--~-~--~~~---~--~~
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: Setting "blank" to one Field?

2007-09-16 Thread Xan

I suppose that it were exists. Because if we put no value in the
database in one ForeignKey (in admin mode), then we could revert the
value to blank. Internally I don't know how store blank values (if
null is not True), but I think that it could be set someway

Well, thanks,
I will change all my blank=True for null=True

Thanks a lot,
Xan.

On Sep 16, 12:33 am, Collin Grady <[EMAIL PROTECTED]> wrote:
> There is no such thing as blank, especially on a ForeignKey.
>
> blank=True has absolutely nothing to do with the database, as the
> documentation for it clearly states :)
>
> It merely makes it so you can give it no value in form validation,
> like in admin.


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



Setting "blank" to one Field?

2007-09-14 Thread Xan

Hi,

Following the database API reference (http://www.djangoproject.com/
documentation/db-api/):

 If a ForeignKey field has null=True set (i.e., it allows
NULL values), you can assign None to it. Example:

 e = Entry.objects.get(id=2)
 e.blog = None
 e.save() # "UPDATE blog_entry SET blog_id = NULL ...;"

I want to know what is equivalent to Blank? That is, how to set
e.blog to blank if blank=True?

Thanks,
Xan.


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



Deleting the relations and not the objects?

2007-09-13 Thread Xan

hi,

Suppose for example that we have:

class Aclass(models.Model):
be = models.ForeignKey('B')
ce = models.ManytoManyfield('C')

class B(models.Model):
   [...]

class C(models.Model):
  [...]

Suppose that with admin interface, I put:
be = b1 (b1 is B)
ce has c1, c2, c3 objects (c1, c2 and c3 are in C)

in an object p (p in Aclass)

I want to delete the relation that ce has c1 without deleting c1.
How can I do that with shell?

Do you understand that I want? If I run:
p = Aclass.objects.get(pk=1) # p is the object I have
p.be.all()
   b1
p.ce.all()
   c1, c2, c3

I want that p.ce.all() will be empty set, but c1, c2 and c3 exits as
intances of class C


Thanks in advance,
Xan.


--~--~-~--~~~---~--~~
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: Performance for django for years

2007-09-10 Thread Xan

Thanks.
Now, I will use PositiveSmallIntegerField
I don't need a whole PositiveIntegerField (1900-->2100) and I want to
compare years

Thanks a lot,
Xan.

PS: Greg, yes there are lot of documentation, but it's more technical.
Web site of django offers a good tutorial, good for "anybody". Rails
offers information for gurus or developers at least.


On Sep 9, 9:22 pm, Tim Chase <[EMAIL PROTECTED]> wrote:
> > Well, secondly I have one question: I have a model A that have a field
> > "year" that means the year that A was made. I just want to know if
> > it's best (for performance) to code as:
>
> > class A(models.Model):
> >  year = models.CharField(maxlength=4)
> > [...]
>
> > or
> > class A(models.Model):
> >  year = models.PossitiveIntegerField()
> > [...]
>
> > what it's the best for database performance (I use mysql)
>
> I don't think has considerable performances reasons to choose one
> over the other.  However, for sorting and validation purposes,
> you might want to go with the PositiveIntegerField (one "s" in
> "Positive").
>
> For sorting purposes, an integer field may be a tiny portion
> faster than the char field.
>
> You might even slap on some validators if your years don't extend
> too far back.  It's one thing if you're using years for dating
> early Judeo-Christian literature, where you might have valid
> years such as "214".  However, if all your years are recent-ish,
> you can toss a validator on your field to ensure, say, that the
> value is since 1900 or some other such limitation.
>
> I would lean towards validated PositiveIntegerField fields.
>
> -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
-~--~~~~--~~--~--~---



Performance for django for years

2007-09-09 Thread Xan

Hi,

Well, first of all, thank you for django. I'm not programmer and I
just wanted to code some web app easier as I can do. I tried rails but
there is no free documentation (almost all doc are books and books)
and there is no have easy way for writing models. With django I found
the easier way for doing it.

Well, secondly I have one question: I have a model A that have a field
"year" that means the year that A was made. I just want to know if
it's best (for performance) to code as:

class A(models.Model):
 year = models.CharField(maxlength=4)
[...]

or
class A(models.Model):
 year = models.PossitiveIntegerField()
[...]

what it's the best for database performance (I use mysql)

Thanks in advance,
Xan.


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