Re: Admin - click through to parent / child

2011-02-17 Thread Derek
On Feb 16, 7:22 pm, Alec  wrote:
> Hi,
>
> I'm wondering if there are any add-ons that show a list of children
> and give the ability to click through to parent or children records.
> I'm aware of the InlineAdmin feature, but I'm thinking of a non-
> editable list of children for all relations that automatically (i.e.
> no need to edit admin.py for each model) appears below the record you
> are currently editing.  For lookup/parent fields, where there is
> currently the drop down to select the parent, you would also be able
> to click the name to go directly to that parent record.
>
> Any ideas?  Google didn't find me anything yet.

Closest I could find was this question:
http://stackoverflow.com/questions/4334302/django-best-way-for-simple-hierarchy

Maybe this is something that could be done in a Django app.  A
potential problem is that apps tend to shy away from having/using
templates; but I guess if this was based on standard Admin code, then
it could be do-able?

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



Database setting from a configuration file.

2011-02-17 Thread hollando
Hi, I tried to put database setting in a ConfigParser format file and
parse that file from command line.
I modified manage.py a little bit after loading setting, reinitial
DATABASES['default'] with my configure parameter.
However, when it comes to execute_manager, it gets data from
settings.py again.
Is there anyway I can have it load from configuration file? 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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



query set on a manytomany table

2011-02-17 Thread Bobby Roberts
I have a Manytomanyfield in a model called "registrants" on a
fieldname called locations.  It stores the person's facility values in
a table in the database in something called like
registrants_locations_values  (just as an example).


How can i do a query on the registrants_locations_values table since
it's not a model?

I'm trying something like this:

tms = registrants_locations_values.objects.filter(id=user.id)

but that is not working... how can i pull data from this Manytomany
table?


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



Re: ManyToMany problem

2011-02-17 Thread Karen Tracey
On Thu, Feb 17, 2011 at 5:01 AM, Amar  wrote:

> OK, I've created a barebone app which shows this problem, so if anyone
> can try this and duplicate, I'll report this as a bug (unless there is
> a problem wih my code)
> You can get it here http://rapidshare.com/files/448393624/problem.zip
>
> I'm using PostgreSQL database, so change accordingly (unless it only
> occurs when using PostgreSQL, which I doubt).
>

In fact I suspect the behavior is likely observed only on PostgreSQL, due to
your queryset having no ordering defined. In that case PostgreSQL often will
return the same element for different OFFSET values (any DB could do this,
but PostgreSQL is the only one where I've seen it happening regularly).

This ticket describes the problem:

http://code.djangoproject.com/ticket/9006

Fix is to force force an ordering on the queryset or turn it into a list
before indexing into it.

Karen
-- 
http://tracey.org/kmt/

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



Re: How to reinstall Python Interpreters?

2011-02-17 Thread Mike Ramirez
On Thursday, February 17, 2011 04:48:31 pm LJ wrote:
> I installed the latest version of dajaxice, but I am still getting
> Unresolved import errors.
> My guess is that I need to remove and reinstall the Python
> Interpreters.
> Is there a some documentation somewhere that explains how to reinstall
> the Python Interpreters, so I can resolve all of my Unresolved Import
> errors?

I would first and foremost check out the PYTHONPATH [1] and make sure that is 
all kosher.  This is something very important to understand about python. 

defining kosher as the modules you are trying to import are located within the 
PYTHONPATH.  By default the packages should been installed by to site-packages 
within the python lib dir.

in *nix this is normally /usr/lib/python$VERSION}/site-packages i.e. 
/usr/lib/python2.6/site-packages/ for python 2.6

in Windows this would be C:\Python${VERSION}\Lib\site-packages

the python interpretter will search these by default for 3rd party modules and 
install them to this directory if using python install or easy_install/pip 

If your modules still aren't importing correctly make sure that if you do have 
different versions of python installed then you're using the one you installed 
it with.

if you installed the broken modules to another path, you'll need to set the 
PYTHONPATH manually in your environment.

After all this, if it's still broken (and youre 100% you've done this all 
correctly), then reinstall according to your operating systems needs.

*note apple/macs have a default interpretter that's apple specific and in the 
past people have installed pythong from macports. if you've done this, go back 
and make sure you're using the correct python interpretter version, or 
reinstall your broken modules with this version. *DISCLAIMER: I do not use or 
own a mac, this is mostly hersay and you can find other posts on this list or 
blogs for macs." 

IF none of this fixes your problem (which I doubt you should get here, unless 
you just don't understand your operating system), reinstall python according 
to the operating system in question, i.e. in  redhat use yum reinstall python, 
apt-get for ubuntu/debian, for windows use the installer from python.org, mac 
I'm not sure for macs what is best, see disclaimer above,


[1] http://docs.python.org/using/cmdline.html#envvar-PYTHONPATH
-- 
People need good lies.  There are too many bad ones.
-- Bokonon, "Cat's Cradle" by Kurt Vonnegut, Jr.

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



Re: How to reinstall Python Interpreters?

2011-02-17 Thread Shawn Milochik

On 02/17/2011 07:48 PM, LJ wrote:

I installed the latest version of dajaxice, but I am still getting
Unresolved import errors.
My guess is that I need to remove and reinstall the Python
Interpreters.
Is there a some documentation somewhere that explains how to reinstall
the Python Interpreters, so I can resolve all of my Unresolved Import
errors?

Why is that your guess? Exactly what is failing to import properly? What 
operating system are you on? What version of Python are you using?



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



How to reinstall Python Interpreters?

2011-02-17 Thread LJ
I installed the latest version of dajaxice, but I am still getting
Unresolved import errors.
My guess is that I need to remove and reinstall the Python
Interpreters.
Is there a some documentation somewhere that explains how to reinstall
the Python Interpreters, so I can resolve all of my Unresolved Import
errors?

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



Re: Initial data in forms

2011-02-17 Thread YomGuy
Sorry I'm tired. Got it !

collection = MediaCollection.objects.get(public_id=public_id)
form = MediaCollectionForm(instance=collection)

2011/2/18 YomGuy 

> Hi !
>
> I need to get initial data in a form.
> Do I have to use a formset or is there any method to fill a form coming
> from a model item with existing data ?
>
> Thank for help
> G
>
>

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



Initial data in forms

2011-02-17 Thread YomGuy
Hi !

I need to get initial data in a form.
Do I have to use a formset or is there any method to fill a form coming from
a model item with existing data ?

Thank for help
G

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



select_related with latest svn (15560)

2011-02-17 Thread Sneaky Wombat
Is anyone having a problem displaying foreign key fields in the
admin?  If I include a foreign key in the list_display of the admin
model that controls my db model, it won't display any rows.  I did
some debug sleuthing and discovered if I commented out two lines (seen
below), everything displays fine.  I'm sure this isn't right now.
This worked on the 8th.  I updated to the latest svn today and this
came up.  Not sure what the deal is.

def select_related(self, *fields, **kwargs):
"""
Returns a new QuerySet instance that will select related
objects.

If fields are specified, they must be ForeignKey fields and
only those
related objects are included in the selection.
"""
depth = kwargs.pop('depth', 0)
if kwargs:
raise TypeError('Unexpected keyword arguments to
select_related: %s'
% (kwargs.keys(),))
obj = self._clone()
import pdb
pdb.set_trace()
if fields:
if depth:
raise TypeError('Cannot pass both "depth" and fields
to select_related()')
obj.query.add_select_related(fields)
# else:
# obj.query.select_related = True
if depth:
obj.query.max_depth = depth
return obj

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



Debugging automatic related database fetches

2011-02-17 Thread Mark
I have a large application where I make significant use of
select_related() to bring in related model data during each original
query.

As the application has grown, the select_related calls haven't
completely kept up, leaving a number of scenarios where Django happily
and kindly goes running off to the database to fetch related model
rows.  This significantly increases the number of database hits, which
I obviously don't want.

I've had some success in tracking these down by checking the queries
generated using the django.db.connection.queries collection, but some
remain unsolved.

I've tried to find a suitable location in the django code to raise an
exception in this scenario, making the tracking much easier, but tend
to get lost in the code.

Is anyone able to point me in the right direction for a suitable
location for this?

Thanks,

Mark.

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



Re: How to Auto fill fields on Save in Django Admin?

2011-02-17 Thread Matteius
OK well I've refactored my complete approach to be in line with Django
best practices and moved validation to validate_unique definitions.  I
started to rethink the Announcement too by implementing:

def clean_fields(self, exclude=['author',]):
""" Implement wrapper for clean_fields to exclude author so we
can fill in on save. """
super(Announcement, self).clean_fields(exclude)
# EndDef


The problem is that it doesn't seem to exclude this field and I still
get the error:

"This field is required."

On Feb 17, 1:55 pm, Matteius  wrote:
> Well I have it configured now so that the fields are editable but that
> when None a default value gets set, either the author=request.user
> (admin.py layer) and pub_date=datetime.now() when no value is
> specified.  I had to set (null=True, blank=True) for author in order
> to get past form field validation.  Then I had to also remove my own
> validation from the clean method (and move it to save) for:
>
>         if not self.author:
>             raise ValidationError('New Announcements require an Author
> be specified!')
>
> Because it is also a requirement that every Announcement have an
> author.  When I left this same code in the clean method, my saves
> would always fail until I specified an author in (advanced options)
> but now it can pass clean and still be validated against.  I still
> have an issue considering how to let people use the admin in a real
> world situation.  Is it even really desirable to have the option to
> edit who the Announcement is published_by?  Well in one sense yes
> because we work as teams, But entirely no also. for security.  You
> could add a last_modified field to set editable=False to always keep
> an eye on who last changed it, but even still a complete list would be
> better.  Better yet would be a system where folk didn't pull pranks
> like that.  Well I guess admin has history and I should perhaps
> eventually create history in my own custom form processing if that
> kind of monitoring is so important.
>
> Thanks again,
>
> Matt
>
> On Feb 17, 1:36 am, Chris Matthews  wrote:
>
>
>
> > Hi Matteius,
>
> > You must set blank=True in the model so that the form can be returned to 
> > you with those fields empty and then you fill it in the save().
>
> >     pub_date = models.DateTimeField(blank=True)
> >     author = models.ForeignKey(User, blank=True, verbose_name='Author')
>
> > Also read up on editable=False
>
> > Regards
> > Chris
>
> > -Original Message-
> > From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] 
> > On Behalf Of Matteius
> > Sent: 17 February 2011 08:47
> > To: Django users
> > Subject: How to Auto fill fields on Save in Django Admin?
>
> > I have an Announcement model that has two fields I want to auto-fill
> > in when they are left blank (they are required fields with normal
> > defaults).  I have the following Code (simplified data listing for
> > this post)  THe Problem is that when I go to save an Announement
> > in the admin with either of those fields blank it returns to the Add/
> > Edit Form with "This field is required." despite my code to try and
> > fill that in.  Clearly I'm missing how to do this, any advice?
>
> > class Announcement(models.Model):
> >     """ Represents an Announcement in the classcomm system. """
>
> >     # Data Model Fields
> >     pub_date = models.DateTimeField()
> >     author = models.ForeignKey(User, verbose_name='Author')
>
> >     def clean(self):
> >         """ Implement auto fill pub_date. """
> >         if not self.pub_date:
> >             self.pub_date = datetime.today()
> >         super(Announcement, self).clean()
> >     # EndDef
>
> >     def save(self):
> >         """ Implement auto fill pub_date. """
> >         if not self.pub_date:
> >             self.pub_date = datetime.today()
> >         super(Announcement, self).save()
> >     # EndDef
> > # EndClass
>
> > Then in admin.py I have:
>
> > class AnnouncementAdmin(admin.ModelAdmin):
> >     """ Admin customizations for Announcement Models. """
> >     fieldsets = (
> >         (None, {
> >             'fields': ('headline', 'department', 'course', 'content')
> >         }),
> >         ('Advanced options', {
> >             'classes': ('collapse',),
> >             'fields': ('author', 'pub_date', 'make_global')
> >         }),
> >     )
>
> >     def save_model(self, request, obj, form, change):
> >         """ Autofill in author when blank on save models. """
> >         obj.author = request.user
> >         obj.save()
> >     # EndDef
>
> >     def save_formset(self, request, form, formset, change):
> >         """ Autofill in author when blank on save formsets. """
> >         instances = formset.save(commit=False)
> >         for instance in instances:
> >             instance.author = request.user
> >             instance.save()
> >         formset.save_m2m()
> >     # EndDef
> > # EndClass
>
> > Regards,
> > Matt
>
> > --
> > You received th

Re: Displaying a table and make its columns sortable

2011-02-17 Thread Shawn Milochik
On Thu, Feb 17, 2011 at 4:44 PM, Arun K.Rajeevan  wrote:

> Show me the django way to do this.
>


The "Django" way to do this is to learn basic programming skills. You
originally asked a mess of random questions which didn't have anything
to do with Django. We answered anyway. Now you're basically us to
write your application logic for you.

You'll get much more helpful responses when your requests indicate
you've actually tried to do something and run into a problem.

Shawn

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



LOGIN_REDIRECT_URL from urls.py?

2011-02-17 Thread galago
Is it possible to make value of LOGIN_REDIRECT_URL from my urls.py? I don't 
wan't to hardcode it.
I don't want to pass next in my url. Maybe there is another way to redirect 
to my reverse('index')?

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



Re: how to get attribute of intermediary model?

2011-02-17 Thread Daniel Roseman
On Thursday, February 17, 2011 10:06:40 PM UTC, Margie Roginski wrote:
>
> Thanks for your reply, Daniel.  I didn't give my example specifically 
> enough.  In my particular case I actually have a handle to the Person 
> and actually don't need all the join dates for all the people in that 
> group.  I just need that person's join date. 
>
> I can see that it is easy to get all membership info for a given 
> group, but I'm guessing that my original solution is the appropriate 
> solution for getting the join date for just a single person? 
>
> Margie 


No, because you're doing a lot of extra selecting and iterating that you 
don't need to. You can still do it in a single go:

Membership.objects.get(person=person, group__name='beatles').join_date

I often find that apparently difficult queries become a lot simpler if you 
approach them from the other direction - from the Membership rather than the 
Group, in this instance.
--
DR.

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



Re: how to get attribute of intermediary model?

2011-02-17 Thread Margie Roginski
Thanks for your reply, Daniel.  I didn't give my example specifically
enough.  In my particular case I actually have a handle to the Person
and actually don't need all the join dates for all the people in that
group.  I just need that person's join date.

I can see that it is easy to get all membership info for a given
group, but I'm guessing that my original solution is the appropriate
solution for getting the join date for just a single person?

Margie

On Feb 16, 2:05 am, Daniel Roseman  wrote:
> On Wednesday, February 16, 2011 12:36:49 AM UTC, Margie Roginski wrote:
>
> > Say I am using an intermediary model like that in the doc:
>
> > class Person(models.Model):
> >     name = models.CharField(max_length=128)
>
> > class Group(models.Model):
> >     name = models.CharField(max_length=128)
> >     members = models.ManyToManyField(Person, through='Membership')
>
> > class Membership(models.Model):
> >     person = models.ForeignKey(Person)
> >     group = models.ForeignKey(Group)
> >     date_joined = models.DateField()
>
> > For a given group, say I want to go through the persons in the group
> > and print the date each joined the group.
>
> > beatles = Group.objects.get(name="beatles")
> > for person in group.members.all():
> >    # get join date for person
>
> > What's the best way to do this?  It seems to me that I have to add a
> > related_name to the person field of Membership like this:
>
> >     person = models.ForeignKey(Person, related_name="memberships")
>
> > and then traverse backward from the person back to the membership,
> > filtering to find the correct membership based on the group name.  Can
> > someone tell me if there is a better way?  So I'm thinking I have to
> > do this:
>
> > beatles = Group.objects.get(name="beatles")
> > for person in group.members.all():
> >   joinDate = person.memberships.filter(group_name="beatles")
> > [0].date_joined
>
> > Thanks for any pointers,
>
> > Margie
>
> It's easier than that. You can get all memberships for a group in one go:
>
>     memberships =
> Membership.objects.filter(group__name="beatles").select_related()
>     for m in memberships:
>         print m.person.name, m.date_joined
>
> --
> DR.

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



Re: Unit Testing: temporarily altering django settings

2011-02-17 Thread Phlip
On Feb 17, 12:03 pm, Cody Django  wrote:

> For example, I have a captcha that is used in parts of a site that
> affects form logic.
> The django settings has a variable CAPTCHA = True, which acts as a
> switch.
>
> I'd like to change this setting in the setup for each TestCase.

You should use a mock object, to fake a-priori things like stochastic
user input.

Python's mock library has a 'patch.object' feature which mocks a
method on a class, even before objects of that class are instantiated.

In most of your setUp calls, patch the captcha handler to trivially
pass it, without real user input.

To test the captcha, mock it to pass or fail.

--
  Phlip
  http://c2.com/cgi/wiki?ZeekLand

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



Re: Displaying a table and make its columns sortable

2011-02-17 Thread Arun K.Rajeevan
I think, I'm not clear in first place.
My confusion revolve around following
1) The table that I display is not constitute a single model from
django application.
It combine two models from django application and data returned from a
web-service.

Since web-service included in the recipe, it make me confuse.

For an example,

class TableOne(models.Model):
qID = models.IntegerField(unique = True)
x= CharField(max_length = 20)
# and so on...

class TableTwo(models.Model):
zID = models.IntegerField(unique = True)
x= CharField(max_length = 20)
# and so on...

Now, what I want is display a table which combines TableOne and
TableTwo and shows, ID (for which show qID and zID), x, and foo and
bar
And this foo and bar comes from two web-service calls one specific to
get an object with zID and another for qID.
with a single call with zID I get both foo and bar.

(I used web2py before, there, I get an SQLTABLE which is a
representation of model in table form, where for tasks like this I
apply a virtual field to retrieve foo and bar automatically. And use
powerTable for pagination of models. May be I'm looking for something
like this, that's why I'm confused.)

Show me the django way to do this.

On Feb 18, 2:31 am, Tim Sawyer  wrote:
> On 17/02/11 20:18, Arun K.Rajeevan wrote:
>
>
>
> > I've a table which stores unique ids for an object that I've to retrieve
> > via SOAP( I've a url to a WSDL file) service calls.
> > This table also contains some details like last access to this object
> > from application etc.
>
> > *What I need very badly and urgently:*
> > I've to display a few items from this table + data retrieved from the
> > SOAP service per unique ids in the table into a  
> > And columns must be sortable and there's a drop down list for filtering
> > too. probably I need pagination too.
> > Since, all the data is not in my applications table and comes from SOAP
> > service, I'm confused about it.
>
> > How should I go about it?
>
> > I can think of something like, there'll be custom methods in the table,
> > which retrieves each item that need to be displayed from SOAP service.
> > (Con: This will need so many SOAP service calls per item, where as I can
> > retrieve whole data in one go, here I need to get data and use only one
> > field from it. ), and from what I know, if I use custom methods, then
> > table columns will not be sortable.
>
> > I'm not a django expert. so please consider this while answering.
>
> As has been said, you're probably better of doing this with
> JavaScript/jQuery.
>
> I'd suggest looking at some jQuery plugins, such as:
>
> http://tablesorter.com/docs/http://plugins.jquery.com/project/PicNetTableFilter
>
> 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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Displaying a table and make its columns sortable

2011-02-17 Thread Tim Sawyer

On 17/02/11 20:18, Arun K.Rajeevan wrote:

I've a table which stores unique ids for an object that I've to retrieve
via SOAP( I've a url to a WSDL file) service calls.
This table also contains some details like last access to this object
from application etc.

*What I need very badly and urgently:*
I've to display a few items from this table + data retrieved from the
SOAP service per unique ids in the table into a  
And columns must be sortable and there's a drop down list for filtering
too. probably I need pagination too.
Since, all the data is not in my applications table and comes from SOAP
service, I'm confused about it.

How should I go about it?

I can think of something like, there'll be custom methods in the table,
which retrieves each item that need to be displayed from SOAP service.
(Con: This will need so many SOAP service calls per item, where as I can
retrieve whole data in one go, here I need to get data and use only one
field from it. ), and from what I know, if I use custom methods, then
table columns will not be sortable.

I'm not a django expert. so please consider this while answering.


As has been said, you're probably better of doing this with 
JavaScript/jQuery.


I'd suggest looking at some jQuery plugins, such as:

http://tablesorter.com/docs/
http://plugins.jquery.com/project/PicNetTableFilter

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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Displaying a table and make its columns sortable

2011-02-17 Thread Shawn Milochik
This sounds like a good time to use jQuery. If all the data is being
displayed at once anyway, then it'll be faster and easier to do the
filtering and sorting client-side.

Even if you're talking about a lot of data, things like the
click-sorting of table columns should probably be done with
JavaScript, not be reloading the entire page.

The pagination you'll have to handle with CSS. That may be annoying to
do, depending on whether you can reliably assume that x number of
records constitute a page.

However, none of this has much of to do with Django. It's just general
Web development stuff.

Shawn

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



How to pivot a table?

2011-02-17 Thread Phlip
Djangoists:

I have a database table like this...

  red, 1
  red, 2
  red, 15
  blue, 18
  blue, 20

...and I want to read it into an array like this:

  [ ['red', [1,2,15]], ['blue', [18,20]], ]

Of course I can use values_list('color', 'number'), and then re-pack
the array with a for-loop.

Do QuerySet aggregations and annotations offer some way to push that
query into the database?

--
  Phlip
  http://c2.com/cgi/wiki?ZeekLand

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



Displaying a table and make its columns sortable

2011-02-17 Thread Arun K.Rajeevan
I've a table which stores unique ids for an object that I've to retrieve via 
SOAP( I've a url to a WSDL file) service calls.
This table also contains some details like last access to this object from 
application etc.

*What I need very badly and urgently:*
I've to display a few items from this table + data retrieved from the SOAP 
service per unique ids in the table into a  
And columns must be sortable and there's a drop down list for filtering too. 
probably I need pagination too.
Since, all the data is not in my applications table and comes from SOAP 
service, I'm confused about it.

How should I go about it?

I can think of something like, there'll be custom methods in the table, 
which retrieves each item that need to be displayed from SOAP service. (Con: 
This will need so many SOAP service calls per item, where as I can retrieve 
whole data in one go, here I need to get data and use only one field from 
it. ), and from what I know, if I use custom methods, then table columns 
will not be sortable.

I'm not a django expert. so please consider this while answering. 

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



Unit Testing: temporarily altering django settings

2011-02-17 Thread Cody Django
For example, I have a captcha that is used in parts of a site that
affects form logic.
The django settings has a variable CAPTCHA = True, which acts as a
switch.

I'd like to change this setting in the setup for each TestCase.  The
regular unittests tests (in which we are assuming the captcha is off)
will not be affected, since their testcase has ensured that the
CAPTCHA setting is set to False.  The captcha app unittests will be
able to test the new form logic, since their testcase has set the
CAPTCHA setting to True.

I thought I'd be able to simply use a setattr, but apparently it's not
so easy.

Is the only solution to create a new testrunner that actually sets up
a different environment (with different settings) for each app?

Thanks,

Cody

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



Re: How to Auto fill fields on Save in Django Admin?

2011-02-17 Thread Matteius
Well I have it configured now so that the fields are editable but that
when None a default value gets set, either the author=request.user
(admin.py layer) and pub_date=datetime.now() when no value is
specified.  I had to set (null=True, blank=True) for author in order
to get past form field validation.  Then I had to also remove my own
validation from the clean method (and move it to save) for:

if not self.author:
raise ValidationError('New Announcements require an Author
be specified!')

Because it is also a requirement that every Announcement have an
author.  When I left this same code in the clean method, my saves
would always fail until I specified an author in (advanced options)
but now it can pass clean and still be validated against.  I still
have an issue considering how to let people use the admin in a real
world situation.  Is it even really desirable to have the option to
edit who the Announcement is published_by?  Well in one sense yes
because we work as teams, But entirely no also. for security.  You
could add a last_modified field to set editable=False to always keep
an eye on who last changed it, but even still a complete list would be
better.  Better yet would be a system where folk didn't pull pranks
like that.  Well I guess admin has history and I should perhaps
eventually create history in my own custom form processing if that
kind of monitoring is so important.

Thanks again,

Matt

On Feb 17, 1:36 am, Chris Matthews  wrote:
> Hi Matteius,
>
> You must set blank=True in the model so that the form can be returned to you 
> with those fields empty and then you fill it in the save().
>
>     pub_date = models.DateTimeField(blank=True)
>     author = models.ForeignKey(User, blank=True, verbose_name='Author')
>
> Also read up on editable=False
>
> Regards
> Chris
>
>
>
> -Original Message-
> From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
> Behalf Of Matteius
> Sent: 17 February 2011 08:47
> To: Django users
> Subject: How to Auto fill fields on Save in Django Admin?
>
> I have an Announcement model that has two fields I want to auto-fill
> in when they are left blank (they are required fields with normal
> defaults).  I have the following Code (simplified data listing for
> this post)  THe Problem is that when I go to save an Announement
> in the admin with either of those fields blank it returns to the Add/
> Edit Form with "This field is required." despite my code to try and
> fill that in.  Clearly I'm missing how to do this, any advice?
>
> class Announcement(models.Model):
>     """ Represents an Announcement in the classcomm system. """
>
>     # Data Model Fields
>     pub_date = models.DateTimeField()
>     author = models.ForeignKey(User, verbose_name='Author')
>
>     def clean(self):
>         """ Implement auto fill pub_date. """
>         if not self.pub_date:
>             self.pub_date = datetime.today()
>         super(Announcement, self).clean()
>     # EndDef
>
>     def save(self):
>         """ Implement auto fill pub_date. """
>         if not self.pub_date:
>             self.pub_date = datetime.today()
>         super(Announcement, self).save()
>     # EndDef
> # EndClass
>
> Then in admin.py I have:
>
> class AnnouncementAdmin(admin.ModelAdmin):
>     """ Admin customizations for Announcement Models. """
>     fieldsets = (
>         (None, {
>             'fields': ('headline', 'department', 'course', 'content')
>         }),
>         ('Advanced options', {
>             'classes': ('collapse',),
>             'fields': ('author', 'pub_date', 'make_global')
>         }),
>     )
>
>     def save_model(self, request, obj, form, change):
>         """ Autofill in author when blank on save models. """
>         obj.author = request.user
>         obj.save()
>     # EndDef
>
>     def save_formset(self, request, form, formset, change):
>         """ Autofill in author when blank on save formsets. """
>         instances = formset.save(commit=False)
>         for instance in instances:
>             instance.author = request.user
>             instance.save()
>         formset.save_m2m()
>     # EndDef
> # EndClass
>
> Regards,
> Matt
>
> --
> 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 
> athttp://groups.google.com/group/django-users?hl=en.

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



Re: PDF response using wkhtmltopdf.

2011-02-17 Thread Bill Freeman
The return value of Popen isn't the output of the program, but instead
is the class instance.  I believe that you could provide a cStringIO
instance as the 'stdout' keyword argument, and it would capture
the program's output.  You could them use its getvalue() method's
return value as your HttpResponse method's first arguemnt.

But you should also check the command response status, and return
your choice of error message if it fails.  I suspect that there's a Popen
method to wait for the process to complete and check it's status.

It's all in the Popen documentation, I'm sure, probably with examples.

Bill

On Wed, Feb 16, 2011 at 2:02 PM, juanefren  wrote:
> I am using wkhtmltopdf to create PDF files, how ever I don't know how
> to return them properly, docs says using a single dash instead of
> output file name will write that to stdout. But I don't realize how to
> return that content.
>
> I have been trying using subprocess.Popen this way:
>
> r = HttpResponse(Popen(command_args), mimetype='application/pdf')
> r['Content-Disposition'] = 'filename=my_file_name.pdf'
> return r
>
> But I am not getting the result.
>
> The only way I have managed to work is writting to file system in
> media folder, and then redirect to the url based file, but this way
> doesn't look good.
>
> Thanks in advance.
>
> --
> 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.
>
>

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



Re: Problems Adding Django South Tool

2011-02-17 Thread hank23
Thanks for the help. I found the problem and now I have my migration
file(s) and I'm ready to migrate.

On Feb 17, 12:07 pm, Shawn Milochik  wrote:
> On Thu, Feb 17, 2011 at 11:26 AM, hank23  wrote:
> > Ok I added the southtut app to my installed apps after creating its
> > folder, but now when I enter this command:
>
> > python manage.py schemamigration southtut --initial
>
> > I get this:
>
> > Unknown command: 'schemamigration'
>
> Same answer as before; you need to add south itself to your INSTALLED_APPS.
>
> If that doesn't work (or you're just curious), open a Python or
> iPython command line and type 'import south.' If it works, you've
> probably installed South properly.
>
> Shawn

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



Re: External Javascript Files

2011-02-17 Thread David De La Harpe Golden
On 17/02/11 17:44, hank23 wrote:
> Is it possible to use external javascript files with a django app?

Certainly - The django admin itself does it, for example, bundling
a version of jquery and a bunch of stuff in admin/media/js/

> If
> so what folder does the javascript file need to be placed in? 

Patterns followed by reusable apps:

The "new way" is to note the "staticfiles" django app [1] for managing
static files is apparently being rolled into django 1.3 for dealing with
such things.  Stick to its expectations (see its docs), and you could
maybe use the addon for 1.2 [1], then migrate to the 1.3 bundled [2]
version when the time comes.

An "old" way (as seen in the <= 1.2 admin*) withoutusing that app is to
bundle them in some subdirectory distributed as part of the app (say
myapp/static/), then write a custom templatetag (say
{%myapp_static_prefix%}) that reads a setting (say
settings.MYAPP_STATIC) for a url prefix, then tell users of myapp to set
up their web server one way or another to serve out that directory** or
a copy of it somewhere or other, and tell them to set the setting to
point at it wherever they're serving from. So say the user serves out
your apps' static files at
http://static.example.com/blah/myapp/
then they set the setting
MYAPP_STATIC = "http://static.example.com/blah/myapp/";
and your template tag reads that setting, then in myapp templates you can do
{% load myapp_tags %}

Android mail? (Re: [tueysuezseftali:76683] [android-developers] Select mp3 to play?)

2011-02-17 Thread Nick Arnett
Anybody on django-users know why this mail is coming to our group?  It's
strange - the "To" header is android-developers, but the reply-to is
django-users.

I can't quite tell if it is a Google Groups problem or the person posting (
nikola1...@gmail.com).

Nick

On Thu, Feb 17, 2011 at 8:47 AM, vnv  wrote:

> Hi,
>
> I would like to enable my user to select mp3 or whatever sound file he
> want's to to play it as designated alarm sound.
>
> Is there any intent-alike thingy that I could call and user would
> browse selection and select, after which I could have path to the
> existing file.
>
> Tnx for help in advance.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-develop...@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>
> --
> 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.
>
>

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



Re: django CMS 2.1.2 released

2011-02-17 Thread Javier Nievas
Great!

I'll need to remove the patch I did to make it work... :-)


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



Re: site styling works with development server but not apache

2011-02-17 Thread Ashish Agarwal
Progress!! I had to add

Alias /adminmedia "/usr/lib/pymodules/python2.6/django/contrib/admin/media"

and set ADMIN_MEDIA_PREFIX to the same url /adminmedia/

I don't understand everything yet, and will probably have more problems
soon. But at least I got this far. Thanks for all the help!!

On Thu, Feb 17, 2011 at 1:10 PM, Mike Ramirez  wrote:

>  On Thursday, February 17, 2011 09:23:47 am you wrote:
>
> > I'm still having trouble. My directory structure is:
>
> >
>
> > /usr/local/www/static
>
> >
>
> > +- contrib/admin/media -- symlink to django/contrib/admin/media
>
> >
>
> > +- media/admin/base_site.html -- modified version of base_site.html
>
> >
>
> > I've tried every combination of the following, but nothing is working:
>
> >
>
> All you need here is the /usr/local/www/static any subdirectories here
> should be served as normal, like http://localhost/contrib/admin/media
>
> The admin template, You do not want it here. it should be in your template
> dir see the doc below this for that.
>
>
> http://docs.djangoproject.com/en/1.2/intro/tutorial02/#customize-the-admin-look-and-feel
>
> > DocumentRoot /usr/local/www/static
>
> > - does this need to be set at all?
>
> >
>
> No.
>
>  > Alias /media/ /usr/loca/www/static/...
>
> > - not quite sure which directory this should point to
>
> > - I've tried all sensible options, but none work
>
> >
>
> Should be the absolute path to where you store your project media.
>
> > ADMIN_MEDIA_PREFIX = '/media/'
>
> > - Does this simply have to be equal to whatever URL is used in the Alias
>
> > directive above?
>
> >
>
> It needs to be another alias to the absolute path of the adminmedia.
>
> > Thank you.
>
> >
>
>  Ok, this is a setup I have working (when the site/backend isn't broken
> ;)), This one is meant to work with nginx as a gateway serving my media and
> proxying back to my apache config, but it should work fine without nginx.
> This is also mod_wsgi specific, but you can add mod_python settings.
>
>  Please read the comments, domain is the domain of this box. $USER is the
> username on the system. (these removed for security reasons).
>
>  
>
> # basics for named based virtual hosts
>
> ServerName priss.domain.com
>
> ServerAlias domain.homelinux.org
>
> ServerAdmin webmas...@domain.com
>
>  # this is the root url path.
>
> # I believe this can be omitted.. graham can verify or deny
>
> # either way it works as expected with this set
>
> ServerPath /
>
>  # custom log paths.
>
> ErrorLog
> /home/$USER/Server_Files/httpd/domain_com/apache/priss.domain.com.error_log
>
> CustomLog
> /home/$USER/Server_Files/httpd/domain_com/apache/priss.domain.com.access_log
> combined
>
>  # mod wsgi settings.
>
> # adjust threads per system.
>
> # wrap with the IfModule so I can also add mod_python directives
>
> # and let apache decide what to used based on the module loaded/used.
>
> 
>
> WSGIDaemonProcess blog user=$USER group=$USER threads=100
>
> WSGIDaemonProcess pastebin user=$USER group=$USER threads=100
>
>  # paster
>
> # this is a custom pastebin project that is served on a
>
> # subpath of the main url. this comes first before the main site
>
> # is served so that the main projects urls.py does not search
>
> # for this path
>
> # please note this is a completely different project served
>
> # as part of the main site.
>
> # (no control over subdomains on this box).
>
> #
>
>  WSGIScriptAlias /paster
> /home/srv/$USER/web/projects/pastebin/apache/paster.wsgi
>
>  
>
> # to make sure this runs in it's own interpretter.
>
> WSGIApplicationGroup pastebin
>
> Order deny,allow
>
> Allow from all
>
> 
>
>  # this is the main project/site served on the root of the urls path
>
> .
>
> WSGIScriptAlias / /home//srv/$USER/gufy/domain_com/apache/gm.wsgi
>
>  
>
> WSGIApplicationGroup blog
>
> Order deny,allow
>
> Allow from all
>
> 
>
>  
>
>  ### these are the parts you want.
>
>  # /media serves all my main projects media.
>
> # these do not conflict with WSGIScriptAlias
>
> # Alias has a higher precedence than WSGIScriptAlias.
>
> # MEDIA_ROOT = /var/www/htm/media
>
> #
>
> Alias /media /var/www/html/media
>
> 
>
> SetHandler None
>
> Order deny,allow
>
> Allow from all
>
> 
>
>  # this is the admin media.
>
> # ADMIN_MEDIA_URL = "/adminmedia/"
>
> # serves admin media for both projects.
>
> # /var/www/html/adminmedia is a copy of the django admin media found in
>
> # django/contrib/admin/media ... I'm not a fan of symlinks here.
>
> # But you can. make sure to set the right option.
>
> #
>
> Alias /adminmedia /var/www/html/adminmedia
>
> 
>
> SetHandler None
>
> Order deny,allow
>
> Allow from all
>
> 
>
>   # this handles all my paster projects media files.
>
> # like /media for the main project.
>
> Alias /paster/media /var/www/html/pastebinmedia
>
> 
>
> SetHandler None
>
> Order deny,allow
>
> Allow from all
>
> 
>
>  
>
>  HTH
>
> Mike
>
> --
>
> The closest to perfection a person ever comes is when he fills out a job
>
> application form.
>
> -- Stanley J. Randall

Re: site styling works with development server but not apache

2011-02-17 Thread Mike Ramirez
On Thursday, February 17, 2011 09:23:47 am you wrote:
> I'm still having trouble. My directory structure is:
> 
> /usr/local/www/static
> 
> +- contrib/admin/media -- symlink to django/contrib/admin/media
> 
> +- media/admin/base_site.html -- modified version of base_site.html
> 
> I've tried every combination of the following, but nothing is working:
> 

All you need here is the /usr/local/www/static  any subdirectories here should 
be served as normal, like http://localhost/contrib/admin/media

The admin template,  You do not want it here. it should be in your template 
dir see the doc below this for that.  

http://docs.djangoproject.com/en/1.2/intro/tutorial02/#customize-the-admin-
look-and-feel

> DocumentRoot /usr/local/www/static
> - does this need to be set at all?
> 

No.


> Alias /media/ /usr/loca/www/static/...
> - not quite sure which directory this should point to
> - I've tried all sensible options, but none work
> 

Should be the absolute path to where you store your project media.

> ADMIN_MEDIA_PREFIX = '/media/'
> - Does this simply have to be equal to whatever URL is used in the Alias
> directive above?
> 
 It needs to be another alias to the absolute path of the adminmedia.
> Thank you.
> 


Ok, this is a  setup I have working (when the site/backend isn't broken ;)), 
This one is meant to work with nginx as a gateway serving my media and 
proxying back to my apache config, but it should work fine without nginx. This 
is also mod_wsgi specific, but you can add mod_python settings.

  Please read the comments, domain is the domain of this box. $USER is the 
username on the system. (these removed for security reasons).



# basics for named based virtual hosts
ServerName priss.domain.com
ServerAlias domain.homelinux.org
ServerAdmin webmas...@domain.com

 # this is the root url path.
 # I believe this can be omitted.. graham can verify or deny
# either way it works as expected with this set
ServerPath /

 # custom log paths.
ErrorLog
/home/$USER/Server_Files/httpd/domain_com/apache/priss.domain.com.error_log
CustomLog   
/home/$USER/Server_Files/httpd/domain_com/apache/priss.domain.com.access_log 
combined

# mod wsgi settings.
# adjust threads per system.
 # wrap with the IfModule so I can also add mod_python directives 
 # and let apache decide what to used based on the module loaded/used.

WSGIDaemonProcess blog user=$USER group=$USER threads=100
WSGIDaemonProcess pastebin user=$USER group=$USER threads=100

# paster
# this is a custom pastebin project that is served on a 
# subpath of the main url. this comes first before the 
main site
# is served so that the main projects urls.py does not 
search
# for this path
# please note this is a completely different project 
served 
# as part of the main site.  
# (no control over subdomains on this box).
#

WSGIScriptAlias /paster 
/home/srv/$USER/web/projects/pastebin/apache/paster.wsgi


 # to make sure this runs in it's own 
interpretter.
WSGIApplicationGroup pastebin
Order deny,allow
Allow from all


# this is the main project/site served on the root of 
the urls path
.
WSGIScriptAlias / /home//srv/$USER/gufy/domain_com/apache/gm.wsgi


WSGIApplicationGroup blog
Order deny,allow
Allow from all




### these are the parts you want.

 # /media serves all my main projects media.
 # these do not conflict with WSGIScriptAlias
 # Alias has a higher precedence than WSGIScriptAlias.
 # MEDIA_ROOT = /var/www/htm/media
#
Alias /media /var/www/html/media

SetHandler None
Order deny,allow
Allow from all


 # this is the admin media.  
 # ADMIN_MEDIA_URL = "/adminmedia/"
 # serves admin media for both projects.
 # /var/www/html/adminmedia is a copy of the django admin media found 
in 
 # django/contrib/admin/media ... I'm not a fan of symlinks here. 
 # But you can.  make sure to set the right option.
#
Alias /adminmedia /var/www/html/adminmedia

SetHandler None
Order deny,allow
Allow from all



# this handles all my paster projects media files.
# like /media for the main project.
Alias /paster/media /var/www/html/pastebinmedia

SetHandler None
Order deny,allow
Allow from all





HTH

Mike
-- 
The closest to perfection a person ever comes is when he fills out a job
application form.
-- Stanley J. Randall

-- 
You receiv

Re: site styling works with development server but not apache

2011-02-17 Thread Ashish Agarwal
I'm using WSGI and tried your suggestion, but something is still missing.
The generated HTML refers for example to a stylesheet
href="/media/css/base.css". But this is in the django install directory,
which is not being served. So I feel there has to be an Alias pointing
there. Even if I did that, I'm confused about how I can overlay the modified
base_site.html that the tutorial had us construct. My full VirtualHost
configuration is:


ServerAdmin user@foo

Alias /media "/usr/local/www/static/media/"

Order allow,deny
Allow from all


WSGIScriptAlias / /usr/local/www/scripts/sequme.wsgi

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,

# alert, emerg.

LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined



Thanks for all the help!


On Thu, Feb 17, 2011 at 12:44 PM, Marcos Moyano wrote:

> This is the relevant VirtualHost configuration for admin media
>
> WSGI
> Alias /media "/usr/local/www/static/media/"
> 
> Order allow,deny
> Allow from all
> 
>
> MOD_PYTHON
>  
>SetHandler None
>   
>
> If this doesn't work perhaps you shoud could paste your VirtualHost
> configuration.
>
> Rgds,
> Marcos
>
>
>
> On Thu, Feb 17, 2011 at 2:23 PM, Ashish Agarwal wrote:
>
>> I'm still having trouble. My directory structure is:
>>
>> /usr/local/www/static
>> |
>> +- contrib/admin/media -- symlink to django/contrib/admin/media
>> |
>> +- media/admin/base_site.html -- modified version of base_site.html
>>
>> I've tried every combination of the following, but nothing is working:
>>
>> DocumentRoot /usr/local/www/static
>> - does this need to be set at all?
>>
>>  Alias /media/ /usr/loca/www/static/...
>> - not quite sure which directory this should point to
>> - I've tried all sensible options, but none work
>>
>> ADMIN_MEDIA_PREFIX = '/media/'
>> - Does this simply have to be equal to whatever URL is used in the Alias
>> directive above?
>>
>> Thank you.
>>
>>
>> On Thu, Feb 17, 2011 at 10:30 AM, Mike Ramirez wrote:
>>
>>>  On Thursday, February 17, 2011 07:14:16 am ashish wrote:
>>>
>>> > Hi all. I followed the tutorial to setup a basic django site and run
>>>
>>> > it with the development server. Everything looks fine. Then, I
>>>
>>> > configured to use apache. Everything seems to work except the styling.
>>>
>>> > The login and admin pages have no formatting. On IRC I was told the
>>>
>>> > issue is that the development server automatically serves the
>>>
>>> > necessary media, but that you have to explicitly configure apache to
>>>
>>> > serve static media.
>>>
>>> >
>>>
>>> > Okay, but which media needs to be served for the styling to work? I
>>>
>>> > have not found the answer in the docs. Thank you for any help.
>>>
>>>  normally the path assigned to MEDIA_ROOT and ADMIN_MEDIA ... see below
>>> for the configuration settings (pick your production environment)
>>>
>>> http://docs.djangoproject.com/en/1.2/howto/deployment
>>>
>>> Mike
>>>
>>> --
>>>
>>> If God had not given us sticky tape, it would have been necessary to
>>> invent it.
>>>
>>>  --
>>> 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.
>>>
>>
>>  --
>> 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.
>>
>
>
>
> --
> Some people, when confronted with a problem, think “I know, I'll use
> regular expressions.” Now they have two problems.
>
> Jamie Zawinski, in comp.emacs.xemacs
>
>  --
> 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.
>

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



Re: Problems Adding Django South Tool

2011-02-17 Thread Shawn Milochik
On Thu, Feb 17, 2011 at 11:26 AM, hank23  wrote:
> Ok I added the southtut app to my installed apps after creating its
> folder, but now when I enter this command:
>
> python manage.py schemamigration southtut --initial
>
> I get this:
>
> Unknown command: 'schemamigration'



Same answer as before; you need to add south itself to your INSTALLED_APPS.

If that doesn't work (or you're just curious), open a Python or
iPython command line and type 'import south.' If it works, you've
probably installed South properly.

Shawn

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



Re: External Javascript Files

2011-02-17 Thread hank23
Thanks. I'll take a look.

On Feb 17, 11:51 am, Marcos Moyano  wrote:
> you need to put it in your media folder.
>
> http://docs.djangoproject.com/en/1.2/howto/static-files/
>
> Rgds,
> Marcos
>
>
>
>
>
> On Thu, Feb 17, 2011 at 2:44 PM, hank23  wrote:
> > Is it possible to use external javascript files with a django app? If
> > so what folder does the javascript file need to be placed in? So far I
> > tried putting it in the bas folder of the app. I want to use it in and
> > it doesn't seem to work there if I reference it directly using only
> > just the filename in my javascript reference in the html file where I
> > call a function in my external file. So am I referencing it wrong or
> > do I need to put it in some other folder?
>
> > --
> > 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.
>
> --
> Some people, when confronted with a problem, think “I know, I'll use regular
> expressions.” Now they have two problems.
>
> Jamie Zawinski, in comp.emacs.xemacs- Hide quoted text -
>
> - Show quoted text -

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



Re: External Javascript Files

2011-02-17 Thread Marcos Moyano
you need to put it in your media folder.

http://docs.djangoproject.com/en/1.2/howto/static-files/

Rgds,
Marcos
On Thu, Feb 17, 2011 at 2:44 PM, hank23  wrote:

> Is it possible to use external javascript files with a django app? If
> so what folder does the javascript file need to be placed in? So far I
> tried putting it in the bas folder of the app. I want to use it in and
> it doesn't seem to work there if I reference it directly using only
> just the filename in my javascript reference in the html file where I
> call a function in my external file. So am I referencing it wrong or
> do I need to put it in some other folder?
>
> --
> 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.
>
>


-- 
Some people, when confronted with a problem, think “I know, I'll use regular
expressions.” Now they have two problems.

Jamie Zawinski, in comp.emacs.xemacs

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



External Javascript Files

2011-02-17 Thread hank23
Is it possible to use external javascript files with a django app? If
so what folder does the javascript file need to be placed in? So far I
tried putting it in the bas folder of the app. I want to use it in and
it doesn't seem to work there if I reference it directly using only
just the filename in my javascript reference in the html file where I
call a function in my external file. So am I referencing it wrong or
do I need to put it in some other folder?

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



Re: site styling works with development server but not apache

2011-02-17 Thread Marcos Moyano
This is the relevant VirtualHost configuration for admin media

WSGI
Alias /media "/usr/local/www/static/media/"

Order allow,deny
Allow from all


MOD_PYTHON
 
   SetHandler None
  

If this doesn't work perhaps you shoud could paste your VirtualHost
configuration.

Rgds,
Marcos



On Thu, Feb 17, 2011 at 2:23 PM, Ashish Agarwal wrote:

> I'm still having trouble. My directory structure is:
>
> /usr/local/www/static
> |
> +- contrib/admin/media -- symlink to django/contrib/admin/media
> |
> +- media/admin/base_site.html -- modified version of base_site.html
>
> I've tried every combination of the following, but nothing is working:
>
> DocumentRoot /usr/local/www/static
> - does this need to be set at all?
>
>  Alias /media/ /usr/loca/www/static/...
> - not quite sure which directory this should point to
> - I've tried all sensible options, but none work
>
> ADMIN_MEDIA_PREFIX = '/media/'
> - Does this simply have to be equal to whatever URL is used in the Alias
> directive above?
>
> Thank you.
>
>
> On Thu, Feb 17, 2011 at 10:30 AM, Mike Ramirez  wrote:
>
>>  On Thursday, February 17, 2011 07:14:16 am ashish wrote:
>>
>> > Hi all. I followed the tutorial to setup a basic django site and run
>>
>> > it with the development server. Everything looks fine. Then, I
>>
>> > configured to use apache. Everything seems to work except the styling.
>>
>> > The login and admin pages have no formatting. On IRC I was told the
>>
>> > issue is that the development server automatically serves the
>>
>> > necessary media, but that you have to explicitly configure apache to
>>
>> > serve static media.
>>
>> >
>>
>> > Okay, but which media needs to be served for the styling to work? I
>>
>> > have not found the answer in the docs. Thank you for any help.
>>
>>  normally the path assigned to MEDIA_ROOT and ADMIN_MEDIA ... see below
>> for the configuration settings (pick your production environment)
>>
>> http://docs.djangoproject.com/en/1.2/howto/deployment
>>
>> Mike
>>
>> --
>>
>> If God had not given us sticky tape, it would have been necessary to
>> invent it.
>>
>>  --
>> 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.
>>
>
>  --
> 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.
>



-- 
Some people, when confronted with a problem, think “I know, I'll use regular
expressions.” Now they have two problems.

Jamie Zawinski, in comp.emacs.xemacs

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



Re: site styling works with development server but not apache

2011-02-17 Thread Ashish Agarwal
I'm still having trouble. My directory structure is:

/usr/local/www/static
|
+- contrib/admin/media -- symlink to django/contrib/admin/media
|
+- media/admin/base_site.html -- modified version of base_site.html

I've tried every combination of the following, but nothing is working:

DocumentRoot /usr/local/www/static
- does this need to be set at all?

Alias /media/ /usr/loca/www/static/...
- not quite sure which directory this should point to
- I've tried all sensible options, but none work

ADMIN_MEDIA_PREFIX = '/media/'
- Does this simply have to be equal to whatever URL is used in the Alias
directive above?

Thank you.


On Thu, Feb 17, 2011 at 10:30 AM, Mike Ramirez  wrote:

>  On Thursday, February 17, 2011 07:14:16 am ashish wrote:
>
> > Hi all. I followed the tutorial to setup a basic django site and run
>
> > it with the development server. Everything looks fine. Then, I
>
> > configured to use apache. Everything seems to work except the styling.
>
> > The login and admin pages have no formatting. On IRC I was told the
>
> > issue is that the development server automatically serves the
>
> > necessary media, but that you have to explicitly configure apache to
>
> > serve static media.
>
> >
>
> > Okay, but which media needs to be served for the styling to work? I
>
> > have not found the answer in the docs. Thank you for any help.
>
>  normally the path assigned to MEDIA_ROOT and ADMIN_MEDIA ... see below
> for the configuration settings (pick your production environment)
>
> http://docs.djangoproject.com/en/1.2/howto/deployment
>
> Mike
>
> --
>
> If God had not given us sticky tape, it would have been necessary to invent
> it.
>
>  --
> 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.
>

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



Re: Problems Adding Django South Tool

2011-02-17 Thread hank23
Ok I added the southtut app to my installed apps after creating its
folder, but now when I enter this command:

python manage.py schemamigration southtut --initial

I get this:

Unknown command: 'schemamigration'

Which makes me wonder if I really do have South completely installed
ok, or if I need to be in a different directory to be able to execurte
it. Currently I'm trying to execute it I'm in the mysite directory
which has my settings.py, my templates folder and my app. folders. So
maybe I should where should I before I try to run the schemamigration
command? Any thoughts?

On Feb 17, 9:44 am, Michael  wrote:
> After you create the southtut app, you need to add it to
> settings.INSTALLED_APPS in order for Django to know about it.  If Django
> doesn't know about it, then South doesn't know about it.
>
> --
> Michael 
>
>
>
> On Thu, 2011-02-17 at 07:20 -0800, hank23 wrote:
> > I downloaded and installed Django's South DB tool apparently ok
> > because after installing it I went into the shell and was able to
> > import South ok with no errors. So then I added it to the end of the
> > list of installed apps and also ran syncdb. When I ran syncdb I didn't
> > get anything that looked like an error, however I did get a list of
> > items that it tried to sync and a message that looked like this:
>
> > Syncing...
> > No fixtures found.
>
> > Synced:
> >   > django.contrib.auth
> >   > django.contrib.contenttypes
> >   > django.contrib.sessions
> >   > django.contrib.sites
> >   > django.contrib.messages
> >   > django.contrib.admin
> >   > polls
> >   > south
>
> > Not synced (use migrations):
> > -
> > (use ./manage.py migrate to migrate these)
>
> > Then when I started the South tutorial and ran:
>
> > python manage.py startapp southtut
>
> > which created the new folder in my mysite directory for the new
> > southtut app. Then when I tried to run the schemamigration command
> > like this:
>
> > python manage.py schemamigration southtut --initial
>
> > I ultimately got this error:
>
> > django.core.exceptions.Improperlyconfigured: App with label southtut
> > could not be found
>
> > So since I think I followed all of the steps properly in the install
> > and then again also at the start of the first part of the South
> > tutorial what do I do now? Did I miss something somewhere? Thanks in
> > advance for the help.- Hide quoted text -
>
> - Show quoted text -

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



Missing Related Objects in MODEL._meta.get_all_related_objects

2011-02-17 Thread Martin Siniawski
Hey!

So we have a certain model which is related with many other models, by
ForeignKey fields set in those other models.

The setup is not particularly exotic, but for some reason, when
using ._meta.get_all_related_objects() on the model which has all the
ForeignKey fields pointing at it, some of the related objects that
should be returned are missing.

As a quick example, imagine that the Foo model is related to Bar1,
Bar2, Bar3,...,BarN, by ForeignKey fields defined in the Bar models.
For some reason, the get_all_related_objects method on Foo._meta is
not returning some of the objects of Bar1 and Bar3.

Do you have any ideas on what might be happening, or how to further
debug the problem?

Best and thanks!
Martin

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



Re: Problems Adding Django South Tool

2011-02-17 Thread Michael
After you create the southtut app, you need to add it to
settings.INSTALLED_APPS in order for Django to know about it.  If Django
doesn't know about it, then South doesn't know about it.

-- 
Michael 

On Thu, 2011-02-17 at 07:20 -0800, hank23 wrote:
> I downloaded and installed Django's South DB tool apparently ok
> because after installing it I went into the shell and was able to
> import South ok with no errors. So then I added it to the end of the
> list of installed apps and also ran syncdb. When I ran syncdb I didn't
> get anything that looked like an error, however I did get a list of
> items that it tried to sync and a message that looked like this:
> 
> Syncing...
> No fixtures found.
> 
> Synced:
>   > django.contrib.auth
>   > django.contrib.contenttypes
>   > django.contrib.sessions
>   > django.contrib.sites
>   > django.contrib.messages
>   > django.contrib.admin
>   > polls
>   > south
> 
> Not synced (use migrations):
> -
> (use ./manage.py migrate to migrate these)
> 
> Then when I started the South tutorial and ran:
> 
> python manage.py startapp southtut
> 
> which created the new folder in my mysite directory for the new
> southtut app. Then when I tried to run the schemamigration command
> like this:
> 
> python manage.py schemamigration southtut --initial
> 
> I ultimately got this error:
> 
> django.core.exceptions.Improperlyconfigured: App with label southtut
> could not be found
> 
> 
> So since I think I followed all of the steps properly in the install
> and then again also at the start of the first part of the South
> tutorial what do I do now? Did I miss something somewhere? Thanks in
> advance for the help.
> 
> 

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



Re: site styling works with development server but not apache

2011-02-17 Thread Mike Ramirez
On Thursday, February 17, 2011 07:14:16 am ashish wrote:
> Hi all. I followed the tutorial to setup a basic django site and run
> it with the development server. Everything looks fine. Then, I
> configured to use apache. Everything seems to work except the styling.
> The login and admin pages have no formatting. On IRC I was told the
> issue is that the development server automatically serves the
> necessary media, but that you have to explicitly configure apache to
> serve static media.
> 
> Okay, but which media needs to be served for the styling to work? I
> have not found the answer in the docs. Thank you for any help.



normally the path assigned to MEDIA_ROOT and ADMIN_MEDIA ... see below for the 
configuration settings (pick your production environment)

http://docs.djangoproject.com/en/1.2/howto/deployment

Mike
-- 
If God had not given us sticky tape, it would have been necessary to invent 
it.

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



Re: site styling works with development server but not apache

2011-02-17 Thread Tom Evans
On Thu, Feb 17, 2011 at 3:14 PM, ashish  wrote:
> Hi all. I followed the tutorial to setup a basic django site and run
> it with the development server. Everything looks fine. Then, I
> configured to use apache. Everything seems to work except the styling.
> The login and admin pages have no formatting. On IRC I was told the
> issue is that the development server automatically serves the
> necessary media, but that you have to explicitly configure apache to
> serve static media.
>
> Okay, but which media needs to be served for the styling to work? I
> have not found the answer in the docs. Thank you for any help.
>

http://docs.djangoproject.com/en/1.2/howto/deployment/modpython/#serving-the-admin-files

Cheers

Tom

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



Problems Adding Django South Tool

2011-02-17 Thread hank23
I downloaded and installed Django's South DB tool apparently ok
because after installing it I went into the shell and was able to
import South ok with no errors. So then I added it to the end of the
list of installed apps and also ran syncdb. When I ran syncdb I didn't
get anything that looked like an error, however I did get a list of
items that it tried to sync and a message that looked like this:

Syncing...
No fixtures found.

Synced:
  > django.contrib.auth
  > django.contrib.contenttypes
  > django.contrib.sessions
  > django.contrib.sites
  > django.contrib.messages
  > django.contrib.admin
  > polls
  > south

Not synced (use migrations):
-
(use ./manage.py migrate to migrate these)

Then when I started the South tutorial and ran:

python manage.py startapp southtut

which created the new folder in my mysite directory for the new
southtut app. Then when I tried to run the schemamigration command
like this:

python manage.py schemamigration southtut --initial

I ultimately got this error:

django.core.exceptions.Improperlyconfigured: App with label southtut
could not be found


So since I think I followed all of the steps properly in the install
and then again also at the start of the first part of the South
tutorial what do I do now? Did I miss something somewhere? Thanks in
advance for the help.


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



site styling works with development server but not apache

2011-02-17 Thread ashish
Hi all. I followed the tutorial to setup a basic django site and run
it with the development server. Everything looks fine. Then, I
configured to use apache. Everything seems to work except the styling.
The login and admin pages have no formatting. On IRC I was told the
issue is that the development server automatically serves the
necessary media, but that you have to explicitly configure apache to
serve static media.

Okay, but which media needs to be served for the styling to work? I
have not found the answer in the docs. Thank you for any help.

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



Re: Having trouble synchronizing the database, can someone help?

2011-02-17 Thread ofri
What you are looking for is:
python manage.py reset app_name

flush only deletes the data. reset also drops the tables and re-create
them.

On Feb 17, 7:41 am, Chen Xu  wrote:
> Sorry, I dont really understand how python manage.py sqlcustom  command
> works, can anyone give an example, I am trying to flush a database for one
> of my two apps.
>
> Thanks
>
> On Tue, Feb 15, 2011 at 12:33 AM, Szabo, Patrick (LNG-VIE) <
>
>
>
>
>
> patrick.sz...@lexisnexis.at> wrote:
> >  I think i rember reading in the doc that you can somehow run custom
> > sql...is that an option ?!
>
> > If this is something you don’t have to do regularly you could also just
> > connect to the db with some gui-client and delete the tables there
>
> > . . . . . . . . . . . . . . . . . . . . . . . . . .
>
> >  **
>
> > Patrick Szabo
> > XSLT-Entwickler
>
> > LexisNexis
> > Marxergasse 25, 1030 Wien
>
> > patrick.sz...@lexisnexis.at
>
> > Tel.: +43 (1) 534 52 - 1573
>
> > Fax: +43 (1) 534 52 - 146
>
> > *Von:* django-users@googlegroups.com [mailto:django-users@googlegroups.com]
> > *Im Auftrag von *Chen Xu
> > *Gesendet:* Dienstag, 15. Februar 2011 09:01
>
> > *An:* django-users@googlegroups.com
> > *Betreff:* Re: Having trouble synchronizing the database, can someone
> > help?
>
> > thanks, flush does help, but it delete everything, however I have 2 apps in
> > my db, so is there any commands (ex: sqlclear ) that allows me to
> > only remove the tables in particular app??
>
> > Thanks
>
> > On Mon, Feb 14, 2011 at 11:51 PM, Szabo, Patrick (LNG-VIE) <
> > patrick.sz...@lexisnexis.at> wrote:
>
> > I think sqlflush just prints the SQL-Statement.
>
> > Flush will actually du the job
>
> > Hope that helps !
>
> > . . . . . . . . . . . . . . . . . . . . . . . . . .
>
> > Patrick Szabo
> > XSLT-Entwickler
>
> > LexisNexis
> > Marxergasse 25, 1030 Wien
>
> > patrick.sz...@lexisnexis.at
>
> > Tel.: +43 (1) 534 52 - 1573
>
> > Fax: +43 (1) 534 52 - 146
>
> > *Von:* django-users@googlegroups.com [mailto:django-users@googlegroups.com]
> > *Im Auftrag von *Chen Xu
> > *Gesendet:* Dienstag, 15. Februar 2011 08:45
> > *An:* django-users@googlegroups.com
> > *Betreff:* Re: Having trouble synchronizing the database, can someone
> > help?
>
> > thanks very much everyone, but I just have one more small question.
>
> > I tried to use some python manage.py command to delete tables (ex:
> > sqlflush, sqlreset),
> > but they all just print out the sql statement without doing the real job,
> > so what is the command to do the actual removal of the tables?
>
> > 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
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.
>
> > --
> > ⚡ Chen Xu ⚡
>
> > --
> > 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.
>
> >  --
> > 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.
>
> --
> ⚡ Chen Xu ⚡

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



Re: Ajax form in django

2011-02-17 Thread Tom Evans
On Wed, Feb 16, 2011 at 3:16 PM, mf  wrote:
> Hi, the problem I'm having is that, when I submit the form, the
> response is placed in a new url(/feedback) instead of placing it in
> the actual(/results) url. The alert never gets executed.
>
> I guess I'm doing something wrong in the template but I can't find
> views.py:
> def ajax_feedback(request):
>    success = False
>    if request.method == "POST":
>        post = request.POST.copy()
>        if post.has_key('rel') and post.has_key('relp'):
>                rel = post['rel']
>                relp = post['relp']
>                q = post['query']
>                fq = post['full_query']
>                fq = fq[:350]
>                ip = request.META['REMOTE_ADDR']
>                feedback = FeedBack(q=q, ip_address=ip,
> user=request.user,
>                                    relevance=rel, rel_pages=relp,
> full_query=fq)
>                feedback.save()
>                success = True
>    if success == True:
>        return HttpResponse("Success")
>    else:
>        return HttpResponse("Error")
> results.html:
> 
>                               value="si" id="rel" /> Yes
>                               value="no" id="rel" /> No
>
>                               value="1-5" id="relp" /> 1-5 
>                               value="6-10" id="relp" /> 6-10
>                               value="{{ query }}">
>                               value="{{ bq }}">
>                               value="Send">
> 
> 
>            var create_note = function() {
>              var rel = $("#rel").val()
>              var relp = $("#relp").val()
>              var query = {{ query }}
>              var full_query = {{ bq }}
>               var data = { rel:rel, relp:relp, query:query,
> full_query:full_query };
>               var args = {
>                    type: "POST",
>                    url: "/feedback/",
>                    data: data,
>                    success: function(msg){
>                         alert(msg);
>                    }
>              $.ajax(args);
>              return false;
>            };
>            $("#create").click(create_note);
> 
> urls.py:
>    ...
>    (r'^feedback/$', views.ajax_feedback),
>    (r'^results/(?P.+)/$', views.results),
>    ...
>
> Thank you in advance for your answers,
>
> Mariano.
>

Clicking the submit button fires two events, click and (because it is
a submit input, not a button input) it also fires the form's submit
event. Since the form's submit event is not quashed, the form is
submitted.

You should be attaching your event handler to the form's submit event
handler, not to the button's click event handler. Changing the action
to be empty would be pointless, an empty action submits to the current
page.

Cheers

Tom

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



Re: Ajax form in django

2011-02-17 Thread Alendit
Try adding something like

$("#feedback_form").attr("action", "")

to your create_note function, so that action is reset if javascript
gets executed.

Alendit

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



Re: Toolbar for Django 1.3?

2011-02-17 Thread galago
That helped:)
New checkout fixed the problem :)

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



Re: Virtualenv django project created through ubuntu, checkout out to a windows machine not cross os compatible?

2011-02-17 Thread Tom Evans
On Thu, Feb 17, 2011 at 12:33 PM, mongoose  wrote:
> Hi,
>
> I've created a django project with virtualenv on my server. It is an
> Ubuntu server. I have checked it into svn. Now I'm on a windows
> machine and have checked out the project. I noticed however that the
> activate and deactivate scripts are in bash when created through linux
> and are .bat files in windows. Furthermore the pip on my windows
> machine is a exe file where on the project created through ubuntu it's
> not.
>
> My question then is: is there anyway to setup my windows environment
> so that I'm able to work from a windows machine (perhaps installing
> bash on windows or something), is there something I can do when
> creating the project through ubuntu to allow for this perhaps or will
> I be limited to working on this kind of project via linux?
>
> Question is also up on stackoverflow:
> http://stackoverflow.com/questions/502/virtualenv-django-project-created-through-ubuntu-checkout-out-to-a-windows-machi
>

You shouldn't be committing the environment to RCS, you should be
committing a script which creates the environment. For example, my
projects all contain a 'bootstrap' script which sets up the
environment and installs all required packages.

If you want to develop on windows and nix, then you would probably
need two scripts, one shell script for nix, one batch script for
windows. Functionally, they should do the same things:
invoke virtualenv to create the environment if it doesnt exist
invoke pip to install the required packages

Here is a nix bootstrap script:

#!/bin/sh

if [ ! -d "environ" ]; then
virtualenv environ
fi
ln -sf environ/bin/activate
. ./activate
pip install -r requirements.pip


Cheers

Tom

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



Virtualenv django project created through ubuntu, checkout out to a windows machine not cross os compatible?

2011-02-17 Thread mongoose
Hi,

I've created a django project with virtualenv on my server. It is an
Ubuntu server. I have checked it into svn. Now I'm on a windows
machine and have checked out the project. I noticed however that the
activate and deactivate scripts are in bash when created through linux
and are .bat files in windows. Furthermore the pip on my windows
machine is a exe file where on the project created through ubuntu it's
not.

My question then is: is there anyway to setup my windows environment
so that I'm able to work from a windows machine (perhaps installing
bash on windows or something), is there something I can do when
creating the project through ubuntu to allow for this perhaps or will
I be limited to working on this kind of project via linux?

Question is also up on stackoverflow:
http://stackoverflow.com/questions/502/virtualenv-django-project-created-through-ubuntu-checkout-out-to-a-windows-machi

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



Re: Toolbar for Django 1.3?

2011-02-17 Thread Russell Keith-Magee
On Thu, Feb 17, 2011 at 6:24 PM, galago  wrote:

> It doesn't work when I switch on the panel for SQL
> ('debug_toolbar.panels.sql.SQLDebugPanel',). Without that panel it works.
> That's error:
> TemplateSyntaxError at /
>
> Caught AttributeError while rendering: 'Cursor' object has no attribute 'db'
>
> If you're getting this error and you're using trunk, you've got a bug that
existed for about 2 days earlier this week.

If you update your checkout, this problem should be fixed.

Yours,
Russ Magee %-)

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



Re: Class-based views & authentication

2011-02-17 Thread Andre Terra
Reported!

http://code.djangoproject.com/ticket/15328


Sincerely,
André Terra

2011/2/16 Łukasz Rekucki 

> On 16 February 2011 19:46, Andre Terra  wrote:
> > I should also add that the functionality described in the docs simply did
> > not work for me:
> >
> http://docs.djangoproject.com/en/dev//topics/class-based-views/#decorating-the-class
> >
> > My attempt to follow that approach is registered here:
> > http://dpaste.com/hold/423359/
>
> It's an error in the docs. It should be:
>
> class ProtectedView(TemplateView):
>template_name = 'secret.html'
>
>@method_decorator(login_required)
>def dispatch(self, *args, **kwargs):
>return super(ProtectedView, self).dispatch(*args, **kwargs)
>
> You can report it to the bug tracker here:
> http://code.djangoproject.com/newticket
>
> Thanks.
>
> --
> Łukasz Rekucki
>
> --
> 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.
>
>

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



Re: Ordering/sort_by from a custom method

2011-02-17 Thread Andres Lucena
El jue, 10-02-2011 a las 07:44 -0800, Alex Robbins escribió:
> Wow, you are right. This is a tricky lookup. The generic relation
> makes it pretty tough. I'd just use the python sort unless you see a
> real performance problem.
> 
> class LinkGetTopScores(models.Manager):
> def get_top_score(self):
> return sorted(self.all(), key=lambda n: n.get_score)
> 
> Maybe you need to make it n.get_score(), instead of n.get_score in the
> lambda.
> 

Sorry for no answering this before. 

Nop, this didn't work either :(

The solution I'll try then is with SQL, something similar to this and
the get_top method: 
http://stackoverflow.com/questions/544597/problem-ordering-by-votes-with-django-voting

Thank you for your help Alex. 

Bye,
Andres

> 
> Alex
> 
> On Feb 10, 8:54 am, Andres Lucena  wrote:
> > On Thu, Feb 10, 2011 at 2:52 PM, Alex Robbins
> >
> >  wrote:
> > > Do you want the episode with the highest individual score, or the
> > > highest average score?
> >
> > I want the links (within that episode) sorted by highest score.
> >
> > (Sorry for no making it clear before)
> >
> > Thank you,
> > Andres
> >
> >
> >
> >
> >
> >
> >
> > > Alex
> >
> > > On Thu, Feb 10, 2011 at 7:41 AM, Andres Lucena  
> > > wrote:
> > >> On Thu, Feb 10, 2011 at 2:29 PM, Alex Robbins
> > >>  wrote:
> > >>> Yeah, you'll definitely want to find some aggregate to do the sorting.
> >
> > >> Ok, didn't know it. I'll take a look at it...
> >
> > >>> The only way to sort by a custom method is doing an in-python sort,
> > >>> which is going to be much slower than having the db sort for you.
> >
> > >> Yeah, I tought so but it seems (to me) the only way of doing this...
> >
> > >>>  If you post the score models, we could probably help more.
> >
> > >> The score models are from django-voting:
> >
> > >>http://django-voting.googlecode.com/svn/trunk/voting/models.py
> > >>http://django-voting.googlecode.com/svn/trunk/voting/managers.py
> >
> > >> Thanks for the help!
> >
> > >> Andres
> >
> > >>> Alex
> >
> > >>> On Feb 9, 8:49 am, "Casey S. Greene"  wrote:
> >  I haven't used django-voting but it sounds to me like you want 
> >  something
> >  like:
> >  Link.objects.aggregate(Avg(score = 'vote__score')).order_by('score')
> >
> >  If I recall correctly you can chain aggregate and order_by.
> >
> >  Anyway, that example and this link should get you started at 
> >  least:http://docs.djangoproject.com/en/dev/topics/db/aggregation/
> >
> >  Hope this helps!
> >  Casey
> >
> >  On Wed, 2011-02-09 at 10:08 +0100, Andres Lucena wrote:
> >  > On Tue, Feb 8, 2011 at 6:00 PM, Andres Lucena 
> >  >  wrote:
> >  > > Dear Gurus,
> >
> >  > > I've made a custom method for getting the score (from 
> >  > > django-voting)
> >  > > for a giving Model:
> >
> >  > > class Link(models.Model):
> >  > >episode = models.ForeignKey("Episode", related_name="links")
> >  > >url = models.CharField(max_length=255, unique=True, 
> >  > > db_index=True)
> >
> >  > >def __unicode__(self):
> >  > >return self.url
> >
> >  > >def get_score(self):
> >  > >return Vote.objects.get_score(self)['score']
> >
> >  > > Now I want to make a custom manager to getting the top-scored links
> >  > > for the given episode. AFAIK, you can't sort by a custom method, so
> >  > > I'm trying to apply the ordering through sorted(), like this links
> >  > > says:
> >
> >  > >http://stackoverflow.com/questions/981375/using-a-django-custom-model...
> >  > >http://stackoverflow.com/questions/883575/custom-ordering-in-django
> >
> >  > > So, what I have now is this:
> >
> >  > > class LinkGetTopScores(models.Manager):
> >  > >def get_top_score(self):
> >  > >return sorted(self.filter(episode=self.episode), key=lambda 
> >  > > n:
> >  > > n.get_score)
> >
> >  > > class Link(models.Model):
> >  > >episode = models.ForeignKey("Episode", related_name="links")
> >  > >url = models.CharField(max_length=255, unique=True, 
> >  > > db_index=True)
> >  > >get_top_score = LinkGetTopScores()
> >  > > 
> >
> >  > > So of course this isn't working because of the self.episode 
> >  > > stuff...
> >  > > But I've to filter somehow by episode (the ForeignKey), and I don't
> >  > > know how. Is there anyway of doing this?? What I'm doing is right 
> >  > > or
> >  > > there would be an easier way of doing this?
> >
> >  > I noticed that the .filter isn't necesary, so now I have this:
> >
> >  > class LinkGetTopScores(models.Manager):
> >  > def get_top_score(self):
> >  > return sorted(self.all(), key=lambda n: n.get_score)
> >
> >  > But it don't sort by score, and I don't know what I'm doing wrong :S
> >
> >  > Any idea?
> >
> >  > Thanks,
> >  > Andres
> >
> >  > > Thank you,
> >  > > Andres
> >
> > >>>

Re: Toolbar for Django 1.3?

2011-02-17 Thread Mike Ramirez
On Thursday, February 17, 2011 02:40:20 am Daniel Hilton wrote:
> On 17 February 2011 10:34, galago  wrote:
> > I run my sever on localhost (manage.py runserver).
> > Is there any way to display all queries in console or somewhere else?
> 
> Yes, if you install dcramer's devserver, which is a straight
> replacement for the runserver command.
> 
> More info and install guide here:
> https://github.com/dcramer/django-devserver
> 
> Or using pip:
>  pip install django-devserver
> 
> HTH
> Dan
> 
> > --
> > 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.

alternatively you can do:
In [8]: import django.db as djdb

In [9]: djdb.connection.queries 
Out[9]: []


This is with django 1.2.4, but a quick glance at the svn trunk code tells me 
this hasn't gone away.

Mike
-- 
  Parting is such sweet sorrow. -William Shakespeare

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



Re: Importing modules in code

2011-02-17 Thread Kenneth Gonsalves
On Thu, 2011-02-17 at 02:44 -0800, Daniel Roseman wrote:
> > could you elaborate on this? I am suffering from this misconception.
> >
> Not sure what else to say. Taking mod_wsgi as an example, Apache
> spawns a 
> number of processes and/or threads to serve Django requests, depending
> on 
> your mod_wsgi settings. Each of these is long-running, in the sense
> that 
> they are not tied to a specific request/response cycle - again,
> depending on 
> your configuration, they can either persist indefinitely (until
> Apache 
> itself is restarted), or for a specified number of requests. So
> anything 
> that's imported, or set as a variable in the global or module-level
> context, 
> will also persist for multiple requests.
> 
> This is why you often see issues where people set the default for a
> field, 
> for example, to datetime.datetime.now(), and then get the exact same
> default 
> for all items until the server is restarted: because that function is 
> evaluated when the class is defined, and the value persists until the 
> process is killed. (The solution, of course, is to use the callable
> itself 
> without calling it: datetime.datetime.now.) And it's also why the
> developers 
> of the new class-based views functionality in 1.3 had such trouble and
> went 
> to such great lengths to avoid data leaking from one request to the
> next. 

thanks for taking the trouble to reply - will chew on this. 
-- 
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.org/

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



Re: Importing modules in code

2011-02-17 Thread Daniel Roseman
On Thursday, February 17, 2011 6:37:56 AM UTC, lawgon wrote:
>
> On Wed, 2011-02-16 at 02:12 -0800, Daniel Roseman wrote:
> > Your question betrays a misconception that I often see. Django - at
> > least 
> > when served other than via CGI - does not reload everything for each 
> > request. The Django process is long-running, and is managed by the
> > server, 
> > but usually runs for a number of requests before being respawned. 
>
> could you elaborate on this? I am suffering from this misconception.
>
Not sure what else to say. Taking mod_wsgi as an example, Apache spawns a 
number of processes and/or threads to serve Django requests, depending on 
your mod_wsgi settings. Each of these is long-running, in the sense that 
they are not tied to a specific request/response cycle - again, depending on 
your configuration, they can either persist indefinitely (until Apache 
itself is restarted), or for a specified number of requests. So anything 
that's imported, or set as a variable in the global or module-level context, 
will also persist for multiple requests.

This is why you often see issues where people set the default for a field, 
for example, to datetime.datetime.now(), and then get the exact same default 
for all items until the server is restarted: because that function is 
evaluated when the class is defined, and the value persists until the 
process is killed. (The solution, of course, is to use the callable itself 
without calling it: datetime.datetime.now.) And it's also why the developers 
of the new class-based views functionality in 1.3 had such trouble and went 
to such great lengths to avoid data leaking from one request to the next.
--
DR.

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



Re: Toolbar for Django 1.3?

2011-02-17 Thread galago
Thanks, I'll try it :)

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



Re: Toolbar for Django 1.3?

2011-02-17 Thread Daniel Hilton
On 17 February 2011 10:34, galago  wrote:
> I run my sever on localhost (manage.py runserver).
> Is there any way to display all queries in console or somewhere else?

Yes, if you install dcramer's devserver, which is a straight
replacement for the runserver command.

More info and install guide here: https://github.com/dcramer/django-devserver

Or using pip:
 pip install django-devserver

HTH
Dan


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



-- 
Dan Hilton

www.twitter.com/danhilton
www.DanHilton.co.uk


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



Re: Toolbar for Django 1.3?

2011-02-17 Thread galago
I run my sever on localhost (manage.py runserver).
Is there any way to display all queries in console or somewhere else?

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



Re: Toolbar for Django 1.3?

2011-02-17 Thread Daniel Hilton
On 17 February 2011 10:24, galago  wrote:

> It doesn't work when I switch on the panel for SQL
> ('debug_toolbar.panels.sql.SQLDebugPanel',). Without that panel it works.
> That's error:
> TemplateSyntaxError at /
>
> Caught AttributeError while rendering: 'Cursor' object has no attribute 'db'
>
> Request Method:GETRequest URL:http://localhost:8000/Django Version:1.3
> beta 1 SVN-15519Exception Type:TemplateSyntaxErrorException Value:
>
> Caught AttributeError while rendering: 'Cursor' object has no attribute 'db'
>
>
Are you running devserver as well? I found I had an issue with the both of
them so deactivated the sql panel in debug toolbar so I got the sql queries
in the devserver instead.

Cheers,
Dan


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



-- 
Dan Hilton

www.twitter.com/danhilton
www.DanHilton.co.uk


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



Re: Toolbar for Django 1.3?

2011-02-17 Thread galago
It doesn't work when I switch on the panel for SQL 
('debug_toolbar.panels.sql.SQLDebugPanel',). Without that panel it works.
That's error:
TemplateSyntaxError at /

Caught AttributeError while rendering: 'Cursor' object has no attribute 'db'

Request Method:GETRequest URL:http://localhost:8000/Django Version:1.3 beta 
1 SVN-15519Exception Type:TemplateSyntaxErrorException Value:

Caught AttributeError while rendering: 'Cursor' object has no attribute 'db'

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



Re: Toolbar for Django 1.3?

2011-02-17 Thread Daniel Hilton
On 17 February 2011 10:15, galago  wrote:
> Is there any working toolbar for Django 1.3?
> https://github.com/dcramer/django-debug-toolbar - this doesn't work in my
> project based on 1,3 :/
>

Doesn't work how?

Stack trace or more info please!

Cheers,
Dan

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



-- 
Dan Hilton

www.twitter.com/danhilton
www.DanHilton.co.uk


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



Toolbar for Django 1.3?

2011-02-17 Thread galago
Is there any working toolbar for Django 1.3?
https://github.com/dcramer/django-debug-toolbar - this doesn't work in my 
project based on 1,3 :/

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



Re: ManyToMany problem

2011-02-17 Thread Amar
OK, I've created a barebone app which shows this problem, so if anyone
can try this and duplicate, I'll report this as a bug (unless there is
a problem wih my code)
You can get it here http://rapidshare.com/files/448393624/problem.zip

I'm using PostgreSQL database, so change accordingly (unless it only
occurs when using PostgreSQL, which I doubt).
Also, you might have to change '#!/usr/bin/env python2' in manage.py,
because in my distribution, 'python' defaults to python3.
I've also attached console output for testing this, and it will also
show this problem when you access root of the webpage (input some data
before accessing it, because I assumed there is some data in the
database when showing the view)

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