Re: Newbie sqlite3 dbshell confusion

2008-02-01 Thread Eduardo - IdNotFound

On Feb 1, 2008 10:03 AM, bobhaugen <[EMAIL PROTECTED]> wrote:
>
> On Jan 31, 10:38 am, Jeff Anderson <[EMAIL PROTECTED]> wrote:
> > My personal recommendation is to remove 0.96 and
> > use django-svn.
>
> Ok, I did that. Or tried to do that, anyway.
>
> 1. Removed 0.96.1.
> 2. did: svn co http://code.djangoproject.com/svn/django/trunk/ django-
> trunk
> 3. did: sudo ln -s /django-trunk/django /usr/lib/python2.5/site-
> packages/django
> 4. did: sudo ln -s /django-trunk/django/bin/django-admin.py /usr/local/
> bin
> 5. started python interpreter
> 6, typed: import django
> got error message:  ImportError: No module named django
>
> I also noticed that svn put django-trunk under my home directory -
> that's not where 0.96.1 was installed by the package manager.
>
> And the django symlinks in site-packages and /usr/local/bin say they
> are broken.
>
> So where did I go wrong?

Always use absolute paths when creating symbolic links. Sounds like it
should be something similar to "sudo ln -s
/home/YOUR_USER/django-trunk/django
/usr/lib/python2.5/site-packages/django" for you.

This should make the import wrok.


Hope it helps,
Eduardo.

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



Re: Newbie sqlite3 dbshell confusion

2008-01-31 Thread Eduardo - IdNotFound

Hello,

> But I thought sqlite3 came along with Python 2.5.  No?
>
> Any clues to what am I missing here?  Need to install something else?
> Path problems?
> Generic newbiness?

I don't think so. Anyway, it is as simple as installing package
"sqlite3" on your Ubuntu. If it's already there, even better.

You might also need the "python-sqlite2" package, which provide the
Python bindings for SQLite 3 (yeah, the version numbers look confusing
at first). I'm not sure how Django works with SQLite, but those are
the steps I took when installing Trac (I use Django with MySQL).
Shouldn't be much different, as both are written in Python.


Hope it helps,
Eduardo.

--~--~-~--~~~---~--~~
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: select_related() and Template Logic

2008-01-29 Thread Eduardo - IdNotFound

Hello,

On Jan 29, 2008 3:10 PM, theZero <[EMAIL PROTECTED]> wrote:
>
> > If I am not mistaken, {% if page.pods.all %} should evaluate to False
> > if there are no pods, so you can enclose your  with that and it
> > should work as you'd like.
>
> Thanks, Eduardo. That's a good idea, and that's where I was heading.
> It works in a way. But if I understand you correctly, if there's a pod
> in any block then all of the other blocks show their blank div's.
>
> For instance, if there's a pod in the leftcolumn block, but none in
> the rightcolumn block, then the leftcolumn block shows up as it
> should, but the rightcolumn block still shows a blank div. That's
> because page.pods.all is true. Does that make any sense?
>

I see, I guess I missed that part.

Template tags (or filters) is probably the way to go then. I haven't
looked much into these, but I believe you could pass page.pods to the
template tag, and let it filter them as you wish, printing out HTML or
defining a left_pods or right_pods variable you could then use.

This would probably to the trick, but I have no experience with it to
tell for sure. Just some basic docs knowledge.


Hope it helps,
Eduardo.

--~--~-~--~~~---~--~~
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: select_related() and Template Logic

2008-01-29 Thread Eduardo - IdNotFound

Hello,

On Jan 28, 2008 3:09 PM, theZero <[EMAIL PROTECTED]> wrote:
>
[introduction]
>
> Pages are called using select_related(), which retrieves the
> associated Pods. So in the template, I have several areas like this:
>
> {% block leftcolumn %}
> 
> {% for pod in page.pods.all %}
> {% ifequal pod.placement "left" %}
> 
> {{ pod.Title }}
> {{ pod.Content|escape|linebreaks }}
> 
> {% else %}
> {% endifequal %}
> {% endfor %}
> 
> {% endblock %}
>
> It works, but I definitely know it's not the best way to do it. I have
> two primary problems with it.
>
> First, if there are no items in that block, then I don't want to show
> that  on the page at all. How can I choose to
> display the contents of a block depending on if a pod exists that
> meets the select criteria? I know I'm missing something simple, but I
> can't put my finger on it.

If I am not mistaken, {% if page.pods.all %} should evaluate to False
if there are no pods, so you can enclose your  with that and it
should work as you'd like.

> Second, it is obviously and woefully inefficient to do this for
> several blocks on the page. I may have 5 or more, and I may want to
> add some in the future. Is this the place for a custom templatetag?
> Has someone already put something like this together?
>
> If I'm completely off-base and thinking about this wrong, let me know.
> I'm still learning!

I have no experience with this second issue. Sorry!


Hope it helps,
Eduardo.

--~--~-~--~~~---~--~~
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: ForeignKey with null=True gives 'may not be NULL' error

2008-01-23 Thread Eduardo - IdNotFound

Hello,

On Jan 23, 2008 11:17 PM, Wyley <[EMAIL PROTECTED]> wrote:
>
> Michael,
>
> Thanks for your reply!
>
> > Many databases will allow a constraint with a foreign key to be deferrable
> > and initially deferred so that you don't have to disable the relationship
> > to load data.
>
> Can you say a bit more about this?  I'm by no means an expert on
> databases; I'm not quite sure what "deferable" means.
>

I too have not quite understood this, and am now curious since I have
been using both blank=True and null=True on ForeignKeys, but haven't
had an error so far.

To me, the original problem felt like the database wasn't in sync with
the model (allowing NULL), but apparently that's not the case?

Also, the docs[1] have a section describing field options in which it
states that it applies to all fields. It comes right before the
descriptions for ForeignKey and ManyToMany, but it is where it defined
help_text, verbose_name and other fields that, in fact, do apply to
ForeignKeys as well. So that kind of confuses me.

Is it really the case that null=True is not allowed for ForeignKeys?


[1] http://www.djangoproject.com/documentation/model-api/#field-options


Thanks in advance,
Eduardo.

--~--~-~--~~~---~--~~
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: InnoDB on?

2008-01-22 Thread Eduardo - IdNotFound

Hello,

As far as I know, InnoDB is only the default storage engine for MySQL
on Windows. For UNIX/Linux, it is still MyISAM. Changing that should
be as simple as adding the following line to you my.cnf on the
[mysqld] and/or [mysqld_safe] sections:

default-storage-engine=innodb

Also, make sure any "skip-innodb" lines which may be on your my.cnf
file are commented out.

I personally used the official GUI (avaible on Ubuntu on the
mysql-admin package) to set that, as I too had troubles finding an
easy and comprehensive tutorial for this in the past, but this should
hopefully be enough.


Hope it helps,
Eduardo "IdNotFound"


On Jan 22, 2008 5:08 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> I need InnoDB for MySQL to do row locking in hopes of this working
> efficiently.
>
> Is InnoDB on by default in MySQL 5.0?
>
> How can I tell?
>
> I need to create a my.cnf to set it up as the engine to use if it
> isn't active, right? Any good resources on that?
>
> Thanks,
> Ivan

--~--~-~--~~~---~--~~
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: should I uninstall/reinstall? how? ubuntu specific quetion

2007-12-19 Thread Eduardo - IdNotFound

On Dec 20, 2007 1:06 AM, pug2694328 <[EMAIL PROTECTED]> wrote:
>
> However, when delving into tutorials they keep referring to the
> subversion version of Django.

As someone already pointed out, docs for 0.96 are avaiable on the website.


> How do I uninstall all versions of Django on my Ubuntu Linux box?
> How do I then install the subversion version and keep it updated?

Uninstalling a package in Ubuntu can be made with the following
command on a terminal:
sudo apt-get remove package_name


I believe instructions for the subversion installation are avaiable on
the Django website. You might need to install the "subversion" package
in Ubuntu, and it should be enough. If you still have problems, write
back.

FWIW, I am running the development server from Django SVN on Ubuntu
Feisty (7.04). Everything works fine and I only had to install by hand
Django itself. Other dependencies (such as Python, MySQL and MySQLdb)
I got from Ubuntu's repositories. I use MySQL, so I haven't checked
the versions for PostgreSQL, but they should be fine too.


Hope it helps,
Eduardo "IdNotFound"

--~--~-~--~~~---~--~~
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: Standard python objects in request.session possible?

2007-12-15 Thread Eduardo - IdNotFound

Hello again,

It seems I hit the wrong spot. I went reading on __iter__ (which I
admit I didn't know) and even though I'm not sure I understood it
right, I guess your next() method probably _was_ being executed and it
was all fine. So my new guess is that templates cannot modify objects
(as in, save them back) :-)

If that is true (which I'm too new to Django to know for sure, but
makes sense), it would explain why it works on the shell and not on
templates. You see the emptied object, but the template cannot save it
back to the session.

So right now what would make sense is to empty the object at the start
of every request. Not sure how feasible that is (better yet, how to
automate it, which is something you will obviosuly want/need), but I'm
sure the nice fellows from this list or IRC channel could easily point
it out (or at least tell you if it is not possible) or even provide a
better solution/explanation :-))

I'll post back if I think of something. Right now, I share you dead end :-((


-- IdNotFound


On Dec 16, 2007 1:19 AM, itpaul <[EMAIL PROTECTED]> wrote:
>
> Hello Ed, thanks for the quick response.
>
> Tried putting m.next but i don't think thats allowed in templates. It
> doesn't work anyway.
>
>{% if request.session.good_message_box %}
> 
> {% for m in request.session.good_message_box %}
>   {{ m.next }}   <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> {% endfor %}
> 
> {% endif %}
>
>
>
> I can't use the included messaging system because I need it to:
>
>  - work for unauthenticated users
>  - differentiate between different sorts of messages (good, bad,
> error, warning, etc)
>
>
>
>
>
> On Dec 16, 3:33 am, "Eduardo - IdNotFound" <[EMAIL PROTECTED]>
> wrote:
> > Sounds like you're not updating/removing items from the MessageBox
> > object, as I don't see where you are removing items from the list (I
> > see no calls to MessageBox.next() being made).
> >
> > Alternatively, wouldn't the messaging system in the Authentication
> > framework fit your needs? Your implementation highly resembles it...
> >
> > Hope it helps,
> > IdNotFound
> >
>
> > On Dec 15, 2007 11:13 PM, itpaul <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > > This model works in the shell. It holds messages and pops items off as
> > > it iterates:
> >
> > > class MessageBox:  # also tried with (models.Model)
> >
> > > def __init__(self, sort='neutral'):
> > > self.sort = sort
> > > self.messages = []
> >
> > > def __iter__(self):
> > > return self
> >
> > > def next(self):
> > > if len(self.messages) == 0:
> > > raise StopIteration
> > > return self.messages.pop()
> >
> > > I have this in my view to add a MessageBox object to the session and
> > > then add a message to it:
> >
> > > if 'good_message_box' not in request.session:
> > > request.session['good_message_box'] = MessageBox(sort='good')
> > > request.session['good_message_box'].messages.append('MessageBox:
> > > You have successfully logged in.')
> >
> > > I have this in my template to dispaly the messages:
> >
> > > {% if request.session.good_message_box %}
> > > 
> > > {% for m in request.session.good_message_box %}
> > > {{ m }}
> > > {% endfor %}
> > > 
> > > {% endif %}
> >
> > > However, unlike the shell behaviour which lists and deletes messages,
> > > the template lists and retains the messages resulting in them
> > > displaying repeatedly on every page (the template code is part of my
> > > base template). Its as if my iterator is being ignored. I have tried
> > > file based sessions and db based.
> >
> > > Am I missing something or can you not utilise objects in
> > > request.session?
>
> >
>

--~--~-~--~~~---~--~~
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: Standard python objects in request.session possible?

2007-12-15 Thread Eduardo - IdNotFound

Sounds like you're not updating/removing items from the MessageBox
object, as I don't see where you are removing items from the list (I
see no calls to MessageBox.next() being made).

Alternatively, wouldn't the messaging system in the Authentication
framework fit your needs? Your implementation highly resembles it...


Hope it helps,
IdNotFound


On Dec 15, 2007 11:13 PM, itpaul <[EMAIL PROTECTED]> wrote:
>
> This model works in the shell. It holds messages and pops items off as
> it iterates:
>
> class MessageBox:  # also tried with (models.Model)
>
> def __init__(self, sort='neutral'):
> self.sort = sort
> self.messages = []
>
> def __iter__(self):
> return self
>
> def next(self):
> if len(self.messages) == 0:
> raise StopIteration
> return self.messages.pop()
>
>
>
> I have this in my view to add a MessageBox object to the session and
> then add a message to it:
>
> if 'good_message_box' not in request.session:
> request.session['good_message_box'] = MessageBox(sort='good')
> request.session['good_message_box'].messages.append('MessageBox:
> You have successfully logged in.')
>
>
>
> I have this in my template to dispaly the messages:
>
> {% if request.session.good_message_box %}
> 
> {% for m in request.session.good_message_box %}
> {{ m }}
> {% endfor %}
> 
> {% endif %}
>
>
> However, unlike the shell behaviour which lists and deletes messages,
> the template lists and retains the messages resulting in them
> displaying repeatedly on every page (the template code is part of my
> base template). Its as if my iterator is being ignored. I have tried
> file based sessions and db based.
>
> Am I missing something or can you not utilise objects in
> request.session?

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