Django real world website samples (with django source codes)

2011-04-06 Thread django beginner
Hi all,

Could someone please give a link on some of the samples for real world
Django websites?
Thanks and have a nice day!

Regards,
Django Beginner

-- 
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: sample real world Django website sample scripts

2011-04-06 Thread Kenneth Gonsalves
On Thu, 2011-04-07 at 13:24 +0800, djangodjango django wrote:
> Could someone please give a link on some of the samples for real world
> Django websites? 

http://www.djangosites.org/
-- 
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.



sample real world Django website sample scripts

2011-04-06 Thread djangodjango django
Hi all,

Could someone please give a link on some of the samples for real world
Django websites?
Thanks and have a nice day!

Regards.

-- 
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 setup apache server for django?

2011-04-06 Thread Graham Dumpleton


On Thursday, April 7, 2011 12:21:38 PM UTC+10, Charlie from china wrote:
>
> Can not find the page now...


You need to be more specific. What URL? What HTTP status response? 404? What 
messages are in the Apache error logs?

Have you enabled DEBUG to be True in Django settings file so that if it is 
Django that is yielding 404 you can see why it is complaining?

Graham
 

> On 4/7/11, Graham Dumpleton  wrote:
>
> >
> >
> > On Thursday, April 7, 2011 2:16:43 AM UTC+10, Charlie from china wrote:
> >>
> >> Good to hear from you.
> >> I am following this guide.
> >> http://docs.djangoproject.com/en/dev/howto/deployment/modwsgi/
> >
> >
> > Read:
> >
> >   http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango
> >
> > Watch:
> >
> >
> > 
> http://code.google.com/p/modwsgi/wiki/WhereToGetHelp?tm=6#Conference_Presentations
> >
> >
> >>
> >> Using the mod_wsgi. Util now I got some empty django project works.
> >> But my satchmo shop does not work. It turns out to download when open
> >> the localhost.
> >> My file structure looks like:
> >> +store
> >>  | + apache
> >>  | |- django.wsgi
> >>  |  ...
> >>  |  ...
> >>  | +templates
> >>  | +static
> >> 
> >> http.conf:
> >> WSGISocketPrefix /tmp/wsgi
> >>
> >
> > Don't use /tmp for the socket listener files. For a system that requires
> > this, which is only usually older Redhat/Centos, you would use:
> >
> >   WSGISocketPrefix run/wsgi
> >
> >
> >> 
> >> /etc/apache2/sites-available/wab :
> >> 
> >> ServerName waboba
> >>
> >
> > Why do you have waboba here and not wab?
> >
> >
> >> WSGIScriptAlias / /var/www/store/apache/django.wsgi
> >> Alias /media /var/www/store/static/
> >
> >
> > Should be:
> >
> >   Alias /media/  /var/www/store/static/
> >
> > Ie., trailing slash on both. You shouldn't have it on one and leave it 
> off
> > the other.
> >
> >> 
> >> Order deny,allow
> >> Allow from all
> >> 
> >>
> >> LogLevel info
> >> WSGIDaemonProcess waboba processes=2 threads=15 display-name=%{GROUP}
> >>
> >> 
> >> WSGIApplicationGroup 
> >> WSGIProcessGroup store
> >>
> > Using 'store' here is wrong and isn't going to match what name you are 
> using
> > as argument to WSGIDaemonProcess directive.
> >
> > Fix those issues for a start.
> >
> > Graham
> >
> >> Order deny,allow
> >> Allow from all
> >> 
> >> 
> >> -
> >> And /etc/hosts:
> >> 192.168.1.102 ubuntu # Added by NetworkManager
> >> 127.0.0.1 localhost.localdomain localhost
> >> ::1 ubuntu localhost6.localdomain6 localhost6
> >>
> >> 192.168.1.102wab
> >> 192.168.1.102helloworld
> >> -
> >>
> >> http://helloworld  works sometimes..
> >> but http://wab will ask me download...
> >> this is my situation.
> >>
> >> On 4/6/11, Graham Dumpleton  wrote:
> >> >
> >> >
> >> > On Wednesday, April 6, 2011 6:24:50 PM UTC+10, Charlie from china 
> wrote:
> >> >>
> >> >> I have tried whole day. And I just got a new django project works.
> >> >>
> >> >> But I want my old project works too. Anyone could give me some info?
> >> >>
> >> >
> >> > Depends on what WSGI hosting mechanism you are using and you don't
> >> mention
> >> > that.
> >> >
> >> > Graham
> >> >
> >> > --
> >> > You received this message because you are subscribed to the Google
> >> > Groups
> >> > "Django users" group.
> >> > To post to this group, send email to djan...@googlegroups.com.
> >> > To unsubscribe from this group, send email to
> >> > django-...@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...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users...@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: how to setup apache server for django?

2011-04-06 Thread ug Charlie
Can not find the page now...

On 4/7/11, Graham Dumpleton  wrote:
>
>
> On Thursday, April 7, 2011 2:16:43 AM UTC+10, Charlie from china wrote:
>>
>> Good to hear from you.
>> I am following this guide.
>> http://docs.djangoproject.com/en/dev/howto/deployment/modwsgi/
>
>
> Read:
>
>   http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango
>
> Watch:
>
>
> http://code.google.com/p/modwsgi/wiki/WhereToGetHelp?tm=6#Conference_Presentations
>
>
>>
>> Using the mod_wsgi. Util now I got some empty django project works.
>> But my satchmo shop does not work. It turns out to download when open
>> the localhost.
>> My file structure looks like:
>> +store
>>  | + apache
>>  | |- django.wsgi
>>  |  ...
>>  |  ...
>>  | +templates
>>  | +static
>> 
>> http.conf:
>> WSGISocketPrefix /tmp/wsgi
>>
>
> Don't use /tmp for the socket listener files. For a system that requires
> this, which is only usually older Redhat/Centos, you would use:
>
>   WSGISocketPrefix run/wsgi
>
>
>> 
>> /etc/apache2/sites-available/wab :
>> 
>> ServerName waboba
>>
>
> Why do you have waboba here and not wab?
>
>
>> WSGIScriptAlias / /var/www/store/apache/django.wsgi
>> Alias /media /var/www/store/static/
>
>
> Should be:
>
>   Alias /media/  /var/www/store/static/
>
> Ie., trailing slash on both. You shouldn't have it on one and leave it off
> the other.
>
>> 
>> Order deny,allow
>> Allow from all
>> 
>>
>> LogLevel info
>> WSGIDaemonProcess waboba processes=2 threads=15 display-name=%{GROUP}
>>
>> 
>> WSGIApplicationGroup 
>> WSGIProcessGroup store
>>
> Using 'store' here is wrong and isn't going to match what name you are using
> as argument to WSGIDaemonProcess directive.
>
> Fix those issues for a start.
>
> Graham
>
>> Order deny,allow
>> Allow from all
>> 
>> 
>> -
>> And /etc/hosts:
>> 192.168.1.102 ubuntu # Added by NetworkManager
>> 127.0.0.1 localhost.localdomain localhost
>> ::1 ubuntu localhost6.localdomain6 localhost6
>>
>> 192.168.1.102wab
>> 192.168.1.102helloworld
>> -
>>
>> http://helloworld  works sometimes..
>> but http://wab will ask me download...
>> this is my situation.
>>
>> On 4/6/11, Graham Dumpleton  wrote:
>> >
>> >
>> > On Wednesday, April 6, 2011 6:24:50 PM UTC+10, Charlie from china wrote:
>> >>
>> >> I have tried whole day. And I just got a new django project works.
>> >>
>> >> But I want my old project works too. Anyone could give me some info?
>> >>
>> >
>> > Depends on what WSGI hosting mechanism you are using and you don't
>> mention
>> > that.
>> >
>> > Graham
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "Django users" group.
>> > To post to this group, send email to django...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > django-users...@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.
>
>

-- 
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: Passing extra context data to class-based generic views?

2011-04-06 Thread Russell Keith-Magee
On Thu, Apr 7, 2011 at 12:02 AM, David Chandek-Stark
 wrote:
> Function-based generic views provided an "extra_context" keyword argument to
> add variables to the template context.  It appears that under the initial
> implementation of class-based generic views in Django 1.3, there are two
> major differences:
> 1. To add extra context, you have to subclass and override
> get_context_data(); and,
> 2. Extra variables are added to the "params" context variable, not directly
> (so to speak) to the context.
> Do I have this right?  If so, #1 seems to violate the DRY principle.

I don't think DRY means what you think it means. (1) doesn't force you
to repeat anything -- it's just requires a particular way of defining
extra context.

>  Why
> not add an "extra_context" attribute to the TemplateResponseMixin class?

Because extra context can't always be expressed like that. One of the
problems with function-based generic views is that there was certain
types of context data -- for example, anything that required a runtime
lookup (such as calls to reverse()) or anything that required access
to request variables (e.g., the current user).

That said -- there's an argument to be made that get_context should
fall back in the same way that get_template_names() falls back to the
template_name attribute. That way, any view for which a simple context
is possible could continue to use the simple approach, but there's
flexibility if you need it.

If you open a ticket, this idea won't be forgotten; it's also a fairly
minor change, so if you want to try your hand at a patch, it would be
an easy way to get involved with Django development.

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: unique identifier to distinguish an instance

2011-04-06 Thread Roy Smith
On Wed, 2011-04-06 at 15:13 -0700, Tony wrote:
> so I have two models, A and B.  B has a foreignkey relationship in it
> from A (To be clear because I know I dont explain it that well, one A
> has many Bs).  for each group of Bs each A is connected with, I want
> there to be a way to mark one of the Bs as unique from the rest of
> them.

Without knowing anything about your application, it sounds like your
data model really should have two different relationships.  There's a
1:1 relationship selecting the "unique" B for a given A, and then
there's an additional 1:N relationship, selecting the "non-unique" B's
for a given A.


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



unique identifier to distinguish an instance

2011-04-06 Thread Tony
so I have two models, A and B.  B has a foreignkey relationship in it
from A (To be clear because I know I dont explain it that well, one A
has many Bs).  for each group of Bs each A is connected with, I want
there to be a way to mark one of the Bs as unique from the rest of
them.  I added in an extra field called unique_identifier that is a
booleanfield. The problem is I dont know the best way to go about
making sure there is only one B instance marked True for the
unique_identifier field for each set of Bs.  What would be a good way
to ensure there is one and only one instance marked True?

-- 
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 setup apache server for django?

2011-04-06 Thread Graham Dumpleton


On Thursday, April 7, 2011 2:16:43 AM UTC+10, Charlie from china wrote:
>
> Good to hear from you.
> I am following this guide.
> http://docs.djangoproject.com/en/dev/howto/deployment/modwsgi/


Read:

  http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango

Watch:

  
http://code.google.com/p/modwsgi/wiki/WhereToGetHelp?tm=6#Conference_Presentations
 

>
> Using the mod_wsgi. Util now I got some empty django project works.
> But my satchmo shop does not work. It turns out to download when open
> the localhost.
> My file structure looks like:
> +store
>  | + apache
>  | |- django.wsgi
>  |  ...
>  |  ...
>  | +templates
>  | +static
> 
> http.conf:
> WSGISocketPrefix /tmp/wsgi
>

Don't use /tmp for the socket listener files. For a system that requires 
this, which is only usually older Redhat/Centos, you would use:

  WSGISocketPrefix run/wsgi
 

> 
> /etc/apache2/sites-available/wab :
> 
> ServerName waboba
>

Why do you have waboba here and not wab?
 

> WSGIScriptAlias / /var/www/store/apache/django.wsgi
> Alias /media /var/www/store/static/


Should be:

  Alias /media/  /var/www/store/static/

Ie., trailing slash on both. You shouldn't have it on one and leave it off 
the other.

> 
> Order deny,allow
> Allow from all
> 
>
> LogLevel info
> WSGIDaemonProcess waboba processes=2 threads=15 display-name=%{GROUP}
>
> 
> WSGIApplicationGroup 
> WSGIProcessGroup store
>
Using 'store' here is wrong and isn't going to match what name you are using 
as argument to WSGIDaemonProcess directive.

Fix those issues for a start.

Graham 

> Order deny,allow
> Allow from all
> 
> 
> -
> And /etc/hosts:
> 192.168.1.102 ubuntu # Added by NetworkManager
> 127.0.0.1 localhost.localdomain localhost
> ::1 ubuntu localhost6.localdomain6 localhost6
>
> 192.168.1.102wab
> 192.168.1.102helloworld
> -
>
> http://helloworld  works sometimes..
> but http://wab will ask me download...
> this is my situation.
>
> On 4/6/11, Graham Dumpleton  wrote:
> >
> >
> > On Wednesday, April 6, 2011 6:24:50 PM UTC+10, Charlie from china wrote:
> >>
> >> I have tried whole day. And I just got a new django project works.
> >>
> >> But I want my old project works too. Anyone could give me some info?
> >>
> >
> > Depends on what WSGI hosting mechanism you are using and you don't 
> mention
> > that.
> >
> > Graham
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users...@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.



A question about field forms and the widget SelectMultiple

2011-04-06 Thread Ariel
Hi everybody, I have a form with a field that uses the SelectMultiple
widget:

class DocumentForm(forms.ModelForm):
   options = forms.CharField(label='Options', max_length=100
,widget=forms.SelectMultiple(attrs={'class':'listbox'}, choices=([(aspect.id,
unicode(aspect.title)) for aspect in aspects ])) , required=False)

How you can see the field is populated automacally from a list: "choices =
([(aspect.id, unicode(aspect.title)) for aspect in aspects ]))", this works
wonderfull when I am inserting in the database the document model.

But when I want to make an update over the document object I use the same
form and I populated the form like this:

myform = DocumentForm(instance= document)

I want that the listbox displayed with all the options available an the ones
that are inserted in the database with the document mark as selected.
For instance if all the options available are A, B, C, D and the document I
want to update has only the option A and C, I want in the list box options
A, B , C ,  D but option A and C mark as selected.

Could you please help me do that ?
How would you do it ?

Thanks in advance.
Regards
Ariel

-- 
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: User and efficient

2011-04-06 Thread wluka
anyone?

On 6 Kwi, 20:56, wluka  wrote:
> efficient for hit ratio and my database server.
>
> On 6 Kwi, 20:43, bruno desthuilliers 
> wrote:
>
> > On 6 avr, 20:39, wluka  wrote:
>
> > > I have question about efficient with user. What is more efficient user
> > > from auth + special auth model (with OneToOneField) or changing auth
> > > for my own purposes or if I made own user from beginning?
>
> > For which definition of "efficient" ?

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



extending django-registration forms

2011-04-06 Thread Antonio Sánchez
Hi, im having problems extending django-registration register form. i
have extended auth.User -> UserProfile, and added some attributes, one
of this is country, that is a ForeignKey to Country Table (Django-
Countries, with all countries).

After configuring django-registration, i extend register form , one of
the new fields is a forms.ModelChoiceField with queryset
Country.objects.all(), after that, i configure in a new file a new
funtion that connects
with user_registered signal.

All works if i dont put Country field in the extended form, but if i
do it, fails.. :
__init__() got multiple values for keyword argument 'queryset'

here are portions of this code: http://pastebin.com/LfNJisg8

some help?? 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.



Intermediary model with many to many from model to itself not fully documented?

2011-04-06 Thread Margie Roginski
Hi developers - your review would be appreciated here!

It seems to me, based on my experimentation, that if I have an
intermediary model that has a many-to-many relationship from the model
to itself, that the order of the two fields that point back to the
model is important.  For example:

class Task(models.Model):
child_tasks = models.ManyToManyField('self', null=True,
blank=True, through='Membership', symmetrical=False,
related_name="parent_tasks")

class Membership(models.Model):
parent_task = models.ForeignKey(Task,
related_name='parent_memberships')
child_task = models.ForeignKey(Task,
related_name='child_memberships')
percentage = models.DecimalField(default=0, max_digits=5,
decimal_places=2)

Assuming I have my models defined as above, then if I do:

Task.objects.filter(subtasks__isnull=False)

Then I get a select that looks like this:

select  from taskmanager_task INNER JOIN
taskmanager_membership ON (taskmanager_task.id =
taskmanager_membership.parent_task_id)

However, if I change the order of parent_task and child_task in the
Membership class (ie, make child_task first), then the select is
different:

select  from taskmanager_task INNER JOIN
taskmanager_membership ON (taskmanager_task.id =
taskmanager_membership.child_task_id)

The doc does not really describe this, as far as I can see.

Developers - is this something I should post as a bug ticket or am I
missing something?  The doc does say that the two foreign keys will be
treated as the two (different) sides of the many-to-many relation, so
I have a feeling this is an attempt to touch on this point.

Anyway, just trying to confirm that this is expected behavior and
whether it would be worthwhile for me to post a bug ticket on it for
better doc.

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.



Re: Check "if other user is logged in"

2011-04-06 Thread Abhijeet Rastogi
Thanks Shawn for your reply. I was afraid if that was the only way. Anyways,
I implemented using AJAX only. I already had a AJAX request being made from
counter side every 3 seconds.

https://github.com/shadyabhi/pycourt_login/commit/e8303fe6a07761066a75226f7cd6dcb6d3c296f7

Thanks for that point. I didnt think about that. Anyways, its not a peoblem
for my site because its only the student that registers, not the counter.
Registering the counter is only done once using admin interface at the time
of being deployed.

Still, I will check that condition too. That would be a learning exercise
for me as I am just a beginner in web development.

On Thu, Apr 7, 2011 at 12:56 AM, Shawn Milochik  wrote:

> Just to be pedantic, your model allows someone to be both a student
> and a counter at the same time. If they must be mutually exclusive
> then you can create one CharField which uses an iterable of choices,
> or add custom code to your save() (and your modelform) to require
> compliance.
>
> Unfortunately, there's no guaranteed way to know if a user is still
> logged in just by the session. If you're using Comet you can be pretty
> sure, depending on how quickly the Comet backend becomes aware of an
> unsubscribe action. With AJAX you could do some kind of regular
> check-in, but that solution sucks. Otherwise, if a person requests a
> page on your site (refreshing their "last seen" status), they can
> close their browser immediately after and you wouldn't know.
>
> 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.
>
>


-- 
Regards,
Abhijeet Rastogi (shadyabhi)
http://www.google.com/profiles/abhijeet.1989

-- 
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: wan to use django's default theme

2011-04-06 Thread Mike Ramirez
On Wednesday, April 06, 2011 12:57:17 pm GOUTAM KUMAR RANA wrote:
> Sorry for that. Actually I was asking how to use the default theme as in
> django's admin in my custom pages

file locations are here: 
http://code.djangoproject.com/browser/django/trunk/django/contrib/admin/media

templates in another directory under admin.  If you know html/css/js, it 
should be a walk in the park for you.

Mike
-- 
Fried's 1st Rule:
Increased automation of clerical function
invariably results in increased operational costs.

-- 
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: Rendering read-only forms?

2011-04-06 Thread Roy Smith
On Wed, 2011-04-06 at 12:51 -0700, Mike Ramirez wrote:

> the form widgets accept a key word arguement of "attrs"[1] which takes a 
> dictionary that has the key as the option and the value is the options fale. 
> i.e.: attrs={'readonly': 'true'}. These are added to the field when it's 
> rendered to html. 

Thanks.  I had just discovered that when I read your mail.  Good to know
I was on the right track!  I ended up with two forms, and use the
appropriate one in each view.

class ItemForm(forms.Form):
url = forms.URLField()
title = forms.CharField()
text = forms.CharField(required=False)

class ReadOnlyItemForm(forms.Form):
ro_text_widget = forms.TextInput(attrs={'disabled': 'disabled'})
url = forms.URLField(widget=ro_text_widget)
title = forms.CharField(widget=ro_text_widget)
text = forms.CharField(widget=ro_text_widget, required=False)



Minor nit: of these three only the second and third are valid HTML.





It's been a long time since I've started a web project from ground zero.
I've decided to take advantage of that and be fanatical about all HTML
validating.  We'll see how long that lasts :-)

-- 
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: Cascade delete not entirely correct in 1.3?

2011-04-06 Thread Aaron Madison
oh. got it... thanks!

On Wed, Apr 6, 2011 at 2:46 PM, Jacob Kaplan-Moss wrote:

> On Wed, Apr 6, 2011 at 2:41 PM, Aaron Madison 
> wrote:
> > I'm not sure if attaching files straight through email will work or
> not...
>
> I meant on the ticket. django-users is so high traffic that it's
> likely that developers could miss stuff posted here, so giving all the
> information needed on the ticket is useful. I took the liberty of
> posting your traceback there; thanks!
>
> Jacob
>
> --
> 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: wan to use django's default theme

2011-04-06 Thread GOUTAM KUMAR RANA
Sorry for that. Actually I was asking how to use the default theme as in 
django's admin in my custom pages

-- 
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: wan to use django's default theme

2011-04-06 Thread Mike Ramirez
On Wednesday, April 06, 2011 12:41:59 pm GOUTAM KUMAR RANA wrote:
> wan to use django's default theme in all my custom pages or applications

Asking for permission or the location of the files and then which theme, site 
or admin panel.  It's hard to know what's in your head without some real 
details. mind readers we aren't.

Mike
-- 
If you are shooting under 80 you are neglecting your business;
over 80 you are neglecting your golf.
-- Walter Hagen

-- 
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: Rendering read-only forms?

2011-04-06 Thread Mike Ramirez
On Wednesday, April 06, 2011 12:23:56 pm Roy Smith wrote:
> I want to display an object in exactly the same style as an existing
> template that looks like this:
> 
> 
> {% csrf_token %}
> 
> {{form}}
> 
> 
> 
> 
> except that I want all the fields to be read-only.  It's easy enough
> to not include the submit button, but I also want to add
> readonly="true" attributes to all the  tags.  Is there any way
> to do this, sort of some javascript which edits the DOM?

the form widgets accept a key word arguement of "attrs"[1] which takes a 
dictionary that has the key as the option and the value is the options fale. 
i.e.: attrs={'readonly': 'true'}. These are added to the field when it's 
rendered to html.   

Mike


http://docs.djangoproject.com/en/1.3/ref/forms/widgets/#customizing-widget-
instances
-- 
Don't worry.  Life's too long.
-- Vincent Sardi, 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: Cascade delete not entirely correct in 1.3?

2011-04-06 Thread Jacob Kaplan-Moss
On Wed, Apr 6, 2011 at 2:41 PM, Aaron Madison  wrote:
> I'm not sure if attaching files straight through email will work or not...

I meant on the ticket. django-users is so high traffic that it's
likely that developers could miss stuff posted here, so giving all the
information needed on the ticket is useful. I took the liberty of
posting your traceback there; thanks!

Jacob

-- 
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: Cascade delete not entirely correct in 1.3?

2011-04-06 Thread Aaron Madison
and the model setup:

class Policy(models.Model):
policy_number = models.CharField(max_length=10)

class Version(models.Model):
policy = models.ForeignKey(Policy)

class Location(models.Model):
version = models.ForeignKey(Version, blank=True, null=True)

class Item(models.Model):
version = models.ForeignKey(Version)
location = models.ForeignKey(Location, blank=True, null=True)

class ItemRateCode(models.Model):
item = models.ForeignKey(Item)

class PropertyItem(models.Model):
item_rate_code = models.ForeignKey(ItemRateCode)

class Coverage(models.Model):
version = models.ForeignKey(Version)
item_rate_code = models.ForeignKey(ItemRateCode)


And to see it fail:
*tests.py*

from django.test import TestCase

from myapp.models import Policy, Version, Location, Item
from myapp.models import ItemRateCode, PropertyItem, Coverage

class DeletePolicyTests(TestCase):

def setup_models(self):

policy = Policy.objects.create(pk=1, policy_number="1234")
version = Version.objects.create(policy=policy)
location = Location.objects.create(version=version)

item1 = Item.objects.create(version=version, location=location)
item2 = Item.objects.create(version=version, location=location)

# one for each item
item_rate_code1 = ItemRateCode.objects.create(item=item1)
item_rate_code2 = ItemRateCode.objects.create(item=item2)

# one for each item_rate_code
Coverage.objects.create(version=version,
item_rate_code=item_rate_code1)
Coverage.objects.create(version=version,
item_rate_code=item_rate_code2)

# one for each item_rate_code
PropertyItem.objects.create(item_rate_code=item_rate_code1)
PropertyItem.objects.create(item_rate_code=item_rate_code2)

def test_deletes_policy_successfully(self):
self.setup_models()
policy = Policy.objects.get(pk=1)
self.assertEqual(None, policy.delete())
self.assertEqual(0, len(Policy.objects.all()))

On Wed, Apr 6, 2011 at 2:41 PM, Aaron Madison wrote:

> I'm not sure if attaching files straight through email will work or not...
> but I'll give it a go. The attached zip file is a sample project that
> re-creates the situation.
> The output is as follows:
>
> (delete_bug)amadison@dev-aaron:~/projects/delete_bug/project$ ./manage.py
> test myapp
> Creating test database for alias 'default'...
> E
> ==
> ERROR: test_deletes_policy_successfully (myapp.tests.DeletePolicyTests)
> --
> Traceback (most recent call last):
>   File "/home/amadison/projects/delete_bug/project/myapp/tests.py", line
> 34, in test_deletes_policy_successfully
> self.assertEqual(None, policy.delete())
>   File
> "/home/amadison/projects/delete_bug/lib/python2.6/site-packages/django/db/models/base.py",
> line 581, in delete
> collector.delete()
>   File
> "/home/amadison/projects/delete_bug/lib/python2.6/site-packages/django/db/models/deletion.py",
> line 63, in decorated
> func(self, *args, **kwargs)
>   File
> "/home/amadison/projects/delete_bug/lib/python2.6/site-packages/django/db/models/deletion.py",
> line 254, in delete
> query.delete_batch(pk_list, self.using)
>   File
> "/home/amadison/projects/delete_bug/lib/python2.6/site-packages/django/db/models/sql/subqueries.py",
> line 44, in delete_batch
> self.do_query(self.model._meta.db_table, where, using=using)
>   File
> "/home/amadison/projects/delete_bug/lib/python2.6/site-packages/django/db/models/sql/subqueries.py",
> line 29, in do_query
> self.get_compiler(using).execute_sql(None)
>   File
> "/home/amadison/projects/delete_bug/lib/python2.6/site-packages/django/db/models/sql/compiler.py",
> line 735, in execute_sql
> cursor.execute(sql, params)
>   File
> "/home/amadison/projects/delete_bug/lib/python2.6/site-packages/django/db/backends/mysql/base.py",
> line 86, in execute
> return self.cursor.execute(query, args)
>   File
> "/home/amadison/projects/delete_bug/lib/python2.6/site-packages/MySQLdb/cursors.py",
> line 174, in execute
> self.errorhandler(self, exc, value)
>   File
> "/home/amadison/projects/delete_bug/lib/python2.6/site-packages/MySQLdb/connections.py",
> line 36, in defaulterrorhandler
> raise errorclass, errorvalue
> IntegrityError: (1451, 'Cannot delete or update a parent row: a foreign key
> constraint fails (`test_delete_test`.`myapp_item`, CONSTRAINT
> `version_id_refs_id_15106961` FOREIGN KEY (`version_id`) REFERENCES
> `myapp_version` (`id`))')
>
> --
> Ran 1 test in 0.120s
>
>
>
>
> On Wed, Apr 6, 2011 at 2:06 PM, Jacob Kaplan-Moss wrote:
>
>> On Wed, Apr 6, 2011 at 11:14 AM, amadison 
>> wrote:
>> > It you run the test case against django 1.3 it blows 

wan to use django's default theme

2011-04-06 Thread GOUTAM KUMAR RANA
wan to use django's default theme in all my custom pages or applications

-- 
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: Check "if other user is logged in"

2011-04-06 Thread Shawn Milochik
Just to be pedantic, your model allows someone to be both a student
and a counter at the same time. If they must be mutually exclusive
then you can create one CharField which uses an iterable of choices,
or add custom code to your save() (and your modelform) to require
compliance.

Unfortunately, there's no guaranteed way to know if a user is still
logged in just by the session. If you're using Comet you can be pretty
sure, depending on how quickly the Comet backend becomes aware of an
unsubscribe action. With AJAX you could do some kind of regular
check-in, but that solution sucks. Otherwise, if a person requests a
page on your site (refreshing their "last seen" status), they can
close their browser immediately after and you wouldn't know.

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.



Rendering read-only forms?

2011-04-06 Thread Roy Smith
I want to display an object in exactly the same style as an existing
template that looks like this:


{% csrf_token %}

{{form}}




except that I want all the fields to be read-only.  It's easy enough
to not include the submit button, but I also want to add
readonly="true" attributes to all the  tags.  Is there any way
to do this, sort of some javascript which edits the DOM?

-- 
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: Cascade delete not entirely correct in 1.3?

2011-04-06 Thread Jacob Kaplan-Moss
On Wed, Apr 6, 2011 at 11:14 AM, amadison  wrote:
> It you run the test case against django 1.3 it blows up... in django
> 1.2.5 it passes.

Just a quick process point: it helps a lot if you post the actual
error you're seeing, traceback and all.

Unless Django's literally blowing up your computer, in which case I
suggest you stop buying the TNT-powered hard drives.

Jacob

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



Check "if other user is logged in"

2011-04-06 Thread Abhijeet Rastogi
I have implemented two types of users using:-

class UserProfile(models.Model):
user = models.ForeignKey(User)
is_counter = models.BooleanField()
is_student = models.BooleanField()

So, a user can either be a student or counter. Basically, I have a project
something like student will order food & at counter side, counter user will
get the notification to prepare food.

Now, if the counter user is logged out, I dont want to allow student to
order that food. For that I have to somehow check if counter user is logged
in. Is it possible?
>From what I feel, adding a bool field & making it True when counter user
logs in and making it false when counter user logs out; is not a solution.
The reason being that "what if a counter user gets disconnected somehow (or
closes browser without logging out).

-- 
Regards,
Abhijeet Rastogi (shadyabhi)
http://www.google.com/profiles/abhijeet.1989

-- 
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: User and efficient

2011-04-06 Thread wluka
efficient for hit ratio and my database server.


On 6 Kwi, 20:43, bruno desthuilliers 
wrote:
> On 6 avr, 20:39, wluka  wrote:
>
> > I have question about efficient with user. What is more efficient user
> > from auth + special auth model (with OneToOneField) or changing auth
> > for my own purposes or if I made own user from beginning?
>
> For which definition of "efficient" ?

-- 
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: Where to put custom classes

2011-04-06 Thread bruno desthuilliers

On 6 avr, 19:13, Mazery Smith  wrote:
> Hello,
> I have a project with a few application folders in it. One of those
> applications houses all the views for the website. I've built some
> utility classes placed in an entirely different application folder
> (utility_app helper module) that assist in processing requests in each
> view. Is this the best place for such a utility class -- meaning
> housing it in another applicaiton all together and importing it (from
> utility_app.helpers import *) in my views?
>
> Maybe there's a more logical place for it.

Well, if all your views are in a same app and these helper classes are
only used by your app's views and are tightly coupled, then they
should IMHO leave in the same app.

Now if they aren't tightly coupled (=> could be used in another app),
it of course make sense to extract them.

It's just the same old hi-cohesion / low-coupling stuff FWIW.

-- 
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: User and efficient

2011-04-06 Thread bruno desthuilliers
On 6 avr, 20:39, wluka  wrote:
> I have question about efficient with user. What is more efficient user
> from auth + special auth model (with OneToOneField) or changing auth
> for my own purposes or if I made own user from beginning?

For which definition of "efficient" ?

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



User and efficient

2011-04-06 Thread wluka
I have question about efficient with user. What is more efficient user
from auth + special auth model (with OneToOneField) or changing auth
for my own purposes or if I made own user from beginning?

-- 
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: Where to put custom classes

2011-04-06 Thread Cal Leeming [Simplicity Media Ltd]
Personally, I keep all files which do not have a specific place in Django,
in a 'libs' folder within the project.

On Wed, Apr 6, 2011 at 6:13 PM, Mazery Smith  wrote:

> Hello,
> I have a project with a few application folders in it. One of those
> applications houses all the views for the website. I've built some
> utility classes placed in an entirely different application folder
> (utility_app helper module) that assist in processing requests in each
> view. Is this the best place for such a utility class -- meaning
> housing it in another applicaiton all together and importing it (from
> utility_app.helpers import *) in my views?
>
> Maybe there's a more logical place for it.
>
> I realize this question is subjective seems ridiculous but hey...I'm
> new and I'm ridiculous.
>
> Just want to see what others do
>
>
> --
> 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: Where to put custom classes

2011-04-06 Thread Aaron Madison
that seems like the way i'd do it

On Wed, Apr 6, 2011 at 12:13 PM, Mazery Smith  wrote:

> Hello,
> I have a project with a few application folders in it. One of those
> applications houses all the views for the website. I've built some
> utility classes placed in an entirely different application folder
> (utility_app helper module) that assist in processing requests in each
> view. Is this the best place for such a utility class -- meaning
> housing it in another applicaiton all together and importing it (from
> utility_app.helpers import *) in my views?
>
> Maybe there's a more logical place for it.
>
> I realize this question is subjective seems ridiculous but hey...I'm
> new and I'm ridiculous.
>
> Just want to see what others do
>
>
> --
> 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.



override ManyToMany.add()

2011-04-06 Thread Alsond
Lets say we have:

def Sample(models.Model):
many = ManyToManyField(ForeignModel)

sample = Sample()
sample.many.add(data)

How to make extra call to django cache on last line, when using add().

-- 
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 setup apache server for django?

2011-04-06 Thread ug Charlie
Good to hear from you.
I am following this guide.
http://docs.djangoproject.com/en/dev/howto/deployment/modwsgi/
Using the mod_wsgi. Util now I got some empty django project works.
But my satchmo shop does not work. It turns out to download when open
the localhost.
My file structure looks like:
+store
 | + apache
 | |- django.wsgi
 |  ...
 |  ...
 | +templates
 | +static

http.conf:
WSGISocketPrefix /tmp/wsgi

/etc/apache2/sites-available/wab :

ServerName waboba
WSGIScriptAlias / /var/www/store/apache/django.wsgi
Alias /media /var/www/store/static/


Order deny,allow
Allow from all


LogLevel info
WSGIDaemonProcess waboba processes=2 threads=15 display-name=%{GROUP}


WSGIApplicationGroup 
WSGIProcessGroup store
Order deny,allow
Allow from all


-
And /etc/hosts:
192.168.1.102   ubuntu  # Added by NetworkManager
127.0.0.1   localhost.localdomain   localhost
::1 ubuntu  localhost6.localdomain6 localhost6

192.168.1.102wab
192.168.1.102helloworld
-

http://helloworld  works sometimes..
but http://wab will ask me download...
this is my situation.

On 4/6/11, Graham Dumpleton  wrote:
>
>
> On Wednesday, April 6, 2011 6:24:50 PM UTC+10, Charlie from china wrote:
>>
>> I have tried whole day. And I just got a new django project works.
>>
>> But I want my old project works too. Anyone could give me some info?
>>
>
> Depends on what WSGI hosting mechanism you are using and you don't mention
> that.
>
> Graham
>
> --
> 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.



Cascade delete not entirely correct in 1.3?

2011-04-06 Thread amadison
Has anybody else noticed deletes blowing up that used to work fine,
but now are broken with django 1.3?

Using:
Django 1.3
MySQL 5.1
Python 2.6

I have some complicated models from a legacy system that won't delete
items in the proper order anymore and I receive a Referential
Integrity error from MySQL.

I've logged a bug to django (http://code.djangoproject.com/ticket/
15776)  where I have attached a sample project and a test case that re-
produces the bug every time.

It you run the test case against django 1.3 it blows up... in django
1.2.5 it passes.

Am I the only one running into this issue?

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



Where to put custom classes

2011-04-06 Thread Mazery Smith
Hello,
I have a project with a few application folders in it. One of those
applications houses all the views for the website. I've built some
utility classes placed in an entirely different application folder
(utility_app helper module) that assist in processing requests in each
view. Is this the best place for such a utility class -- meaning
housing it in another applicaiton all together and importing it (from
utility_app.helpers import *) in my views?

Maybe there's a more logical place for it.

I realize this question is subjective seems ridiculous but hey...I'm
new and I'm ridiculous.

Just want to see what others do


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



Passing extra context data to class-based generic views?

2011-04-06 Thread David Chandek-Stark
Function-based generic views provided an "extra_context" keyword argument to 
add variables to the template context.  It appears that under the initial 
implementation of class-based generic views in Django 1.3, there are two 
major differences:

1. To add extra context, you have to subclass and override 
get_context_data(); and,
2. Extra variables are added to the "params" context variable, not directly 
(so to speak) to the context.

Do I have this right?  If so, #1 seems to violate the DRY principle.  Why 
not add an "extra_context" attribute to the TemplateResponseMixin class?

Thanks,
David

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



reverse or selected_related or?

2011-04-06 Thread MikeKJ

There is a way to get it I know there is but I cant see the wood for the
trees
There are 2 areas each with the same name but belonging to the same
PracticeCategory
Practice categories are Individual and Business
There is a practicetype called Property that belongs to Individual (1) 
There is a practicetype called Property that belongs to Business (2)

Awkward I know but trust me this is the 4th goalpost change in as many weeks

Models excerpts

PracticeCategory
PracticeType - category = models.ForeignKey(PracticeCategory)
Partner - area = models.ManyToManyField(PracticeType)

View excerpt

def pracpart(request, id):
this = PracticeCategory.objects.all().order_by('priority',)
practice = PracticeType.objects.filter(pk=id)
for p in practice:
partner_list = p.partner_set.all()

Template excerpt
{% for p in partner_list %}
{% for a in p.area.all %}{{ a.practice }},{% endfor %}

Now this outputs correctly all the areas in which a partner practices BUT
becasue of the same name/title requirement of the practicearea it repeats
itself as Property, Property so what I want to do is either

limit the result of  {% for a in p.area.all %} to only PracticeCategory 1
(Individual) or
group the result set by the PracticeCategory  --- The regroup would be
neater but I'd be happy just to get an output by PracticeCategory 1
(Individual)

Cheers
-- 
View this message in context: 
http://old.nabble.com/reverse-or-selected_related-or--tp31334219p31334219.html
Sent from the django-users mailing list archive at Nabble.com.

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



Re: Django app for data management and visualization

2011-04-06 Thread Marwan Al-Sabbagh
this sounds very interesting to me too. I'm working at a financial
institution and I'm facing a similar challenge of allowing the users
to generate ad hoc reports and export those reports to excel. I've
already implemented this requirement in PHP and I'm in the process of
migrating these reporting systems to django. I'm very interested to
see how you plan to do excel exports. I'll also be righting a library
within the next two months to do that, because I haven't found
anything that meets our requirements. If it's something you are
interested in please shoot me an email.
  as far as importing data from excel sheets into a database check out
www.python-excel.org and specifically their xlrd package that lets you
read excel files and traverse the cells. You could use this to extract
values and populate your database.

Marwan

On Tue, Apr 5, 2011 at 7:03 PM, Gianluca Riccardi
 wrote:
>
>
> On 5 Apr, 17:06, alessio c  wrote:
>> Ciao,
>
> ciao Alessio,
>
>>
>> yes I do. I need more basic stuff then that and I need tables. Think of this
>> as tentative to reduce Excel use (which is killing me).
>>
>> I can use matplotlib or openflash if I want to go really fancy. However, now
>> I need to set up the framework. After that, I have a platform from which I
>> can run all my scripts.
>>
>> Let's say I have a database with invoice data from different subsidiaries. I
>> want to be able to: 1) create different views (subsidiary level, macro
>> level, invoice level, first 10 invoice, first 10 customers, etc.); 2) upload
>> data from different formats (because people are lazy and it is impossible to
>> impose a single format); 3) allow some users to upload data (to avoid them
>> to send me excel files by email, this is a huge feature...); 4) allow some
>> other users (managers) to access and download online reports (tables and
>> graphs).
>>
>> Theoretically, when I get this right I am hoping to start a project on git.
>> The main idea is to create a shared reporting tool.
>
> sounds like your going to have some fun ;) good luck, especially if
> you can get rid of dealing with spreadsheets and automate it I'm sure
> users will be happier(you at first;)
>
> if You start a public git repo i'd like to read your progresses
>
> regards,
> Gianluca Riccardi
>
> --
> 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.



Subqueries

2011-04-06 Thread bernatbonet
Data Model:
class A(models.model):
   desc: model.CharField()
class B(models.model):
   a: model.ForeignKey('A')
   desc: models.CharField()
I need to do this select in a view:
   select max(num_a) as max_num_a from (select a, count(desc) as
num_a
from B group by a) as x;
I've tried this:
   result =
B.objects.values('a').annotate(num_a=Count('a')).aggregate(Max('num_a'))
And I got this error:
   1064, "You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near 'FROM (SELECT `B`.a` AS `a`, COUNT(`a' at line 1")
If we only group and not obtain max it works:
   result = B.objects.values('a').annotate(num_a=Count('a'))
and the result is : {'a': 1L, 'num_a': 9}{'a': 2L, 'num_a': 6}{'a':
3L,
'num_a': 4}
I'm not sure what I'm doing wrong, neither if there's other way to
resolve it.
If somebody have been faced with and resolved it, I'll be gratefull if
he can show me how can I start for beating this.
Thanks all.

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



Uso de subconsultas

2011-04-06 Thread bernatbonet
Tengo el siguiente modelo de datos:

class A(models.model):
   desc: model.CharField()

class B(models.model):
   a: model.ForeignKey('A')
   desc: models.CharField()

Tengo una vista que quiere sacar la siguiente select:
   select max(num_a) as max_num_a from (select a, count(desc) as num_a
from B group by a) as x;

He intentado hacer lo siguiente:
   result =
B.objects.values('a').annotate(num_a=Count('a')).aggregate(Max('num_a'))

Esto me da el siguiente error:
   1064, "You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near 'FROM (SELECT `B`.a` AS `a`, COUNT(`a' at line 1")

Si en lugar de obtener el máximo nos quedamos en la agrupación
funciona:
   result = B.objects.values('a').annotate(num_a=Count('a'))
y nos devuelve: {'a': 1L, 'num_a': 9}{'a': 2L, 'num_a': 6}{'a': 3L,
'num_a': 4}

No se que estoy haciendo mal, ni si hay otra forma de resolver este
problema.
Si alguien se ha encontrado con el mismo problema y lo ha resuelto, le
agradecería mucho que me diera unas pistas para solventarlo.

Muchas gracias por todo.



-- 
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: Caught NoReverseMatch while rendering: Reverse for 'homepage_about' with arguments '()' and keyword arguments '{}' not found.

2011-04-06 Thread Anoop Thomas Mathew
Hi goutam,

1. You should not attach files in here. Bad practice. Just post it somewhere
like dpaste.de or pastebin.ca

Now,

You just try renaming your homepage_about to about. _ are usually taken
instead of . .And change correspondingly everywhere. It should work.

regards,
atm
___
Life is short, Live it hard




On 6 April 2011 19:11, GOUTAM KUMAR RANA  wrote:

> Oops Sorry , Its _  i was just trying by changing _ to -  .  At the time of
> - I had taken the screen shot . At _ and _ the same error is shown. plesae
> 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.
>

-- 
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: Caught NoReverseMatch while rendering: Reverse for 'homepage_about' with arguments '()' and keyword arguments '{}' not found.

2011-04-06 Thread GOUTAM KUMAR RANA
Oops Sorry , Its _  i was just trying by changing _ to -  .  At the time of 
- I had taken the screen shot . At _ and _ the same error is shown. plesae 
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: Caught NoReverseMatch while rendering: Reverse for 'homepage_about' with arguments '()' and keyword arguments '{}' not found.

2011-04-06 Thread Casey Greene
- and _ are different characters.  The screenshot shows - while your 
posted error message and urls.py have _.


Casey

On 04/06/2011 09:29 AM, GOUTAM KUMAR RANA wrote:


--
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: Caught NoReverseMatch while rendering: Reverse for 'homepage_about' with arguments '()' and keyword arguments '{}' not found.

2011-04-06 Thread GOUTAM KUMAR RANA
can u please help me in a small inventory project.

-- 
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: Caught NoReverseMatch while rendering: Reverse for 'homepage_about' with arguments '()' and keyword arguments '{}' not found.

2011-04-06 Thread GOUTAM KUMAR RANA
here  are the files please  

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

<<< text/html; charset=us-ascii; name=index.html: Unrecognized >>>
from django.conf.urls.defaults import *

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
(r'^$',include('inventory.apps.homepage.urls')),
	# Examples:

	# url(r'^$', 'inventory.views.home', name='home'),
# url(r'^inventory/', include('inventory.foo.urls')),

# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

# Uncomment the next line to enable the admin:
 url(r'^admin/', include(admin.site.urls)),
)
from django.conf.urls.defaults import *

urlpatterns = patterns('inventory.apps.homepage.views',
	url(r'^$', 'index', name="homepage_index"),
	url(r'^about/$', 'about', name="homepage_about"),
	url(r'^contact/$', 'contact', name="homepage_contact"),
	url(r'^archive/$', 'archive', name="homepage_archive"),
)

Re: Jinja2 & Django 1.3 Integration - Example?

2011-04-06 Thread Shawn Milochik
Line 16 (where you say the error occurs) is an import line. So this is
probably a Python or Jinja2 issue. Try to do a very simple Python
script using a bare-bones Jinja 2 template and confirm that everything
is working before trying to troubleshoot a whole Django app.

http://jinja.pocoo.org/docs/intro/#basic-api-usage

-- 
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: Caught NoReverseMatch while rendering:

2011-04-06 Thread Gonzalo Delgado

El 05/04/11 17:48, GOUTAM KUMAR RANA escribió:


   7 : home - about - archive - contactcontact


Make sure a url named[0] "homepage_about" exists in one of your active 
urls.py files, and that it takes no arguments.


[0] 
http://docs.djangoproject.com/en/dev/topics/http/urls/#naming-url-patterns


--
Gonzalo Delgado

--
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: E-Commerce - Payment

2011-04-06 Thread Shawn Milochik
I'll just add in that you do *not* want to ever have access to the
credit card numbers. That obligates you to be PCI-DSS compliant, and
that's not something you want to deal with if you don't have to. So
yes, use a trusted third-party as everyone else has already said. Not
just because they already have the infrastructure, but because of PCI.

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: Caught NoReverseMatch while rendering: Reverse for 'homepage_about' with arguments '()' and keyword arguments '{}' not found.

2011-04-06 Thread Anoop Thomas Mathew
Hi Goutam,

Post your urls.py somewhere.
It seems you have not added anything in urls.py to handle homepage_about.
regards,
atm
___
Life is short, Live it hard.




On 6 April 2011 18:26, GOUTAM KUMAR RANA  wrote:

> Environment:
>
>
> Request Method: GET
> Request URL: http://localhost:8000/
>
> Django Version: 1.3
> Python Version: 2.7.1
> Installed Applications:
> ['django.contrib.auth',
>  'django.contrib.contenttypes'
> ,
>  'django.contrib.sessions',
>  'django.contrib.sites',
>  'django.contrib.messages',
>  'django.contrib.staticfiles',
>  'apps.data',
>  'django.contrib.admin',
>  'django.contrib.admindocs']
> Installed Middleware:
> ('django.middleware.common.CommonMiddleware',
>  'django.contrib.sessions.middleware.SessionMiddleware',
>  'django.middleware.csrf.CsrfViewMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>  'django.contrib.messages.middleware.MessageMiddleware')
>
>
> Template error:
> In template
> d:\djangoproject\p_source_code\inventory\templates\homepage\index.html,
> error at line 7
>Caught NoReverseMatch while rendering: Reverse for 'homepage_about' with
> arguments '()' and keyword arguments '{}' not found.
>1 : {% extends "base.html"%}
>
>
>2 : {% block title %}
>
>
>3 : Index Page
>
>
>4 : {% endblock %}
>
>
>5 :
>
>
>6 : {% block navi %}
>
>
>7 : home - about - archive - contactcontact
>
>
>8 : {% endblock %}
>
>
>9 :
>
>
>10 : {% block content %}
>
>
>11 : Entries:
>
>
>12 : {% for e in entries %}
>
>
>13 :  {{ e.title }}-{{ e.created }} 
>
>
>14 :  {{ e.text }} 
>
>15 : 
>
>
>16 : {% endfor %}
>
>
>17 : {% endblock %}
>
>
> Traceback:
> File "C:\PYTHON27\lib\site-packages\django\core\handlers\base.py" in
> get_response
>   111. response = callback(request, *callback_args,
> **callback_kwargs)
> File
> "D:\DjangoProject\p_source_code\inventory\..\inventory\apps\homepage\views.py"
> in index
>   7. return render_to_response('homepage/index.html',ctx)
> File "C:\PYTHON27\lib\site-packages\django\shortcuts\__init__.py" in
> render_to_response
>   20. return HttpResponse(loader.render_to_string(*args, **kwargs),
> **httpresponse_kwargs)
> File "C:\PYTHON27\lib\site-packages\django\template\loader.py" in
> render_to_string
>   183. return t.render(Context(dictionary))
> File "C:\PYTHON27\lib\site-packages\django\template\base.py" in render
>   123. return self._render(context)
> File "C:\PYTHON27\lib\site-packages\django\template\base.py" in _render
>   117. return self.nodelist.render(context)
> File "C:\PYTHON27\lib\site-packages\django\template\base.py" in render
>   744. bits.append(self.render_node(node, context))
> File "C:\PYTHON27\lib\site-packages\django\template\debug.py" in
> render_node
>   73. result = node.render(context)
> File "C:\PYTHON27\lib\site-packages\django\template\loader_tags.py" in
> render
>   127. return compiled_parent._render(context)
> File "C:\PYTHON27\lib\site-packages\django\template\base.py" in _render
>   117. return self.nodelist.render(context)
> File "C:\PYTHON27\lib\site-packages\django\template\base.py" in render
>   744. bits.append(self.render_node(node, context))
> File "C:\PYTHON27\lib\site-packages\django\template\debug.py" in
> render_node
>   73. result = node.render(context)
> File "C:\PYTHON27\lib\site-packages\django\template\loader_tags.py" in
> render
>   64. result = block.nodelist.render(context)
> File "C:\PYTHON27\lib\site-packages\django\template\base.py" in render
>   744. bits.append(self.render_node(node, context))
> File "C:\PYTHON27\lib\site-packages\django\template\debug.py" in
> render_node
>   73. result = node.render(context)
> File "C:\PYTHON27\lib\site-packages\django\template\defaulttags.py" in
> render
>   450. raise e
>
> Exception Type: TemplateSyntaxError at /
> Exception Value: Caught NoReverseMatch while rendering: Reverse for
> 'homepage_about' with arguments '()' and keyword arguments '{}' not found.
>
> --
> 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.



Caught NoReverseMatch while rendering: Reverse for 'homepage_about' with arguments '()' and keyword arguments '{}' not found.

2011-04-06 Thread GOUTAM KUMAR RANA
Environment:


Request Method: GET
Request URL: http://localhost:8000/

Django Version: 1.3
Python Version: 2.7.1
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes'
,
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'apps.data',
 'django.contrib.admin',
 'django.contrib.admindocs']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')


Template error:
In template 
d:\djangoproject\p_source_code\inventory\templates\homepage\index.html, 
error at line 7
   Caught NoReverseMatch while rendering: Reverse for 'homepage_about' with 
arguments '()' and keyword arguments '{}' not found.
   1 : {% extends "base.html"%}


   2 : {% block title %}


   3 : Index Page


   4 : {% endblock %}


   5 : 


   6 : {% block navi %}


   7 : home - about - archive - contactcontact


   8 : {% endblock %}


   9 : 


   10 : {% block content %}


   11 : Entries:


   12 : {% for e in entries %}


   13 :  {{ e.title }}-{{ e.created }} 


   14 :  {{ e.text }} 


   16 : {% endfor %}


   17 : {% endblock %}


Traceback:
File "C:\PYTHON27\lib\site-packages\django\core\handlers\base.py" in 
get_response
  111. response = callback(request, *callback_args, 
**callback_kwargs)
File 
"D:\DjangoProject\p_source_code\inventory\..\inventory\apps\homepage\views.py" 
in index
  7. return render_to_response('homepage/index.html',ctx)
File "C:\PYTHON27\lib\site-packages\django\shortcuts\__init__.py" in 
render_to_response
  20. return HttpResponse(loader.render_to_string(*args, **kwargs), 
**httpresponse_kwargs)
File "C:\PYTHON27\lib\site-packages\django\template\loader.py" in 
render_to_string
  183. return t.render(Context(dictionary))
File "C:\PYTHON27\lib\site-packages\django\template\base.py" in render
  123. return self._render(context)
File "C:\PYTHON27\lib\site-packages\django\template\base.py" in _render
  117. return self.nodelist.render(context)
File "C:\PYTHON27\lib\site-packages\django\template\base.py" in render
  744. bits.append(self.render_node(node, context))
File "C:\PYTHON27\lib\site-packages\django\template\debug.py" in render_node
  73. result = node.render(context)
File "C:\PYTHON27\lib\site-packages\django\template\loader_tags.py" in 
render
  127. return compiled_parent._render(context)
File "C:\PYTHON27\lib\site-packages\django\template\base.py" in _render
  117. return self.nodelist.render(context)
File "C:\PYTHON27\lib\site-packages\django\template\base.py" in render
  744. bits.append(self.render_node(node, context))
File "C:\PYTHON27\lib\site-packages\django\template\debug.py" in render_node
  73. result = node.render(context)
File "C:\PYTHON27\lib\site-packages\django\template\loader_tags.py" in 
render
  64. result = block.nodelist.render(context)
File "C:\PYTHON27\lib\site-packages\django\template\base.py" in render
  744. bits.append(self.render_node(node, context))
File "C:\PYTHON27\lib\site-packages\django\template\debug.py" in render_node
  73. result = node.render(context)
File "C:\PYTHON27\lib\site-packages\django\template\defaulttags.py" in 
render
  450. raise e

Exception Type: TemplateSyntaxError at /
Exception Value: Caught NoReverseMatch while rendering: Reverse for 
'homepage_about' with arguments '()' and keyword arguments '{}' not found.

-- 
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 setup apache server for django?

2011-04-06 Thread Graham Dumpleton


On Wednesday, April 6, 2011 6:24:50 PM UTC+10, Charlie from china wrote:
>
> I have tried whole day. And I just got a new django project works.
>
> But I want my old project works too. Anyone could give me some info?
>

Depends on what WSGI hosting mechanism you are using and you don't mention 
that.

Graham 

-- 
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 setup apache server for django?

2011-04-06 Thread Marcos Moyano
You need to create a VirtualHost for each one of your projects.

http://httpd.apache.org/docs/2.0/vhosts/

Marcos

On Wed, Apr 6, 2011 at 5:24 AM, ug Charlie  wrote:

> I have tried whole day. And I just got a new django project works.
>
> But I want my old project works too. Anyone could give me some info?
>
> --
> 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.



how to setup apache server for django?

2011-04-06 Thread ug Charlie
I have tried whole day. And I just got a new django project works.

But I want my old project works too. Anyone could give me some info?

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



Djando admin - custom error when deleting

2011-04-06 Thread galgal
I would like to use validating fields connections, but ONLY when delete 
action is performed. What should I do to validate that fields given in form 
via admin, chech them and if something is wrong - display errors in admin. I 
use custom ModelForm as admin form, but have no idea how to check in it's 
validation if it's deleting or saving. Maybe I could use delete_model built 
in admin - but how to display errors within 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: Python Decorators

2011-04-06 Thread cootetom
Yeah it's really odd. Since I posted I did the test that you've just
shown and it's works fine. As soon as I put the same decorator on a
django view function the as_string parameter is not defined in the
wrapper. It's baffled me!



On Apr 6, 10:48 am, Jonathan S  wrote:
> Your code looks perfect. Following does print 'True'.
>
> def widget(widget_switch, as_string=False):
>     def decorator(func):
>         def wrapper(*args, **kwargs):
>             # logic in here can access the value of 'widget_switch'
> but 'as_string' is not defined?
>             print as_string
>             return func(*args, **kwargs)
>         return wrapper
>     return decorator
>
> @widget('', as_string=True)
> def test():
>     pass
>
> test()

-- 
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: Python Decorators

2011-04-06 Thread Jonathan S
Your code looks perfect. Following does print 'True'.


def widget(widget_switch, as_string=False):
def decorator(func):
def wrapper(*args, **kwargs):
# logic in here can access the value of 'widget_switch'
but 'as_string' is not defined?
print as_string
return func(*args, **kwargs)
return wrapper
return decorator

@widget('', as_string=True)
def test():
pass

test()

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



Admin custom button in edit

2011-04-06 Thread galgal
Hi,
what is the best way to add custom button to save/save and edit buttons 
list?
I need to add it only in edit mode and only in one model.

Thanks for 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: E-Commerce - Payment

2011-04-06 Thread Isaac XxX
Thank you a lot for your explanation. These concepts are really new for me,
and now seems to be some light on this issue.

On Wed, Apr 6, 2011 at 9:04 AM, Kenneth Gonsalves wrote:

> On Wed, 2011-04-06 at 08:56 +0200, Isaac XxX wrote:
> > And then, some advice at how to manage "credit card gateways"? or some
> > information source about it?
>
> basically a credit card gateway is a company (usually a very big
> company) which will process your credit cards for you. All you need to
> do is to pass them the information like bill amount. The customer will
> interact with them and pay to them. They will then intimate you as to
> the success or failure of the payment and return the customer to your
> site. You then proceed. Usually integration with the gateway is done
> through an integration kit which the company gives you. Basically a few
> scripts written in php or jsp or whatever. They will also give you some
> sort of password and an url to send the info to. If you check the
> archives of this list, you will find any number of recommendations of
> gateways to use. The important thing is that the contract with the
> gateway will be between them and your client, and neither you nor your
> client will ever be held liable for mistakes. (of course if you are
> dealing in leaked cables, the gateway may suddenly ditch you).
> --
> 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.
>
>

-- 
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: E-Commerce - Payment

2011-04-06 Thread Kenneth Gonsalves
On Wed, 2011-04-06 at 08:56 +0200, Isaac XxX wrote:
> And then, some advice at how to manage "credit card gateways"? or some
> information source about it? 

basically a credit card gateway is a company (usually a very big
company) which will process your credit cards for you. All you need to
do is to pass them the information like bill amount. The customer will
interact with them and pay to them. They will then intimate you as to
the success or failure of the payment and return the customer to your
site. You then proceed. Usually integration with the gateway is done
through an integration kit which the company gives you. Basically a few
scripts written in php or jsp or whatever. They will also give you some
sort of password and an url to send the info to. If you check the
archives of this list, you will find any number of recommendations of
gateways to use. The important thing is that the contract with the
gateway will be between them and your client, and neither you nor your
client will ever be held liable for mistakes. (of course if you are
dealing in leaked cables, the gateway may suddenly ditch you).
-- 
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: E-Commerce - Payment

2011-04-06 Thread Isaac XxX
Thanks for advice and responses, I will take a look at payment gateway
solutions, looking for one well fit to me

On Wed, Apr 6, 2011 at 8:56 AM, Mike Ramirez  wrote:

> On Tuesday, April 05, 2011 11:25:12 pm Isaac XxX wrote:
> > Hi folks,
> >
>
> > Paypal seems to be clear at how to manage, but
>
> Use a gateway service, much easier and less costly.
>
> >I don't know really how to  manage credit card data:? can be stored?
>
> Yes but the infrastructure is important on how all this is handled, I
> worked
> for a comapny that channeled its cc payments to an internal oracle server
> which there passed the data to the cc service.  The cc data was routed
> through
> webserver to the internal network, to the app, to the oracle server. all
> over
> an encrypted channel.  From there it was processed and payment
> made/recieved.
> This is the only place oracle existed on the network, the site was driven
> by
> mysql clusters.  The reason for choosing oracle was transaction support,
> they
> were using mysql 4.x. This was in 2004/05. This is also a large company
> with
> lots of resources.
>
> Note, the oracle server was well defended and locked down.
>
> You would want to store everything encrypted and have only trusted folks in
> charge of it. Data security companies have had breeches in security, most
> these being caused by the employees of the data center. This is just the
> tip
> of the iceburg so to speak. It's just easier to use a gateway service.
>
> this recent thread has good information on them with django:
> http://groups.google.com/group/django-
>
> users/browse_frm/thread/45794a54c2e3f466/16288a41d7e628ce?hl=en=gst=Payment+Gateway
>
>
> Mike
>
>
> --
> "A great many people think they are thinking when they are merely
> rearranging
> their prejudices."
> -- William James
>
> --
> 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: E-Commerce - Payment

2011-04-06 Thread Isaac XxX
And then, some advice at how to manage "credit card gateways"? or some
information source about it?

Sorry if this is a beginner question, but is my first e-commerce
application, and had never deal with payments and credit card information.

On Wed, Apr 6, 2011 at 8:37 AM, Kenneth Gonsalves wrote:

> On Wed, 2011-04-06 at 08:25 +0200, Isaac XxX wrote:
> > Paypal seems to be clear at how to manage, but I don't know really how
> > to
> > manage credit card data: can be stored? shall I transfer directly that
> > ssl
> > channeled data to my bank? shall I manage it handly?
>
> are you *sure* you want to handle credit cards by your self? I think
> such things stopped somewhere in the last century - the safest way is to
> use some credit card gateway.
> --
> 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.
>
>

-- 
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: E-Commerce - Payment

2011-04-06 Thread Mike Ramirez
On Tuesday, April 05, 2011 11:25:12 pm Isaac XxX wrote:
> Hi folks,
> 

> Paypal seems to be clear at how to manage, but 

Use a gateway service, much easier and less costly.

>I don't know really how to  manage credit card data:? can be stored? 

Yes but the infrastructure is important on how all this is handled, I worked 
for a comapny that channeled its cc payments to an internal oracle server 
which there passed the data to the cc service.  The cc data was routed through 
webserver to the internal network, to the app, to the oracle server. all over 
an encrypted channel.  From there it was processed and payment made/recieved.  
This is the only place oracle existed on the network, the site was driven by 
mysql clusters.  The reason for choosing oracle was transaction support, they 
were using mysql 4.x. This was in 2004/05. This is also a large company with 
lots of resources.

Note, the oracle server was well defended and locked down. 

You would want to store everything encrypted and have only trusted folks in 
charge of it. Data security companies have had breeches in security, most 
these being caused by the employees of the data center. This is just the tip 
of the iceburg so to speak. It's just easier to use a gateway service.

this recent thread has good information on them with django: 
http://groups.google.com/group/django-
users/browse_frm/thread/45794a54c2e3f466/16288a41d7e628ce?hl=en=gst=Payment+Gateway


Mike


-- 
"A great many people think they are thinking when they are merely rearranging 
their prejudices."
-- William James

-- 
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: E-Commerce - Payment

2011-04-06 Thread Kenneth Gonsalves
On Wed, 2011-04-06 at 08:25 +0200, Isaac XxX wrote:
> Paypal seems to be clear at how to manage, but I don't know really how
> to
> manage credit card data: can be stored? shall I transfer directly that
> ssl
> channeled data to my bank? shall I manage it handly? 

are you *sure* you want to handle credit cards by your self? I think
such things stopped somewhere in the last century - the safest way is to
use some credit card gateway.
-- 
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.



E-Commerce - Payment

2011-04-06 Thread Isaac XxX
Hi folks,

after some time spent in investigating django solutions for shopping carts,
i got satchmo as my one. I've developed a custom shopping cart, and this app
is ready to be published. The problem arised when I started to look for some
information about how to manage payments: all information is abstract and
nothing concise. By now, I only want to manage credit card payments
directly, bank transfers and maybe a paypal alternative.

Paypal seems to be clear at how to manage, but I don't know really how to
manage credit card data: can be stored? shall I transfer directly that ssl
channeled data to my bank? shall I manage it handly?
A good documentation source is really wellcome.

I know it is a transversal issue to django, but by now I don't know where to
ask it.

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.