Re: Do you need to include the PK when using unique_together?

2008-04-06 Thread Malcolm Tredinnick


On Sun, 2008-04-06 at 19:54 -0700, meppum wrote:
> Is the PK implied when using unique_together or do you need to include
> it?

No. Since all primary key values are unique, it wouldn't make sense to
include them in any unique_together sequence.

Regards,
Malcolm

-- 
On the other hand, you have different fingers. 
http://www.pointy-stick.com/blog/


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



Re: Repeat a string X times, where X is a database value.

2008-04-06 Thread Lee Hinde

Terrific. Thanks.

On Apr 6, 7:30 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> I would make a filter there takes a string and repeats it the number
> of times in the arg.
>
> On Apr 6, 9:27 pm, Lee Hinde <[EMAIL PROTECTED]> wrote:
>
> > Hi;
>
> > i have a database field "pricing_level". It's an int between 1 and 5.
>
> > In a web page, I'm iterating through a list of products and I want to
> > display something like:
>
> >         {% for p in Prod %}
> >                {{p.product_level*"$"}}
> >         {% endfor %}
>
> > (along with a bunch of other stuff, of course.)
>
> > The output in this sample would be,
> > $$
> > $$$
> > $
> > 
>
> > etc.
>
> > I didn't see a straight ahead way to do this. What would you suggest?
>
> > 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Making login work with every page.

2008-04-06 Thread shabda

If a user is not logged in, then on each page, I have a login form.
This form posts to /accounts/login/ which does calls
contrib.auth.views.login. This view only logs in a user if the
session.test_cookie_worked().

So this means that from each page I need to call,
if not request.user.is_authenticated():
if not request.session.test_cookie_worked():
request.session.set_test_cookie()

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



Re: Repeat a string X times, where X is a database value.

2008-04-06 Thread [EMAIL PROTECTED]

I would make a filter there takes a string and repeats it the number
of times in the arg.

On Apr 6, 9:27 pm, Lee Hinde <[EMAIL PROTECTED]> wrote:
> Hi;
>
> i have a database field "pricing_level". It's an int between 1 and 5.
>
> In a web page, I'm iterating through a list of products and I want to
> display something like:
>
>         {% for p in Prod %}
>                {{p.product_level*"$"}}
>         {% endfor %}
>
> (along with a bunch of other stuff, of course.)
>
> The output in this sample would be,
> $$
> $$$
> $
> 
>
> etc.
>
> I didn't see a straight ahead way to do this. What would you suggest?
>
> 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Repeat a string X times, where X is a database value.

2008-04-06 Thread Lee Hinde

Hi;

i have a database field "pricing_level". It's an int between 1 and 5.

In a web page, I'm iterating through a list of products and I want to
display something like:

{% for p in Prod %}
   {{p.product_level*"$"}}
{% endfor %}

(along with a bunch of other stuff, of course.)

The output in this sample would be,
$$
$$$
$


etc.

I didn't see a straight ahead way to do this. What would you suggest?

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Can POST data be stuck?

2008-04-06 Thread Eric VW

Hey Everyone,

I was wondering if someone could click glance over (http://dpaste.com/
43498/) and let me know if there is any chance that POST data could be
stuck on successfull submission or not.  I thought I thoroughly tested
this with multiple submits, refreshes, and combinations thereof, but
some student who was submitting to my autograder claims that when he
"clicked refresh" that it re-submitted the data, but what is strage
the ``refreshs'' were 5 minutes apart.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Making user emails unique

2008-04-06 Thread Julien

Thanks for the snippet Michael, it is quite useful. Now hopefully my
users won't risk to register with an already-existing email address.

However, as you said, I'd like something a bit more consistent so to
avoid bad surprises. Forking the contrib.auth is quite tempting, but
I've had bad experiences with that kind of practice in the past (I
used a patch for contrib.auth that implemented newforms instead of
oldforms, but I later realised it was buggy and had to revert to the
original version).

In fact, I'd prefer to leave what comes with Django, including contrib
apps, untouched. So that I can benefit from bug fixing and
implementation of new features done by the community.

How about hijacking the User EmailField definition with Python
setattr? Would that be possible/safe and how?

Cheers!

Julien

On Apr 7, 1:28 am, Michael <[EMAIL PROTECTED]> wrote:
> I have this style of e-mail usernames for my sites and where it might be not
> as tight as possible, I have an implementation that works.
>
> > 1) Make sure that emails are unique. According to the thread [1]
> > there's no straight forward solution other than patching Django, and I
> > hate patching Django. But maybe since that thread there's been new
> > features allowing to do that without patch?
>
> >http://groups.google.com/group/django-users/browse_thread/thread/8712...
>
> In an environment that has users register on the site, django-registration
> offers a form that checks for uniqueness of the email address. This works
> well as it stops users from registering with duplicate email addresses. The
> key next is to make sure no one who has access to add more users directly
> doesn't add someone with the same e-mail address.
>
> If this is important for you what I would recommend is pulling contrib.auth
> out of the django package into your project and customize it. Contrib apps
> are just that, apps. Just make sure all your settings.py paths point to the
> new one. You can add a few lines of code to the add_view of auth straight
> from django-registration to make sure e-mail is unique. Once you do that you
> should have unique e-mails all around and you didn't need to touch the
> django package, just use a chunk of code.
>
>
>
> > 
>
> > 2) Generate usernames automatically, since they're not really used
> > anymore but can't stay blank. For example, automatically setting a new
> > user name to "user_8371" if 8371 is the user id. How could I do that,
> > since the User class is built in Django?
>
> I extended a django-registration class to accomplish this. I just put it up
> on djangosnippets.org. Check it outhttp://www.djangosnippets.org/snippets/686/
>
> Hope that helps,
>
> Michael
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Calendar app: how to model reccurring events?

2008-04-06 Thread Michael Richardson

> I'm in the process of writing my first Django project, which has a
> calendar application. I'm not quite sure how I should model reccurring
> events. My first idea was to use a Event table (containing all the
> event data), and a RecurringEvent table which has only two rows:
> parent (ForeignKey to an event instance) and date. If the event is a
> weekly event, I just insert, say, 52 recurring events and insert more
> with a daily cronjob if necessary. Problem is, to the user there
> should be no difference in viewing and handling normal events and
> recurring events, which is a little hard with this design. Fetching
> normal events and recurring events with a single queryset seems not to
> be possible, too.

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



Re: ModelForms check if value has changed.

2008-04-06 Thread Michael
Inside the clean method you have access to self.instance.pk, which returns
true if there an instance (with an already established primary key) or false
if there isn't already an instance.

Hope that helps,

Michael

On Sun, Apr 6, 2008 at 5:44 PM, Petar <[EMAIL PROTECTED]> wrote:

>
> Dear someone,
>
> I have a ModelForm for my User (standard django) model. I want to
> check if the email is unique so I created a clean_email method which
> works fine. The only problem is that I only want to check the email
> address when it's changed.
>
> Is their a way to get the 'initial' value of the email formfield and
> only perform a check if it has changed?
>
> Thanks in advance,
> Pero
> >
>

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



Re: Calendar app: how to model reccurring events?

2008-04-06 Thread Malcolm Tredinnick


On Sun, 2008-04-06 at 11:39 -0700, Benjamin Wohlwend wrote:
[...]
> That's what I found out pretty soon after trying to implement it. I
> 'solved' it by storing the type of the child event in the Event table
> and, if necessary, descending to the particular event, depending on
> the stored type. This works well, however I think this approach is
> first of all a hack and second of all probabely quite query-intensive.

I think it's the right way to handle things if you need to be able to
descend on an object-by-object basis. It's one query per object *if* you
access something in the child class. But if you only need to test the
type of the child, or *if* there's a child, it's free.

> > It depends a bit on what you're wanting to use this data for. There was
> > quite a discussion about modelling this sort of information a year ago
> > on this list that might be of interest to you. 
> > Seehttp://groups.google.com/group/django-users/browse_frm/thread/ed0dc08...for
> >  the full thread.
> >
> > I feel that the modelling discussed there is probably a bit more
> > appropriate for this sort of problem that recording a row for every
> > single occurrence. Rather, store the event, some auxilliary stuff like
> > start and end and repeating recurrence. It's then not too hard to pull
> > out a bunch of candidate events for any given date and filter them
> > further in Python  (perhaps via a method on the model) to see if they
> > occur on the date you're interested in. Basically, moving a bunch of the
> > computations into Python and out of the database, which isn't a crazy
> > idea.
> 
> The problem with this design is that recurring events are more or less
> copies of the original single event. I'd really like to keep my
> recurring events editable (i.e. if the user wants to add information
> to the description of one recurring event while leaving the original
> event and the other recurrences alone).

I'd be using "copy-on-demand" here, if it was me. If they try to edit a
recurring date, create a single event from that recurring event for the
particular date and give it a pointer back to the appropriate recurring
event. So you can still

- select all events that might occur on a given date (and filter
further fairly quickly in Python to throw out the recurring
events that don't occur).

- select all events related to a particular recurring event if
you're deleting it.

- when deleting a single event, note that it's part of a
recurring event and take appropriate related action.

Alternatively, make everything a single event, but have a flag that
points to an id for each recurring event. After all, it sounds like the
only extra information in a recurring event is that it is recurring. So
give all the single events that are part of one recurring event the same
id value for a foreign key field (the RecurringEvent model is really
just an id value, in that case).

Anyway, there are obviously lots of choices here. Interval data and
scheduling stuff are always a little fiddly in SQL, so there's going to
be some thinking here. But you're not short of options.

Regards,
Malcolm

-- 
If it walks out of your refrigerator, LET IT GO!! 
http://www.pointy-stick.com/blog/


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



Re: Creating a Random Hash for Invitations

2008-04-06 Thread Alex Ezell

On Sun, Apr 6, 2008 at 1:38 PM, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
>
>  The way I would handle it is in the save method of the invitation
>  model I would do:
>  def save(self, *args, **kwargs):
> if not self.pk:
> #This is a new invite, we need to generate the code
> self.hash = do_something_to_generate_the_hash
> super(Invite, self).save(*args, **kwargs)

Thanks Alex!

Overriding the save had occurred to me. I wasn't sure if there was
something more built-in. I'm still not sure that my plan is the best
way. I'm always wary of sending emails from the system to addresses
which people have not knowingly provided.

/alex



>
>  On Apr 6, 1:31 pm, "Alex Ezell" <[EMAIL PROTECTED]> wrote:
>  > My use case is that I need to send invites via email to people. These
>  > are not site users, but are people being invited to join the site (and
>  > a particular group on this site) by current users. So, I can't ask
>  > them to login, because I have no data about them.
>  >
>  > They would then click the link in the email and the site would use the
>  > random hash value in the url to look up the invite and then do
>  > whatever else it needs to do for that type of invitation.
>  >
>  > I'm doing this so that there is at least a modicum of protection from
>  > someone just incrementing the values in the URL to mess with the
>  > invite system. It, by no means, needs to be "secure" which this method
>  > would clearly not be.
>  >
>  > Think of the model of a member of a Facebook group entering a friend's
>  > email and inviting them to join the group. But that friend may or may
>  > not be a user of the site.
>  >
>  > My question is: What's the best way to create this random hash when
>  > the invitation is saved? Can I do it with some default in the model?
>  >
>  > I'd also welcome any perspective on handling this use case better.
>  > I've only just begun thinking through it.
>  >
>  > Thanks!
>  >
>  > Alex
>  >
>

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



Re: Can't post anything to django website, it says i'm spam.

2008-04-06 Thread Karen Tracey
On Sun, Apr 6, 2008 at 5:52 PM, Javier <[EMAIL PROTECTED]> wrote:

>
> Hi,
>
> I've been editing the DevelopersForHire page and I get a possible spam
> message.
> If i go with a proxy it says that too but adds that i've more links
> than the allowed max number.
>
> Also, i wanted to add a ticket about this but i got the same messages.
>
> I'm not spamming, look, I'm a human =)
>

If you set up some session settings here:

http://code.djangoproject.com/settings

you'll likely not get the spam checker problem.  Or, if that doesn't work,
you can create an account here:

http://www.djangoproject.com/accounts/register/

and then you'll be exempt from the spam filter.

Karen

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



lighttpd & django, fcgi issues

2008-04-06 Thread skunkwerk

I'm having trouble running django with lighttpd (I'm not on a shared
host).  Here is what I've installed:

ubuntu 7.10
lighttpd
flup
cmemcache
python

When I go to my web address which maps to the django project
directory, all I see is a directory listing, not any django pages.

I started fcgi like this, as in the docs:
./manage.py runfcgi method=threaded host=127.0.0.1 port=3033

have this in my lighttpd.conf:
server.modules  = (
"mod_access",
"mod_alias",
"mod_accesslog",
"mod_compress",
"mod_fastcgi",
 )

fastcgi.server = (
"/mnt/project/mysite.fcgi" => (
"main" => (
"host" => "127.0.0.1",
"port" => 3033,
"check-local" => "disable",
)
),
)

and the mysite.fcgi file:
#!/usr/local/bin/python
import sys,os

sys.path.insert(0,"/mnt/project")
os.chdir("/mnt/project")
os.environ['DJANGO_SETTINGS_MODULE']="settings"
from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded",daemonize="false")

I restarted lighttpd but it's still the same.  If I add a 'bin-path'
to the fcgi.server I get an error when I restart lighttpd.

1)  any suggestions on how to get this working?
2)  my DJANGO_SETTINGS_MODULE is pointing to settings.py in my django
project, as I couldn't find any project_settings.py or anything - is
this correct?
3)  for the fastcgi.server() do i need to give it the path of
the .fcgi file?

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



Can't post anything to django website, it says i'm spam.

2008-04-06 Thread Javier

Hi,

I've been editing the DevelopersForHire page and I get a possible spam
message.
If i go with a proxy it says that too but adds that i've more links
than the allowed max number.

Also, i wanted to add a ticket about this but i got the same messages.

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



ModelForms check if value has changed.

2008-04-06 Thread Petar

Dear someone,

I have a ModelForm for my User (standard django) model. I want to
check if the email is unique so I created a clean_email method which
works fine. The only problem is that I only want to check the email
address when it's changed.

Is their a way to get the 'initial' value of the email formfield and
only perform a check if it has changed?

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



writing a view similar to generic view

2008-04-06 Thread stranger

Hello all,

   I am writing a simple blog app. I wrote a post and comment
model where I need views to serve them. I could use generic views but
I think I cannot due to the fact that comment model needs to link to
post model.
So i am writing a view which serves url like:
http://example.com/blog/2008/apr/06/slug

To write a view I need to match all the four items year, month, date,
slug. So I want to write a helper.py with

def get_post(year, month, day, slug):
year, month = int(year), month, int(day)

try:
return Post.objects.get(
pub_date__year=year, pub_date__day=day, slug__exact=slug)
except Post.DoesNotExist:
raise Http404

As you can see my month is in 'Apr' format how to match them with
month in pub_date.

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



Re: Use django auth db for phpbb?

2008-04-06 Thread Peter Rowell

> - Make PhpBB Use the django auth
This is probably the way to go.

>I have not the slightest clue on where to start


There is no "magic" in the django database. It is just a vanilla MySQL/
PostgreSQL database with vanilla tables. The table you are interested
in is auth_users. The only required fields are username and password.
django/contrib/auth/models.py is the file to study.

The password is stored as either an MD5 or SHA1 digest with a prefix
indicating which algorithm  + '$' +  a "salt" which further randomizes
the value + '$'.  Older Django DBs used only MD5, so if you don't see
a $ in the password, then it's MD5 with no salt.

E.g. sha1$4dd23$4f9d9e3eb5dfebae1c2337e3c26842daf5f1cad1

SHA1 is the method, 4dd23 is the salt and
4f9d9e3eb5dfebae1c2337e3c26842daf5f1cad1 is the hash.

Look at get_hexdigest (in the same file) for more specific info.

It should be fairly straightforward to access and check this from your
PHP code.

  HTH,
  Peter

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



Re: Serving binary files "through" django

2008-04-06 Thread Tim Sawyer

On Saturday 05 Apr 2008, Matthias Kestenholz wrote:
> On Sat, 2008-04-05 at 20:19 +0100, Tim Sawyer wrote:
> > Hi Folks,
> >
> > I'd like to have a site that gives away and sells PDFs, and tracks
> > downloads of those PDFs.  For example, I'd like to know the IP
> > address/useragent of who downloaded the free files, and I'd like to
> > record the same plus the logged in user for the pay ones (after
> > authenticating the user is allowed to download that file).
>
> You could try something like that:
>
> from django.http import HttpResponse
> from testing.models import DownloadCounter
>
> class MyFile(file):
>def __init__(self, filename, *args, **kwargs):
>   self.filename = filename
>   super(MyFile, self).__init__(filename, *args, **kwargs)
>
>def close(self):
>   super(MyFile, self).close()
>   cnt, created = DownloadCounter.objects.get_or_create(
>  filename=self.filename, defaults={'count':0})
>   cnt.count += 1
>   cnt.save()
>
> def blah(request):
>return HttpResponse(MyFile('views.py'),
>   mimetype='application/octet-stream')

Cheers everyone for your ideas, I'm going with the approach at the moment.

Thanks again,

Tim.

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



Use django auth db for phpbb?

2008-04-06 Thread truebosko

I am in an odd situation where I need to use a django auth database
for a phpbb forum for a friend of mine.

He wants the phpbb forums but he is not happy with users having to
register for both the phpbb and django side (Which is the main site)

My options are:
- Whenever a person makes an account on the django site, create a
phpbb forum account, and vice versa. Problem: Not sure how to get the
same password hashes that django and phpbb uses on the different code
platforms.
- Make PhpBB Use the django auth .. This would be best but I have no
idea how to do it. I've seen phpbb can use separate auths but looking
at the files I have not the slightest clue on where to start in
writing one.

Any help would be awesome .. 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django on a shared host

2008-04-06 Thread Tim Chase

> I just sent a reply, but I guess I don't know how to use Google groups
> so well (sorry). I think it went directly to the author instead of
> posting here.

Yes indeed, it did go directly to me :)

> Basically I don't understand Tim's answer and could it
> be explained a bit more?

I'll see what I can do.  For the others on the list, I also got 
the following via direct email:

> Hi, I am a complete moron. Will you translate this into English? ;)
> 
> What do you mean by $PYTHONPATH and how do you "include" something?

PYTHONPATH is an optional environment variable that instructs 
Python where to look for modules to load.  If it's not set, 
Python uses a select few places that can be shown by issuing

   bash$ python
   [copyright info]
   >>> import sys
   >>> sys.path
   [output of all the places Python looks for modules that can be 
"import"ed]

You can set your PYTHONPATH first:

   bash$ export PYTHONPATH=/path/to/someplace/not/in/sys.path/
   bash$ python
   [copyright info]
   >>> import sys
   >>> sys.path
   [output of all the places Python looks for modules that can be 
"import"ed which should now include "/path/to/..." which I 
believe falls at the beginning of the list]

Django is just a Python module (or group of modules), so the 
"installation" just involves putting the contents someplace in 
the sys.path.  If you run the default install as an admin, 
Django's files get dropped in the system-wide Python module 
repository.  For me here, that's likely 
/usr/lib/python2.4/site-packages/ but may vary depending on your 
setup/OS.

If you're not the administrator (or, like me, you want to install 
various versions of Django and flip between them), you can just 
so something like the following, choosing case #1 or #2 depending 
on what tools you have access to:

   bash$ cd ~/code
1 bash$ # if you have subversion installed:
1 bash$ svn co http://code.djangoproject.com/svn/django/trunk/ django
2 bash$ # if you don't have subversion installed, but have a .tgz
2 bash$ # snapshot of Django
2 bash$ tar xvfz django.tgz
   bash$ export PYTHONPATH=~/code/django
   bash$ python
   [copyright info]
   >>> import django
   [if all went well, no traceback here]

The secondary problem is that PYTHONPATH needs to be set every 
time a new environment is launched.  In the above example, that 
means that if you log out and log back in again, you have to set 
PYTHONPATH again.  For interactive work, you can set PYTHONPATH 
in your .bashrc/.profile startup file so it gets set every time 
you log in.

However, in a mod_python (and likely mod_wsgi, fastcgi, or 
lighttpd setup) you need to use the config-option du-jour to tell 
your hosting where to find Django and where to find your project:

http://www.djangoproject.com/documentation/modpython/

Thus, you might need your apache config to have a line like

   PythonPath ['/home/snoop/code/django', 
'/home/snoop/code/myproj'] + sys.path

so that mod_python can find both Django's source/modules, and 
your own code in your ~/code/myproj directory.

> So I went to run the installation again to keep a keen eye on what was
> happening, but THIS time it's saying "permission denied" (that didn't
> happen before).

I'm guessing that since you're a non-root user, you don't have 
rights to put Django's modules in the site-wide directory.

> Searching the net for an answer, this one is the closest that
> resembles my issue. But I do not understand your answer.

So you need to instruct the setup to install some place that you 
*can* write (I don't know exactly how to do this, but I'm sure 
one of the many other smart folks on the list will leap in here 
with the right option to pass to setup.py) which would be 
something like

   python setup.py --base=/home/snoop/code/django install

or, as above, you can install the development version either from 
Subversion or, if you have SVN on another machine, you can check 
it out there and then push a tar-ball down to the server, 
un-tar/gzipping there.

This still all assumes that your webhost has support for running 
Django (either mod_python, mod_wsgi, or some other supported 
non-CGI variant)


> Thanks.

Hope this helps.  For the list archive purposes, I've included my 
original email that papertrail included.

-tim

> On Feb 27, 9:15 am, Tim Chase <[EMAIL PROTECTED]> wrote:
>>> I am new to django (coming from ruby on rails) and I want to setup a
>>> django application on a free webhost.
>> A free webhost that allows Django?  Even if it's fairly limited,
>> this is interesting.  Can you tell more?
>>
>>> I have ssh access and executed
>>> the install scriped. But I am not allowed to write in the /usr/
>>> folder, is there any way to install django without writing in the /
>>> usr/ folder ?
>>> Here is the Error :
>>> creating /usr/lib/python2.3/site-packages/django
>>> error: could not create '/usr/lib/python2.3/site-packages/django':
>>> Permissiondenied
>> Django doesn't need to be installed...it merely needs to be in
>> your 

Re: Django on a shared host

2008-04-06 Thread papertrail

I just sent a reply, but I guess I don't know how to use Google groups
so well (sorry). I think it went directly to the author instead of
posting here. Basically I don't understand Tim's answer and could it
be explained a bit more?

Thanks.

On Feb 27, 9:15 am, Tim Chase <[EMAIL PROTECTED]> wrote:
> > I am new to django (coming from ruby on rails) and I want to setup a
> > django application on a free webhost.
>
> A free webhost that allows Django?  Even if it's fairly limited,
> this is interesting.  Can you tell more?
>
> > I have ssh access and executed
> > the install scriped. But I am not allowed to write in the /usr/
> > folder, is there any way to install django without writing in the /
> > usr/ folder ?
>
> > Here is the Error :
>
> > creating /usr/lib/python2.3/site-packages/django
> > error: could not create '/usr/lib/python2.3/site-packages/django':
> >Permissiondenied
>
> Django doesn't need to be installed...it merely needs to be in
> your $PYTHONPATH environment.  Thus, you can simply copy the
> Django files (or do a Django checkout from the SVN repo) into
> some place in your home directory, and then configure your
> deployment to include that directory in your $PYTHONPATH.  You
> omit the details of what your server is (Apache?  lighttpd?) so
> the particulars of this vary.  However, the basic gist would be
> to do something like
>
>cd ~
>tar xvfz django-0.96.tgz
>
> and then include /home/snoop/django-0.96 in your $PYTHONPATH
>
> or, if you want the development head and subversion is installed
> on your host (if so, I'm *really* interested in this free host):
>
>cd ~
>svn cohttp://code.djangoproject.com/svn/django/trunk/
> django-trunk
>
> and include /home/snoop/django-trunk in your $PYTHONPATH.
>
> -tim
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Calendar app: how to model reccurring events?

2008-04-06 Thread Benjamin Wohlwend

Hi Malcom,

thanks for your thorough answer!

On Apr 6, 6:29 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Sat, 2008-04-05 at 02:49 -0700, Benjamin Wohlwend wrote:
>
> > I'm tending to the second design, since I would be able to combine
> > both event types in a single queryset.
>
> Well, probably not as you would expect. If you do a query on the Event
> model, even with model inheritance in place, you will get back a bunch
> of Event objects. Not a collection of SingleEvent and RecurringEvent
> objects. That is, Django will only query the Event table (working out
> the types of the most descended model possible is an ineffecient query).
>
> You can get from an Event to a SingleEvent or RecurringEvent, via an
> attribute, but what you can't tell easily is whether the particular
> Event is the parent of a SingleEvent or the parent of a RecurringEvent.

That's what I found out pretty soon after trying to implement it. I
'solved' it by storing the type of the child event in the Event table
and, if necessary, descending to the particular event, depending on
the stored type. This works well, however I think this approach is
first of all a hack and second of all probabely quite query-intensive.

>
> It depends a bit on what you're wanting to use this data for. There was
> quite a discussion about modelling this sort of information a year ago
> on this list that might be of interest to you. 
> Seehttp://groups.google.com/group/django-users/browse_frm/thread/ed0dc08...for
>  the full thread.
>
> I feel that the modelling discussed there is probably a bit more
> appropriate for this sort of problem that recording a row for every
> single occurrence. Rather, store the event, some auxilliary stuff like
> start and end and repeating recurrence. It's then not too hard to pull
> out a bunch of candidate events for any given date and filter them
> further in Python  (perhaps via a method on the model) to see if they
> occur on the date you're interested in. Basically, moving a bunch of the
> computations into Python and out of the database, which isn't a crazy
> idea.

The problem with this design is that recurring events are more or less
copies of the original single event. I'd really like to keep my
recurring events editable (i.e. if the user wants to add information
to the description of one recurring event while leaving the original
event and the other recurrences alone).

My, again quite hackish, solution for this particular problem was to
use properties on the RecurringEvent, which return the attribute of
the related single event if the own attribute is NULL/None. It works
for my use case so far, but of course things like forms.ModelForm
ignore such ugly trickery.

Anyway, I'll probably contemplate a few more hours over this question
as I've got a bit of a bad feeling in the gut with my current
solution.

Thanks again,

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



Re: Creating a Random Hash for Invitations

2008-04-06 Thread [EMAIL PROTECTED]

The way I would handle it is in the save method of the invitation
model I would do:
def save(self, *args, **kwargs):
if not self.pk:
#This is a new invite, we need to generate the code
self.hash = do_something_to_generate_the_hash
super(Invite, self).save(*args, **kwargs)

On Apr 6, 1:31 pm, "Alex Ezell" <[EMAIL PROTECTED]> wrote:
> My use case is that I need to send invites via email to people. These
> are not site users, but are people being invited to join the site (and
> a particular group on this site) by current users. So, I can't ask
> them to login, because I have no data about them.
>
> They would then click the link in the email and the site would use the
> random hash value in the url to look up the invite and then do
> whatever else it needs to do for that type of invitation.
>
> I'm doing this so that there is at least a modicum of protection from
> someone just incrementing the values in the URL to mess with the
> invite system. It, by no means, needs to be "secure" which this method
> would clearly not be.
>
> Think of the model of a member of a Facebook group entering a friend's
> email and inviting them to join the group. But that friend may or may
> not be a user of the site.
>
> My question is: What's the best way to create this random hash when
> the invitation is saved? Can I do it with some default in the model?
>
> I'd also welcome any perspective on handling this use case better.
> I've only just begun thinking through it.
>
> Thanks!
>
> Alex
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Creating a Random Hash for Invitations

2008-04-06 Thread Alex Ezell

My use case is that I need to send invites via email to people. These
are not site users, but are people being invited to join the site (and
a particular group on this site) by current users. So, I can't ask
them to login, because I have no data about them.

They would then click the link in the email and the site would use the
random hash value in the url to look up the invite and then do
whatever else it needs to do for that type of invitation.

I'm doing this so that there is at least a modicum of protection from
someone just incrementing the values in the URL to mess with the
invite system. It, by no means, needs to be "secure" which this method
would clearly not be.

Think of the model of a member of a Facebook group entering a friend's
email and inviting them to join the group. But that friend may or may
not be a user of the site.

My question is: What's the best way to create this random hash when
the invitation is saved? Can I do it with some default in the model?

I'd also welcome any perspective on handling this use case better.
I've only just begun thinking through it.

Thanks!

Alex

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



Problem with static content + Apache / FastCGI

2008-04-06 Thread Tourneur Henry-Nicolas

Hello,

With the development server, I use the following line to manage static 
content :

(r'^site_media/(?P.*)$', 'django.views.static.serve', 
{'document_root': '/var/www/nicolas/sites/NetPool/web/media/'}),

But now, when I run my apps with Apache and FastCGI, it seems that my requests 
to site_media are not handled any more.

Instead, apache try to read /var/www/site_media which doesn't exist.

I'm running django 0.96.

If you have an idea this would be really great to help me.
-- 
Tourneur Henry-Nicolas

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



Re: ImageField links in admin going no-where

2008-04-06 Thread bergstyle

I got this working. My media url wasn't setup right. If anyone else
encounters this issue. I setup my media_url in the settings file and
then I point /media to that directory in the web server config. Then
for the admin files I created a symlink to them from inside my regular
media directory.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Project Topology

2008-04-06 Thread Aaron Blew
I definitely want to be able to have any app easily retrieve data from
another.  I suppose I'm thinking of each app as a simple web service.  Is
that a reasonable way to approach it, or should I only separate on
significantly different logical functions (ie a couple different models that
just have data that's stored and displayed would be separate from the thing
that reports (graphing, etc.) on sales, in the store example?

Thanks,
-Aaron

On Sun, Apr 6, 2008 at 9:03 AM, Michael <[EMAIL PROTECTED]> wrote:

> You can do it both ways. It depends on your code. How interrelated do you
> want your items?
>
> Make sure to check out satchmo http://www.satchmoproject.com/ it might
> already have done some of this for you.
>
>
> On Sun, Apr 6, 2008 at 2:43 AM, <[EMAIL PROTECTED]> wrote:
>
> >
> > Hi all,
> > So I'm in the middle of thinking about my first Django project.  The
> > project will have different sections for the end-user to access like
> > Customer Information, Store and Checkout, for example.  Should these
> > "sections" of the Project be divided up into different applications or
> > should they fall under the same application?  Are there any rules of
> > thumb for this?
> >
> > Thanks,
> > -Aaron
> >
> >
>
> >
>

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



ImageField links in admin going no-where

2008-04-06 Thread bergstyle

One of my models has an ImageField. The image file uploading and
removing works correctly but in the Admin interface it display a link
to see the image. Here's what the link looks like:
http://admin.domain-dev.com/admin/appname/product/6/product_images/raw/bptestimage.jpg

The problem is I just get a 404 when I click on it. How would I get
this to actually show the image? Seems like it would require a custom
and complex entry in the urls config but I'm not sure how to express
it in that format. Also why isn't the link a proper link to the media
url?

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



Re: Configure Mod_Python fo Django on Apache server on Ubuntu

2008-04-06 Thread HangingClowns

Alright, what I'm saying is that, it STILL didn't work with the 777
permission, but, my other websites worked with 777. That's what I
meant to say, but I'm still getting the "EnvironmentError: Could not
import settings 'mysite.settings' (Is it on sys.path? Does it have
syntax errors?): No module named mysite.settings" error.

On Apr 6, 11:09 am, Michael <[EMAIL PROTECTED]> wrote:
> The fact that it works with 777 permisions means that it was a permissions
> issue. Be really careful with 777 permissions however on your server that
> gives full read write execute permissions to everyone. THAT INCLUDES WEB
> USERS. It won't take much to hack your system if you grant full permissions
> to your public_html folder.
>
> On Sun, Apr 6, 2008 at 12:05 PM, HangingClowns <[EMAIL PROTECTED]> wrote:
>
> > Well, after I followed your advice for putting webmastr in the www-
> > data group, I was getting 403 errors and forbidden errors on all of my
> > sites, so I 777 public_html recursively, so now it's all running, I'd
> > suppose that Apache should have access to it. So, from there on, I'm
> > lost at what could be the problem. I know Mod_Python is working, I
> > know Python is working, I know Apache is passing off to Mod_Python, I
> > just don't know why it can't find the project.
>
> > On Apr 6, 10:47 am, Michael <[EMAIL PROTECTED]> wrote:
> > > > I've worked on putting Django on a Red Hat machine, and I've noticed
> > > > that the Ubuntu version of Apache is a bit different. But, in any
> > > > case, In my /etc/apache2 httpd.conf I have:
>
> > > Debian packages are always different in how they are initially set up,
> > but
> > > Apache works the same in most instances. If you have a conf file that
> > works
> > > in red hat, as long as all the modules and the directories are the same,
> > it
> > > should work in Ubuntu (also make sure that you have the same apache
> > > versions).
>
> > > I always find that with Apache simplicity is best. I would go through
> > each
> > > line of the http.conf and ask myself what is it doing here, etc. The
> > apache
> > > docs are pretty good at figuring out what is going on.
>
> > > > 
> > > >DirectoryIndex index.html index.php
> > > > 
>
> > > For example, do you know what this is doing? I am not saying it is you
> > > problem, but it looks like it was copied from somewhere. Do you know if
> > you
> > > have dir_module on or off. Is this DirectoryIndex being applied?
>
> > > > 
> > > >SetHandler python-program
> > > >PythonHandler django.core.handlers.modpython
> > > >SetEnv DJANGO_SETTINGS_MODULE mysite.settings
> > > >PythonDebug On
> > > > PythonInterpreter mysite
> > > > PythonPath "['/home/webmastr/public_html/django']+sys.path"
> > > > 
>
> > > > And that's it. Excluding the /media, it should still show something,
> > > > I'd believe, or am I wrong?
>
> > > This looks right to start up a django site. Is there a
> > > /home/webmastr/public_html/django/mysite/settings.py file. Does apache
> > have
> > > permissions to get to it? To what Server/virtualmachine, port is apache
> > > executing this Location.
>
> > > The media is only important to serve static files directly through
> > apache so
> > > Django doesn't have to deal with them. If these instructions and the
> > Django
> > > docs aren't working, you need to look into configuring apache. There are
> > > tons of sites that explain this. Just do a search for configuring
> > apache.
> > > Every server is different and your needs are going to be different, just
> > > copying what other people won't work until you have a basic
> > understanding of
> > > this. On a lovely Sunday you can learn enough about Apache to get django
> > > running.
>
> > > Hope that helps,
>
> > > Michael
>
> > > > On Apr 6, 9:52 am, Michael <[EMAIL PROTECTED]> wrote:
> > > > > Hey gang;
>
> > > > > Wow a lotof people are all having the same problem. Somehow the
> > > > conversation
> > > > > I had with the original poster got taken off the list. Here is the
> > next
> > > > > message I sent:
>
> > > > > chmod would change the permissions, but hede a little caution here;
> > > > opening
> > > > > up your home directory allows everyone to get inside there. This
> > might
> > > > not
> > > > > be an issue with your server if you don't have anyone on it who you
> > > > might
> > > > > not be able to trust, but it isn't a bad idea to get in the right
> > habits
> > > > > here.
>
> > > > > What I would recommend if you are a web developer, is to add
> > yourself to
> > > > the
> > > > > group www-data. So in a shell punch in usermod -a -G www-data
> > webmastr
> > > > (I am
> > > > > assuming webmastr is your linux login name here). This will let you
> > just
> > > > > give permissions to people in your group instead of everyone. Then
> > go
> > > > back
> > > > > to /home/webmastr/ and type chmod 750 -r public_html . This will
> > give
> > > > your
> > > > > full read-write-executable access to the 

Re: EmailMessage and BCC fields

2008-04-06 Thread Tim Sawyer

On Sunday 06 Apr 2008, Karen Tracey wrote:
> Update to a revision with the fix for
> http://code.djangoproject.com/ticket/6841, that is r7347 or higher.

Fixed, thanks!

Tim.

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



Re: Configure Mod_Python fo Django on Apache server on Ubuntu

2008-04-06 Thread Michael
The fact that it works with 777 permisions means that it was a permissions
issue. Be really careful with 777 permissions however on your server that
gives full read write execute permissions to everyone. THAT INCLUDES WEB
USERS. It won't take much to hack your system if you grant full permissions
to your public_html folder.

On Sun, Apr 6, 2008 at 12:05 PM, HangingClowns <[EMAIL PROTECTED]> wrote:

>
> Well, after I followed your advice for putting webmastr in the www-
> data group, I was getting 403 errors and forbidden errors on all of my
> sites, so I 777 public_html recursively, so now it's all running, I'd
> suppose that Apache should have access to it. So, from there on, I'm
> lost at what could be the problem. I know Mod_Python is working, I
> know Python is working, I know Apache is passing off to Mod_Python, I
> just don't know why it can't find the project.
>
> On Apr 6, 10:47 am, Michael <[EMAIL PROTECTED]> wrote:
> > > I've worked on putting Django on a Red Hat machine, and I've noticed
> > > that the Ubuntu version of Apache is a bit different. But, in any
> > > case, In my /etc/apache2 httpd.conf I have:
> >
> > Debian packages are always different in how they are initially set up,
> but
> > Apache works the same in most instances. If you have a conf file that
> works
> > in red hat, as long as all the modules and the directories are the same,
> it
> > should work in Ubuntu (also make sure that you have the same apache
> > versions).
> >
> > I always find that with Apache simplicity is best. I would go through
> each
> > line of the http.conf and ask myself what is it doing here, etc. The
> apache
> > docs are pretty good at figuring out what is going on.
> >
> > > 
> > >DirectoryIndex index.html index.php
> > > 
> >
> > For example, do you know what this is doing? I am not saying it is you
> > problem, but it looks like it was copied from somewhere. Do you know if
> you
> > have dir_module on or off. Is this DirectoryIndex being applied?
> >
> >
> >
> > > 
> > >SetHandler python-program
> > >PythonHandler django.core.handlers.modpython
> > >SetEnv DJANGO_SETTINGS_MODULE mysite.settings
> > >PythonDebug On
> > > PythonInterpreter mysite
> > > PythonPath "['/home/webmastr/public_html/django']+sys.path"
> > > 
> >
> > > And that's it. Excluding the /media, it should still show something,
> > > I'd believe, or am I wrong?
> >
> > This looks right to start up a django site. Is there a
> > /home/webmastr/public_html/django/mysite/settings.py file. Does apache
> have
> > permissions to get to it? To what Server/virtualmachine, port is apache
> > executing this Location.
> >
> > The media is only important to serve static files directly through
> apache so
> > Django doesn't have to deal with them. If these instructions and the
> Django
> > docs aren't working, you need to look into configuring apache. There are
> > tons of sites that explain this. Just do a search for configuring
> apache.
> > Every server is different and your needs are going to be different, just
> > copying what other people won't work until you have a basic
> understanding of
> > this. On a lovely Sunday you can learn enough about Apache to get django
> > running.
> >
> > Hope that helps,
> >
> > Michael
> >
> >
> >
> > > On Apr 6, 9:52 am, Michael <[EMAIL PROTECTED]> wrote:
> > > > Hey gang;
> >
> > > > Wow a lotof people are all having the same problem. Somehow the
> > > conversation
> > > > I had with the original poster got taken off the list. Here is the
> next
> > > > message I sent:
> >
> > > > chmod would change the permissions, but hede a little caution here;
> > > opening
> > > > up your home directory allows everyone to get inside there. This
> might
> > > not
> > > > be an issue with your server if you don't have anyone on it who you
> > > might
> > > > not be able to trust, but it isn't a bad idea to get in the right
> habits
> > > > here.
> >
> > > > What I would recommend if you are a web developer, is to add
> yourself to
> > > the
> > > > group www-data. So in a shell punch in usermod -a -G www-data
> webmastr
> > > (I am
> > > > assuming webmastr is your linux login name here). This will let you
> just
> > > > give permissions to people in your group instead of everyone. Then
> go
> > > back
> > > > to /home/webmastr/ and type chmod 750 -r public_html . This will
> give
> > > your
> > > > full read-write-executable access to the files (7), your group
> including
> > > > www-data read-execute permissions (5) and everyone else no
> permissions
> > > (0).
> >
> > > > Hopefully that will get your django install to work. If you want to
> > > learn
> > > > more about linux permissions look here:
> > >http://www.freeos.com/articles/3127/ordoa search for ubuntu
> > > > permissions. There are tons of resourses. Let me
> > > > know how that works,
> >
> > > > Then it became clear that he didn't own that file and I told him to
> look
> > > > into 'chown' to own the 

Re: Configure Mod_Python fo Django on Apache server on Ubuntu

2008-04-06 Thread HangingClowns

Well, after I followed your advice for putting webmastr in the www-
data group, I was getting 403 errors and forbidden errors on all of my
sites, so I 777 public_html recursively, so now it's all running, I'd
suppose that Apache should have access to it. So, from there on, I'm
lost at what could be the problem. I know Mod_Python is working, I
know Python is working, I know Apache is passing off to Mod_Python, I
just don't know why it can't find the project.

On Apr 6, 10:47 am, Michael <[EMAIL PROTECTED]> wrote:
> > I've worked on putting Django on a Red Hat machine, and I've noticed
> > that the Ubuntu version of Apache is a bit different. But, in any
> > case, In my /etc/apache2 httpd.conf I have:
>
> Debian packages are always different in how they are initially set up, but
> Apache works the same in most instances. If you have a conf file that works
> in red hat, as long as all the modules and the directories are the same, it
> should work in Ubuntu (also make sure that you have the same apache
> versions).
>
> I always find that with Apache simplicity is best. I would go through each
> line of the http.conf and ask myself what is it doing here, etc. The apache
> docs are pretty good at figuring out what is going on.
>
> > 
> >DirectoryIndex index.html index.php
> > 
>
> For example, do you know what this is doing? I am not saying it is you
> problem, but it looks like it was copied from somewhere. Do you know if you
> have dir_module on or off. Is this DirectoryIndex being applied?
>
>
>
> > 
> >SetHandler python-program
> >PythonHandler django.core.handlers.modpython
> >SetEnv DJANGO_SETTINGS_MODULE mysite.settings
> >PythonDebug On
> > PythonInterpreter mysite
> > PythonPath "['/home/webmastr/public_html/django']+sys.path"
> > 
>
> > And that's it. Excluding the /media, it should still show something,
> > I'd believe, or am I wrong?
>
> This looks right to start up a django site. Is there a
> /home/webmastr/public_html/django/mysite/settings.py file. Does apache have
> permissions to get to it? To what Server/virtualmachine, port is apache
> executing this Location.
>
> The media is only important to serve static files directly through apache so
> Django doesn't have to deal with them. If these instructions and the Django
> docs aren't working, you need to look into configuring apache. There are
> tons of sites that explain this. Just do a search for configuring apache.
> Every server is different and your needs are going to be different, just
> copying what other people won't work until you have a basic understanding of
> this. On a lovely Sunday you can learn enough about Apache to get django
> running.
>
> Hope that helps,
>
> Michael
>
>
>
> > On Apr 6, 9:52 am, Michael <[EMAIL PROTECTED]> wrote:
> > > Hey gang;
>
> > > Wow a lotof people are all having the same problem. Somehow the
> > conversation
> > > I had with the original poster got taken off the list. Here is the next
> > > message I sent:
>
> > > chmod would change the permissions, but hede a little caution here;
> > opening
> > > up your home directory allows everyone to get inside there. This might
> > not
> > > be an issue with your server if you don't have anyone on it who you
> > might
> > > not be able to trust, but it isn't a bad idea to get in the right habits
> > > here.
>
> > > What I would recommend if you are a web developer, is to add yourself to
> > the
> > > group www-data. So in a shell punch in usermod -a -G www-data webmastr
> > (I am
> > > assuming webmastr is your linux login name here). This will let you just
> > > give permissions to people in your group instead of everyone. Then go
> > back
> > > to /home/webmastr/ and type chmod 750 -r public_html . This will give
> > your
> > > full read-write-executable access to the files (7), your group including
> > > www-data read-execute permissions (5) and everyone else no permissions
> > (0).
>
> > > Hopefully that will get your django install to work. If you want to
> > learn
> > > more about linux permissions look here:
> >http://www.freeos.com/articles/3127/ordoa search for ubuntu
> > > permissions. There are tons of resourses. Let me
> > > know how that works,
>
> > > Then it became clear that he didn't own that file and I told him to look
> > > into 'chown' to own the file.
>
> > > There are four parts to an django site you need to remember exist when
> > > setting it up. You need a media root, where files are served directly by
> > > apache. I always use /media/ as an example. Then you need a project
> > folder
> > > that is where you put all of you python files. The important file here
> > is
> > > settings.py because it tells mod_python (the apache module for python)
> > what
> > > to load and that is how django starts up. The third part is a templates
> > > directory, which is where all the django templates go. The last part is
> > the
> > > SQL we won't get into that here. The media and the templates 

Re: Configure Mod_Python fo Django on Apache server on Ubuntu

2008-04-06 Thread Michael
> I've worked on putting Django on a Red Hat machine, and I've noticed
> that the Ubuntu version of Apache is a bit different. But, in any
> case, In my /etc/apache2 httpd.conf I have:


Debian packages are always different in how they are initially set up, but
Apache works the same in most instances. If you have a conf file that works
in red hat, as long as all the modules and the directories are the same, it
should work in Ubuntu (also make sure that you have the same apache
versions).

I always find that with Apache simplicity is best. I would go through each
line of the http.conf and ask myself what is it doing here, etc. The apache
docs are pretty good at figuring out what is going on.

> 
>DirectoryIndex index.html index.php
> 
>

For example, do you know what this is doing? I am not saying it is you
problem, but it looks like it was copied from somewhere. Do you know if you
have dir_module on or off. Is this DirectoryIndex being applied?


>
> 
>SetHandler python-program
>PythonHandler django.core.handlers.modpython
>SetEnv DJANGO_SETTINGS_MODULE mysite.settings
>PythonDebug On
> PythonInterpreter mysite
> PythonPath "['/home/webmastr/public_html/django']+sys.path"
> 
>
> And that's it. Excluding the /media, it should still show something,
> I'd believe, or am I wrong?
>

This looks right to start up a django site. Is there a
/home/webmastr/public_html/django/mysite/settings.py file. Does apache have
permissions to get to it? To what Server/virtualmachine, port is apache
executing this Location.

The media is only important to serve static files directly through apache so
Django doesn't have to deal with them. If these instructions and the Django
docs aren't working, you need to look into configuring apache. There are
tons of sites that explain this. Just do a search for configuring apache.
Every server is different and your needs are going to be different, just
copying what other people won't work until you have a basic understanding of
this. On a lovely Sunday you can learn enough about Apache to get django
running.

Hope that helps,

Michael

>
> On Apr 6, 9:52 am, Michael <[EMAIL PROTECTED]> wrote:
> > Hey gang;
> >
> > Wow a lotof people are all having the same problem. Somehow the
> conversation
> > I had with the original poster got taken off the list. Here is the next
> > message I sent:
> >
> > chmod would change the permissions, but hede a little caution here;
> opening
> > up your home directory allows everyone to get inside there. This might
> not
> > be an issue with your server if you don't have anyone on it who you
> might
> > not be able to trust, but it isn't a bad idea to get in the right habits
> > here.
> >
> > What I would recommend if you are a web developer, is to add yourself to
> the
> > group www-data. So in a shell punch in usermod -a -G www-data webmastr
> (I am
> > assuming webmastr is your linux login name here). This will let you just
> > give permissions to people in your group instead of everyone. Then go
> back
> > to /home/webmastr/ and type chmod 750 -r public_html . This will give
> your
> > full read-write-executable access to the files (7), your group including
> > www-data read-execute permissions (5) and everyone else no permissions
> (0).
> >
> > Hopefully that will get your django install to work. If you want to
> learn
> > more about linux permissions look here:
> http://www.freeos.com/articles/3127/ordo a search for ubuntu
> > permissions. There are tons of resourses. Let me
> > know how that works,
> >
> > Then it became clear that he didn't own that file and I told him to look
> > into 'chown' to own the file.
> >
> > There are four parts to an django site you need to remember exist when
> > setting it up. You need a media root, where files are served directly by
> > apache. I always use /media/ as an example. Then you need a project
> folder
> > that is where you put all of you python files. The important file here
> is
> > settings.py because it tells mod_python (the apache module for python)
> what
> > to load and that is how django starts up. The third part is a templates
> > directory, which is where all the django templates go. The last part is
> the
> > SQL we won't get into that here. The media and the templates folders
> need to
> > be defined by you inside of settings.py. Apache (generally www-data)
> should
> > be given permission to read and execute these files.
> >
> > You should make sure django is in your python path. This is simple open
> up a
> > python shell and type 'import django'. make sure your project is in a
> python
> > path. This is done with the PythonPath in the config file. Other than
> that
> > read up on how apache configuration works and the django and mod_python
> docs
> > work. I promise they all work on Ubuntu without problems.
> >
> > Here is an example VirtualHost that I have included from my main
> apache.conf
> > file:http://dpaste.com/43421/
> >
> > I hope 

Re: Making user emails unique

2008-04-06 Thread Michael
I have this style of e-mail usernames for my sites and where it might be not
as tight as possible, I have an implementation that works.

> 1) Make sure that emails are unique. According to the thread [1]
> there's no straight forward solution other than patching Django, and I
> hate patching Django. But maybe since that thread there's been new
> features allowing to do that without patch?
>
>
> http://groups.google.com/group/django-users/browse_thread/thread/8712e5bc0fc84483/12e9b40eee24bff1


In an environment that has users register on the site, django-registration
offers a form that checks for uniqueness of the email address. This works
well as it stops users from registering with duplicate email addresses. The
key next is to make sure no one who has access to add more users directly
doesn't add someone with the same e-mail address.

If this is important for you what I would recommend is pulling contrib.auth
out of the django package into your project and customize it. Contrib apps
are just that, apps. Just make sure all your settings.py paths point to the
new one. You can add a few lines of code to the add_view of auth straight
from django-registration to make sure e-mail is unique. Once you do that you
should have unique e-mails all around and you didn't need to touch the
django package, just use a chunk of code.

>
> 
>
> 2) Generate usernames automatically, since they're not really used
> anymore but can't stay blank. For example, automatically setting a new
> user name to "user_8371" if 8371 is the user id. How could I do that,
> since the User class is built in Django?


I extended a django-registration class to accomplish this. I just put it up
on djangosnippets.org. Check it out
http://www.djangosnippets.org/snippets/686/


Hope that helps,

Michael

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



Re: Configure Mod_Python fo Django on Apache server on Ubuntu

2008-04-06 Thread HangingClowns

I've worked on putting Django on a Red Hat machine, and I've noticed
that the Ubuntu version of Apache is a bit different. But, in any
case, In my /etc/apache2 httpd.conf I have:


DirectoryIndex index.html index.php



SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE mysite.settings
PythonDebug On
PythonInterpreter mysite
PythonPath "['/home/webmastr/public_html/django']+sys.path"


And that's it. Excluding the /media, it should still show something,
I'd believe, or am I wrong?

On Apr 6, 9:52 am, Michael <[EMAIL PROTECTED]> wrote:
> Hey gang;
>
> Wow a lotof people are all having the same problem. Somehow the conversation
> I had with the original poster got taken off the list. Here is the next
> message I sent:
>
> chmod would change the permissions, but hede a little caution here; opening
> up your home directory allows everyone to get inside there. This might not
> be an issue with your server if you don't have anyone on it who you might
> not be able to trust, but it isn't a bad idea to get in the right habits
> here.
>
> What I would recommend if you are a web developer, is to add yourself to the
> group www-data. So in a shell punch in usermod -a -G www-data webmastr (I am
> assuming webmastr is your linux login name here). This will let you just
> give permissions to people in your group instead of everyone. Then go back
> to /home/webmastr/ and type chmod 750 -r public_html . This will give your
> full read-write-executable access to the files (7), your group including
> www-data read-execute permissions (5) and everyone else no permissions (0).
>
> Hopefully that will get your django install to work. If you want to learn
> more about linux permissions look 
> here:http://www.freeos.com/articles/3127/ordo a search for ubuntu
> permissions. There are tons of resourses. Let me
> know how that works,
>
> Then it became clear that he didn't own that file and I told him to look
> into 'chown' to own the file.
>
> There are four parts to an django site you need to remember exist when
> setting it up. You need a media root, where files are served directly by
> apache. I always use /media/ as an example. Then you need a project folder
> that is where you put all of you python files. The important file here is
> settings.py because it tells mod_python (the apache module for python) what
> to load and that is how django starts up. The third part is a templates
> directory, which is where all the django templates go. The last part is the
> SQL we won't get into that here. The media and the templates folders need to
> be defined by you inside of settings.py. Apache (generally www-data) should
> be given permission to read and execute these files.
>
> You should make sure django is in your python path. This is simple open up a
> python shell and type 'import django'. make sure your project is in a python
> path. This is done with the PythonPath in the config file. Other than that
> read up on how apache configuration works and the django and mod_python docs
> work. I promise they all work on Ubuntu without problems.
>
> Here is an example VirtualHost that I have included from my main apache.conf
> file:http://dpaste.com/43421/
>
> I hope that helps you all:
>
> Michael
>
> On Sun, Apr 6, 2008 at 8:03 AM, <[EMAIL PROTECTED]> wrote:
>
> > Exact same issue here. Tried everything listed. Any other ideas or
> > possibly a sample config for httpd.conf on ubuntu.
>
> > Thanks in advance for your help
>
> > -Original Message-
> > From: Will Boyce <[EMAIL PROTECTED]>
> > Sent: Sunday, April 6, 2008 3:23am
> > To: Django users 
> > Subject: Re: Configure Mod_Python fo Django on Apache server on Ubuntu
>
> > Assuming your django project (mysite) is in /home/webmaster/
> > public_html/django/ then you'll want a trailing "/" in your
> > PythonPath.
>
> > Hope this helps.
>
> > On Apr 5, 9:53 pm, HangingClowns <[EMAIL PROTECTED]> wrote:
> > > I should have the latest versions available for Apache and mod_python
> > > cause I just put those onto my server about 2 weeks ago. I'm having
> > > trouble understanding how to edit the Apache config file for Django. I
> > > currently use the code snippet below for my settings in Apache. And
> > > this is what the error looks like:
>
> > >http://67.207.140.149/mysite/
>
> > > Can someone help me out?
>
> > > I have started a project in the /home/webmastr/public_html/django
> > > called mysite, cause I'm following the tutorial on Djangoproject.org.
> > > I did not find their instructions for configuring modpython to be very
> > > helpful for me. So, back to subject, within that django folder, is a
> > > folder called "mysite" with all of the beginning project python .py
> > > files.
>
> > >  
> > > SetHandler python-program
> > > PythonHandler django.core.handlers.modpython
> > > SetEnv DJANGO_SETTINGS_MODULE 

Re: Configure Mod_Python fo Django on Apache server on Ubuntu

2008-04-06 Thread Michael
Hey gang;

Wow a lotof people are all having the same problem. Somehow the conversation
I had with the original poster got taken off the list. Here is the next
message I sent:

chmod would change the permissions, but hede a little caution here; opening
up your home directory allows everyone to get inside there. This might not
be an issue with your server if you don't have anyone on it who you might
not be able to trust, but it isn't a bad idea to get in the right habits
here.

What I would recommend if you are a web developer, is to add yourself to the
group www-data. So in a shell punch in usermod -a -G www-data webmastr (I am
assuming webmastr is your linux login name here). This will let you just
give permissions to people in your group instead of everyone. Then go back
to /home/webmastr/ and type chmod 750 -r public_html . This will give your
full read-write-executable access to the files (7), your group including
www-data read-execute permissions (5) and everyone else no permissions (0).

Hopefully that will get your django install to work. If you want to learn
more about linux permissions look here:
http://www.freeos.com/articles/3127/or do a search for ubuntu
permissions. There are tons of resourses. Let me
know how that works,

Then it became clear that he didn't own that file and I told him to look
into 'chown' to own the file.

There are four parts to an django site you need to remember exist when
setting it up. You need a media root, where files are served directly by
apache. I always use /media/ as an example. Then you need a project folder
that is where you put all of you python files. The important file here is
settings.py because it tells mod_python (the apache module for python) what
to load and that is how django starts up. The third part is a templates
directory, which is where all the django templates go. The last part is the
SQL we won't get into that here. The media and the templates folders need to
be defined by you inside of settings.py. Apache (generally www-data) should
be given permission to read and execute these files.

You should make sure django is in your python path. This is simple open up a
python shell and type 'import django'. make sure your project is in a python
path. This is done with the PythonPath in the config file. Other than that
read up on how apache configuration works and the django and mod_python docs
work. I promise they all work on Ubuntu without problems.

Here is an example VirtualHost that I have included from my main apache.conf
file: http://dpaste.com/43421/

I hope that helps you all:

Michael

On Sun, Apr 6, 2008 at 8:03 AM, <[EMAIL PROTECTED]> wrote:

>
> Exact same issue here. Tried everything listed. Any other ideas or
> possibly a sample config for httpd.conf on ubuntu.
>
> Thanks in advance for your help
>
>
>
>
>
> -Original Message-
> From: Will Boyce <[EMAIL PROTECTED]>
> Sent: Sunday, April 6, 2008 3:23am
> To: Django users 
> Subject: Re: Configure Mod_Python fo Django on Apache server on Ubuntu
>
>
> Assuming your django project (mysite) is in /home/webmaster/
> public_html/django/ then you'll want a trailing "/" in your
> PythonPath.
>
> Hope this helps.
>
> On Apr 5, 9:53 pm, HangingClowns <[EMAIL PROTECTED]> wrote:
> > I should have the latest versions available for Apache and mod_python
> > cause I just put those onto my server about 2 weeks ago. I'm having
> > trouble understanding how to edit the Apache config file for Django. I
> > currently use the code snippet below for my settings in Apache. And
> > this is what the error looks like:
> >
> > http://67.207.140.149/mysite/
> >
> > Can someone help me out?
> >
> > I have started a project in the /home/webmastr/public_html/django
> > called mysite, cause I'm following the tutorial on Djangoproject.org.
> > I did not find their instructions for configuring modpython to be very
> > helpful for me. So, back to subject, within that django folder, is a
> > folder called "mysite" with all of the beginning project python .py
> > files.
> >
> >  
> > SetHandler python-program
> > PythonHandler django.core.handlers.modpython
> > SetEnv DJANGO_SETTINGS_MODULE mysite.settings
> > PythonDebug On
> > PythonPath "['/home/webmastr/public_html/django'] + sys.path"
> > 
>
>
>
>
> >
>

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



Re: Custom ID field with random string

2008-04-06 Thread Erik Vorhes

I'm not sure how this is more transparent. Don't you mean *less*
transparent for your user? Instead of a simple number (or more usable
user-defined slug), you're giving them a random string, which will be
almost impossible to remember and contains no discernibly useful
information. If you *really* need a "feature" like this, why not just
do something involving strftime as the slug:

def save(self):
if not self.slug:
import datetime
self.slug = datetime.datetime.now().strftime('%Y%m%d-%H%M%S')
super(Project, self).save()

And if you use usernames as part of your URL, you can maintain data
integrity by including this in class Meta:

unique_together = (('user', 'slug),)

Remember that "standard operating procedure" (what YouTube, the US
Gov, et al., are doing) isn't necessarily the same thing as "best
practice." Long random strings are simply unusable, at least in the
context you intend to use them.

(Sorry if I sound like a scold.)

On Mon, Mar 31, 2008 at 4:21 AM, Julien <[EMAIL PROTECTED]> wrote:
>
>  One reason is because I believe string allows to store bigger amounts
>  of data, since IDs wouldn't be counted in base 10. E.g. YouTube videos
>  which are identified by random generated strings.
>  Another reason is because I want to keep things a bit more transparent
>  to the users. Instead of having a url like www.example.com/projects/3/,
>  I'd have something like  www.example.com/projects/iuyf876ertg/
>  I don't really want the user to know that his project is number 3...
>
>
>
>  On Mar 31, 8:11 pm, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote:
>  > On 31-Mar-08, at 2:30 PM, Julien wrote:
>  >
>  > > I just thought I'd try to make it clearer what I'm after. Instead of
>  > > having numbers as ID for my objects, I'd like to have random strings
>  > > (e.g. "sadfwetbtyvt32452" or "fd70982876adhfd"...). Those strings have
>  > > to be unique across the table.
>  > > Is that easily achievable? Am I on the right track with the code
>  > > above?
>  >
>  > why? what do you hope to achieve by doing this?
>  >
>  > --
>  >
>  > regards
>  > kghttp://lawgon.livejournal.comhttp://nrcfosshelpline.in/code/
>
>
> >
>

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



Re: Cycle Tag Question

2008-04-06 Thread Kevin Monceaux

Django Fans,

On Sat, 5 Apr 2008, Kevin Monceaux wrote:

> When used inside a loop is there any way to have the cycle tag simply
> cycle through the given strings/variables each time it's called regardless
> of the loop index?



> I tried placing a {% cycle 'Odd' 'Even' as rowcolors %} outside the loop 
> and calling {% cycle rowcolors %} from inside the loop, which didn't 
> work.

Sorry to reply to my own post.  I just wanted to say never mind.  I had 
tried the "as rowcolors" technique mentioned above and it hadn't worked. 
But, I suspect that somehow the changes to the template didn't get picked 
up.  I just tried it again and "as rowcolors" is working for me now. 
Sorry for the interruption.  We now return to our regularly scheduled 
coding.



Kevin
http://www.RawFedDogs.net
http://www.WacoAgilityGroup.org
Bruceville, TX

Si hoc legere scis nimium eruditionis habes.
Longum iter est per praecepta, breve et efficax per exempla!!!


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



Making user emails unique

2008-04-06 Thread Julien

Hi,

I've implemented a backend to let users authenticate with their email
instead of their username, and that works quite well. However, for
security and piece of mind I'd like to:

1) Make sure that emails are unique. According to the thread [1]
there's no straight forward solution other than patching Django, and I
hate patching Django. But maybe since that thread there's been new
features allowing to do that without patch?

http://groups.google.com/group/django-users/browse_thread/thread/8712e5bc0fc84483/12e9b40eee24bff1

2) Generate usernames automatically, since they're not really used
anymore but can't stay blank. For example, automatically setting a new
user name to "user_8371" if 8371 is the user id. How could I do that,
since the User class is built in Django?

Thanks for your help!

Julien

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



Re: Configure Mod_Python fo Django on Apache server on Ubuntu

2008-04-06 Thread keith

Exact same issue here. Tried everything listed. Any other ideas or possibly a 
sample config for httpd.conf on ubuntu. 

Thanks in advance for your help





-Original Message-
From: Will Boyce <[EMAIL PROTECTED]>
Sent: Sunday, April 6, 2008 3:23am
To: Django users 
Subject: Re: Configure Mod_Python fo Django on Apache server on Ubuntu


Assuming your django project (mysite) is in /home/webmaster/
public_html/django/ then you'll want a trailing "/" in your
PythonPath.

Hope this helps.

On Apr 5, 9:53 pm, HangingClowns <[EMAIL PROTECTED]> wrote:
> I should have the latest versions available for Apache and mod_python
> cause I just put those onto my server about 2 weeks ago. I'm having
> trouble understanding how to edit the Apache config file for Django. I
> currently use the code snippet below for my settings in Apache. And
> this is what the error looks like:
>
> http://67.207.140.149/mysite/
>
> Can someone help me out?
>
> I have started a project in the /home/webmastr/public_html/django
> called mysite, cause I'm following the tutorial on Djangoproject.org.
> I did not find their instructions for configuring modpython to be very
> helpful for me. So, back to subject, within that django folder, is a
> folder called "mysite" with all of the beginning project python .py
> files.
>
>  
>         SetHandler python-program
>         PythonHandler django.core.handlers.modpython
>         SetEnv DJANGO_SETTINGS_MODULE mysite.settings
>         PythonDebug On
>         PythonPath "['/home/webmastr/public_html/django'] + sys.path"
> 




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



Re: CheckboxSelectMultiple under modelform

2008-04-06 Thread Iamnewbie

Thanks.Malcolm

After using

self.fields['condition'].widget=forms.CheckboxSelectMultiple()

instead of

self.fields['condition'].widget=forms.CheckboxSelectMultiple

No error shows, but nothing shows about field condition on the form.

I am totally new to django, could you please tell me more? Thanks.

Joe

On 4月6日, 上午12时34分, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Sat, 2008-04-05 at 07:32 -0700, Iamnewbie wrote:
> > I want to use CheckboxSelectMultiple (checkbox) under modelform
> > instead of default ModelMultipleChoiceField settings.
>
> > my codes are as follows:
>
> > class Form(ModelForm):
>
> > def __init__(self, *args, **kwargs):
>
> > super(Form, self).__init__(*args, **kwargs)
>
> > self.fields['condition'].widget=forms.CheckboxSelectMultiple
>
> > class Meta:
> > model=Post
> > fields=('post_type', 'title', 'body', 'condition')
>
> > I got the error like:
>
> > Exception Type: AttributeError
> > Exception Value:   type object 'CheckboxSelectMultiple' has no
> > attribute 'attrs'
>
> > I am total lost on this problem. anyone may help me out? Thanks.
>
> The "widget" attribute will be an instance, not a type, once
> newforms.fields.Field.__init__ has finished running. So you probably
> should be assigning CheckboxSelectMultiple() -- an instance, rather than
> than the class object.
>
> Regards,
> Malcolm
>
> --
> The sooner you fall behind, the more time you'll have to catch 
> up.http://www.pointy-stick.com/blog/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Custom ID field with random string

2008-04-06 Thread Julien

Ok, I see. In fact I'd be happy to reduce it to 12 characters instead
of 36, as long as it's enough to store all my data. But since it's
enough for YouTube I guess that'd be enough for me.

1) So, should I only save the farthest right characters (i.e
'42665d440a17' in the following example)?

550e8400-e29b-41d4-a716-42665d440a17

But wouldn't there be conflict if another UUID is generated like the
following (i.e. different except for the 12 characters on the right)?

810e8ba7-f13c-5de8-821a-42665d440a17

2) Also, if I decide to save, say, 16 characters. Should I keep the 16
characters on the right after stripping off the dashes?

3) One last question. Which algorithm is best to use? 1, 2, 3, 4, 5?
According to Wikipedia [1], the #5 is most secure, but I don't know if
security would actually be an issue for referencing objects in the
database.

Thanks!

Julien

[1] http://en.wikipedia.org/wiki/Uuid

On Apr 6, 2:16 pm, Peter of the Norse <[EMAIL PROTECTED]>
wrote:
> On Mar 31, 2008, at 6:20 AM, Julien wrote:
>
> > What do you think is best practice? Also, how do you explain that
> > youtube, for example, only uses a dozen characters (and not 36 like a
> > UUID) to identify videos?
>
> UUIDs are designed to be unique within a database no matter how many
> tables or rows are used. Not only that, but they are likely to be
> unique even after two databases are merged. So if YouTube and Google
> and the US Federal Gonverment and all the rest of the databases in the
> world were using UUIDs, and they all merged into one huge Omni-
> database, there would be ~40% chance of conflict. Since that's not
> likely to happen any time soon, 12 characters are enough. And if
> YouTube and Vidder merge, they can just add a y/v to the end and
> that's good enough.
>
> --
> Peter of the Norse
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



TestCase: problem with returning posted data, it returns excepted data instead

2008-04-06 Thread Tony

I am testing my view using the Client(), and I am having trouble
retrieving a variable that is in a try and except block.  It is not
returning the posted item in the block, but instead always returning
the excepted data.

Here is the snippet I am trying to test in my view.py:
"""
allchecks = Checks.objects.all()
datagroups = []
for i in allchecks:
i.datagroup
if not i.datagroup in datagroups:
datagroups += ['%s' % i.datagroup]

try:
data = request.POST['datagroup']
except:
data=""

if data:
checkslist = Checks.objects.filter(datagroup=data)
else:
checkslist = []
"""

In my rendered template I have a filter input box which contains
everything stored in datagroups.  What I doing here is posting the
selected filter in datagroups to display the results from my Checks
table.

This all works fine in practice but when I am testing it using
Django's Client(), it never returns data as the posted datagroup but
rather returns the excepted data="".

This is what I have in my test.py:
"""
class checksearchTests(TestCase):
fixtures = ['testdata/my_text_fixture.json']

def setUp(self):
self.client = Client()
#login user to perform following tests
self.client.login(username='auser', password='apassword')

response = self.client.get('/lib/project/7/checksearch/')
self.assertEqual(response.status_code, 200)
self.assertEqual(response.template[0].name, 'allsearch.html')
self.failUnless('testtrial1' in response.content)

def test_post_datagroup_search_ALC(self):
dg='ALC'
post_data = {'data': dg}
postresponse = self.client.post('/lib/project/7/checksearch/',
post_data)

response = self.client.get('/lib/project/7/checksearch/')
self.assertEqual(response.status_code, 200)
self.assertEqual(response.template[0].name, 'allsearch.html')
self.failUnless('Results for datagroup: ALC' in 
response.content)
"""

Its failing on "self.failUnless('Results for datagroup: ALC' in
response.content)" because the posted data has not been rendered, so
instead its rendering dg="".

Anyidea why this is? Is it the way I have written my function?


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



Re: Same Name; Different People

2008-04-06 Thread LRP

On Apr 6, 2:08 am, Michael <[EMAIL PROTECTED]> wrote:
> Not really following you here. The default layout of django auth is that you
> can have 100 people of the same name in multiple entries unaware that there
> is another person with the same name unless they try to make a username the
> same. Django, and most high level frameworks work so they increment database
> values automatically at every entry. So unless you explicitly define
> something, like a name, as unique it won't make a difference. That pesky
> instance field that you refer to comes free with Django.
>
> Have you looked at the way auth does this? If so explain what you are trying
> to say in terms of auth please. It would be better to understand.
>

Ok, yes. It all comes clear. We have two ways of differentiating -- id
value and username (which must be unique).

Not thinking clearly this early in the a.m.

Thanks,

Lloyd

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



Re: Configure Mod_Python fo Django on Apache server on Ubuntu

2008-04-06 Thread Graham Dumpleton



On Apr 6, 5:23 pm, Will Boyce <[EMAIL PROTECTED]> wrote:
> Assuming your django project (mysite) is in /home/webmaster/
> public_html/django/ then you'll want a trailing "/" in your
> PythonPath.

No you don't. Trailing slash shouldn't make any difference.

What gives you that idea?

Graham

> Hope this helps.
>
> On Apr 5, 9:53 pm, HangingClowns <[EMAIL PROTECTED]> wrote:
>
> > I should have the latest versions available for Apache and mod_python
> > cause I just put those onto my server about 2 weeks ago. I'm having
> > trouble understanding how to edit the Apache config file for Django. I
> > currently use the code snippet below for my settings in Apache. And
> > this is what the error looks like:
>
> >http://67.207.140.149/mysite/
>
> > Can someone help me out?
>
> > I have started a project in the /home/webmastr/public_html/django
> > called mysite, cause I'm following the tutorial on Djangoproject.org.
> > I did not find their instructions for configuring modpython to be very
> > helpful for me. So, back to subject, within that django folder, is a
> > folder called "mysite" with all of the beginning project python .py
> > files.
>
> >  
> >         SetHandler python-program
> >         PythonHandler django.core.handlers.modpython
> >         SetEnv DJANGO_SETTINGS_MODULE mysite.settings
> >         PythonDebug On
> >         PythonPath "['/home/webmastr/public_html/django'] + sys.path"
> > 
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



http://www.replica-ebags.com I Bouvier Suede Hobo Bag Handbag

2008-04-06 Thread replica watch

Our products as below:

http://replica-ebags.com/Replica_Wallets_1.html

http://replica-ebags.com/Fashion_Jewelrys_RFJ0803219.html

http://replica-ebags.com/Replica_Louis_Vuitton_shoes_RLS0803013.html

http://replica-ebags.com/Replica_Shoes_1.html

louis vuitton monogram canvas Keepall 45 with Shoulder Strap
Gucci Beige White Handbag Tote Bag
GUCCI SHOULDER HANDBAG PURSE BAG TOTE
GUCCI Medium Shoulder Bag in Brown
GUCCI Boston Bag
BALENCIAGA LEDIX MOTORCYCLE BAG
Gucci Britt medium shoulder bag with handle black
Gucci Handbag Large Hobo Beige Brown
Gucci Handbag Medium Eclipse Beige Brown
Gucci Handbag Medium Tote Beige Brown
Gucci 'hasler' medium top handle tote whit brown leather
Gucci large boston Black bag 85th limited edition Collection
Gucci large Wave boston bag black
Gucci large Wave boston bag green
Gucci Medium Boston Bag
Gucci Messenger Chocolate Bag
Gucci 'positano' medium tote chocolate
Gucci treasure boston bag black
Gucci Belt Bag
Gucci Race Medium Top Handle Handbag
Gucci Pelham Medium Shoulder Bag
Gucci Peggy Large Shoulder Bag
Gucci Medium Top-Handle Tote
Gucci Britt Medium Tote
Gucci Bouvier Large Hobo
Gucci Pelham Medium Shoulder Bag
Gucci Large 85th Anniversary Hobo
GUCCI JOLICOEUR MEDIUM TOTE
Gucci Handbags Spring - hebe 2007 - BOUVIER BAG
Gucci Handbags - Spring-hebe 2007 - POSITANO BAG
Gucci Handbags - Spring-hebe 2007 - PRINCY
Gucci Handbags - Fall-Winter 2006/07 - BRITT
Gucci Handbags - Fall-Winter 2006/07 - 85th ANNIVERSARY - RUSTY
Gucci Handbags - BOUVIER - Fall - Winter 2006/07
Gucci women's handabgs "85th GUCCI" Fall/Winter
Gucci women's handabgs "BELT BAG" Spring/hebe 2007
GucOur products as below:

http://replica-ebags.com/Replica_Wallets_1.html

http://replica-ebags.com/Fashion_Jewelrys_RFJ0803219.html

http://replica-ebags.com/Replica_Louis_Vuitton_shoes_RLS0803013.html

http://replica-ebags.com/Replica_Shoes_1.html

louis vuitton monogram canvas Keepall 45 with Shoulder Strap
Gucci Beige White Handbag Tote Bag
GUCCI SHOULDER HANDBAG PURSE BAG TOTE
GUCCI Medium Shoulder Bag in Brown
GUCCI Boston Bag
BALENCIAGA LEDIX MOTORCYCLE BAG
Gucci Britt medium shoulder bag with handle black
Gucci Handbag Large Hobo Beige Brown
Gucci Handbag Medium Eclipse Beige Brown
Gucci Handbag Medium Tote Beige Brown
Gucci 'hasler' medium top handle tote whit brown leather
Gucci large boston Black bag 85th limited edition Collection
Gucci large Wave boston bag black
Gucci large Wave boston bag green
Gucci Medium Boston Bag
Gucci Messenger Chocolate Bag
Gucci 'positano' medium tote chocolate
Gucci treasure boston bag black
Gucci Belt Bag
Gucci Race Medium Top Handle Handbag
Gucci Pelham Medium Shoulder Bag
Gucci Peggy Large Shoulder Bag
Gucci Medium Top-Handle Tote
Gucci Britt Medium Tote
Gucci Bouvier Large Hobo
Gucci Pelham Medium Shoulder Bag
Gucci Large 85th Anniversary Hobo
GUCCI JOLICOEUR MEDIUM TOTE
Gucci Handbags Spring - hebe 2007 - BOUVIER BAG
Gucci Handbags - Spring-hebe 2007 - POSITANO BAG
Gucci Handbags - Spring-hebe 2007 - PRINCY
Gucci Handbags - Fall-Winter 2006/07 - BRITT
Gucci Handbags - Fall-Winter 2006/07 - 85th ANNIVERSARY - RUSTY
Gucci Handbags - BOUVIER - Fall - Winter 2006/07
Gucci women's handabgs "85th GUCCI" Fall/Winter
Gucci women's handabgs "BELT BAG" Spring/hebe 2007
Gucci Hobo fur bag
GUCCI LARGE Boston GUCCISSIMA Leather Tote Bag
GUCCI Black Guccissima Medium BRITTS Bag
GUCCI Bouvier Suede Hobo Bag Handbag
Gucci Pelham Horsebit Shoulder Bag
Gucci Britt Braided Suede Hand Bag
GUCCI Guccissima Jackie Hobo Bag Handbag
GUCCI MONOGRAM BOSTON BAG WITH KEYS
GUCCI JOLICOEUR med. Pink Bag
New GUCCI Guccissima Belt Pocket Bag
GUCCI BAMBOO HORSEBIT AMALFI BAG
Gucci Pelham Horsebit Shoulder Bag
GUCCI MEDIUM SCARF TOTE BAG
GUCCI ABBEY MEDIUM MESSENGER BAG
Vintage Gucci Doctors Bag Purse
GUCCI HORSEBIT BAG - LARGE BEIGE BROWN
GUCCI Cruise Bag with Scarf
Gucci Boston Brown Medium Tote Bag w/Stripes
http://www.replica-ebags.com ci Hobo fur bag
GUCCI LARGE Boston GUCCISSIMA Leather Tote Bag
GUCCI Black Guccissima Medium BRITTS Bag
GUCCOur products as below:

http://replica-ebags.com/Replica_Wallets_1.html

http://replica-ebags.com/Fashion_Jewelrys_RFJ0803219.html

http://replica-ebags.com/Replica_Louis_Vuitton_shoes_RLS0803013.html

http://replica-ebags.com/Replica_Shoes_1.html

louis vuitton monogram canvas Keepall 45 with Shoulder Strap
Gucci Beige White Handbag Tote Bag
GUCCI SHOULDER HANDBAG PURSE BAG TOTE
GUCCI Medium Shoulder Bag in Brown
GUCCI Boston Bag
BALENCIAGA LEDIX MOTORCYCLE BAG
Gucci Britt medium shoulder bag with handle black
Gucci Handbag Large Hobo Beige Brown
Gucci Handbag Medium Eclipse Beige Brown
Gucci Handbag Medium Tote Beige Brown
Gucci 'hasler' medium top handle tote whit brown leather
Gucci large boston Black bag 85th limited edition Collection
Gucci large Wave boston bag black
Gucci large Wave boston bag green
Gucci Medium Boston Bag
Gucci Messenger Chocolate Bag
Gucci 'positano' medium tote chocolate
Gucci treasure boston bag black
Gucci Belt Bag
Gucci 

Re: Configure Mod_Python fo Django on Apache server on Ubuntu

2008-04-06 Thread Will Boyce

Assuming your django project (mysite) is in /home/webmaster/
public_html/django/ then you'll want a trailing "/" in your
PythonPath.

Hope this helps.

On Apr 5, 9:53 pm, HangingClowns <[EMAIL PROTECTED]> wrote:
> I should have the latest versions available for Apache and mod_python
> cause I just put those onto my server about 2 weeks ago. I'm having
> trouble understanding how to edit the Apache config file for Django. I
> currently use the code snippet below for my settings in Apache. And
> this is what the error looks like:
>
> http://67.207.140.149/mysite/
>
> Can someone help me out?
>
> I have started a project in the /home/webmastr/public_html/django
> called mysite, cause I'm following the tutorial on Djangoproject.org.
> I did not find their instructions for configuring modpython to be very
> helpful for me. So, back to subject, within that django folder, is a
> folder called "mysite" with all of the beginning project python .py
> files.
>
>  
>         SetHandler python-program
>         PythonHandler django.core.handlers.modpython
>         SetEnv DJANGO_SETTINGS_MODULE mysite.settings
>         PythonDebug On
>         PythonPath "['/home/webmastr/public_html/django'] + sys.path"
> 
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Mod_Python and Eggs

2008-04-06 Thread Graham Dumpleton

On Apr 4, 11:37 pm, mike <[EMAIL PROTECTED]> wrote:
> I had this issue and was able to correct it by adding the following to
> my settings.py
>
> import os
> os.environ['PYTHON_EGG_CACHE'] = '/tmp'
>
> Hope this helps somebody

Using '/tmp' as the Python egg cache is actually not a good idea. This
is because you can't control who puts what in there and with what
permissions. This can cause errors if someone else has created
something in there with a conflicting name. Worse is that someone else
with access to that machine could put a modified version of an
unpacked Python egg in that directory which your application would use
and which did things like steal passwords and other account
information from your application.

You should always create a dedicated directory for the Python egg
cache for use by Apache when using mod_python or embedded mode of
mod_wsgi. Better still, use daemon mode of mod_wsgi and run your code
as a specific user with its own home directory where it can store the
cache.

Graham

> On Apr 3, 7:32 am, "Jon Lathem" <[EMAIL PROTECTED]> wrote:
>
> > Graham,
>
> > Thanks for your quick response.  It was a SELinux problem.  And i realize
> > that chmoding to 777 is a bad idea, at the time I was just trying to get it
> > to work.
>
> > Jon
>
> > On Wed, Apr 2, 2008 at 5:47 PM, Graham Dumpleton <[EMAIL PROTECTED]>
> > wrote:
>
> > > On Apr 3, 12:54 am, JLathem <[EMAIL PROTECTED]> wrote:
> > > > The first time I boot my server and view my django app I get the
> > > > following message
>
> > > ===
> > > > ExtractionError: Can't extract file(s) to egg cache
>
> > > > The following error occurred while trying to extract file(s) to the
> > > > Python egg
> > > > cache:
>
> > > >   [Errno 13] Permission denied: '/egg_cache/bgy/MySQL_python-1.2.2-
> > > > py2.4-linux-i686.egg-tmp'
>
> > > > The Python egg cache directory is currently set to:
>
> > > >   /egg_cache/bgy
>
> > > > Perhaps your account does not have write access to this directory?
> > > > You can
> > > > change the cache directory by setting the PYTHON_EGG_CACHE environment
> > > > variable to point to an accessible directory.
>
> > > ===
>
> > > > After doing a "service httpd restart" everything works fine.  I have
> > > > read the documentation here (http://www.djangoproject.com/
> > > > documentation/modpython/) about setting the egg cache path and I've
> > > > done that (you can see in the error message that I am not using the
> > > > standard egg path).  I have also tried it without setting the egg path
> > > > and I get the same error.  I made apache the owner and group of the
> > > > egg cache folder and also chmod 777 on the folder with still no luck.
> > > > Can someone help me out and tell me what I am missing?
>
> > > Do you have SELinux enabled?
>
> > > BTW, setting a directory to 777 permissions is really bad.
>
> > > Send a 'ls -las' listing output of '/egg_cache/'.
>
> > > Graham
>
> > --
> > Thanks
>
> > Jon
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Memory Usage/Optimization Question

2008-04-06 Thread Graham Dumpleton

On Apr 6, 2:30 am, Eric Abrahamsen <[EMAIL PROTECTED]> wrote:
> Also, if you haven't already, I'd definitely recommend switching to  
> mod_wsgi. I'm in the same boat as you - django apps on webfaction,  
> running up against memory limits (to the point where I was getting my  
> sites shut down); I started using mod_wsgi recently and haven't had  
> any trouble since. That's three (fairly small) django apps on the  
> Shared 1 plan.
>
> Values() sounds like a pretty good idea as well, though...

If the problem is with the way that the application is generating or
manipulating data, using mod_wsgi isn't likely to help much. At best
mod_wsgi would shave up to half a MB or so of the process size because
of modules that mod_python would normally load that your application
isn't going to be using.

BTW, if use of this page is infrequent, but then results in your
application holding onto the memory for all time, use
MaxRequestsPerChild setting in Apache so that it recycles your
processes out on a regular basis, thus allowing size to get set back
to base level.

Graham

> Eric
>
> On Apr 5, 2008, at 7:38 PM, Fredrik Lundh wrote:
>
>
>
> > Garrett Garcia wrote:
>
> >> I recently got my first django project set up on webfaction and am
> >> feeling the constraint of their memory usage limits.
> >> For example:
>
> >> I have a view that returns a list of objects:
>
> >> def get_meet_results(request, meet_id):
> >>meet = Meet.objects.get(pk=meet_id)
> >>year = meet.start.year
> >>result_list =  
> >> Result.objects.filter(meet=meet).order_by('event','score')
> >>return render_to_response('meets/meet_results.html',
> >> {'year':int(year), 'meet':meet, 'result_list':result_list})
>
> >> result_list.count() is about 1500 on average.  In the template, the
> >> result list is looped through and a table row is printed for each
> >> result.  This renders and loads relatively fast, but uses what  
> >> seems to
> >> me to be a very large amount of memory.
>
> > when Django reads an object from a table, it pulls in all the fields.
> > if the Result table contains some potentially large fields, you'll pay
> > for those even if you're not using them in the template.  you can use
> > the "values" method to control this.
>
> > also note that some of those 30 megabytes might be modules that are
> > pulled by the template (or by some other part of django) when you run
> > the view for the first time.  to check that, tweak the query to  
> > generate
> > only a few hits (e.g. by slicing out the first member).
>
> > 
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Project Topology

2008-04-06 Thread aaronblew

Hi all,
So I'm in the middle of thinking about my first Django project.  The
project will have different sections for the end-user to access like
Customer Information, Store and Checkout, for example.  Should these
"sections" of the Project be divided up into different applications or
should they fall under the same application?  Are there any rules of
thumb for this?

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



Re: Same Name; Different People

2008-04-06 Thread Michael
Not really following you here. The default layout of django auth is that you
can have 100 people of the same name in multiple entries unaware that there
is another person with the same name unless they try to make a username the
same. Django, and most high level frameworks work so they increment database
values automatically at every entry. So unless you explicitly define
something, like a name, as unique it won't make a difference. That pesky
instance field that you refer to comes free with Django.

Have you looked at the way auth does this? If so explain what you are trying
to say in terms of auth please. It would be better to understand.

On Sun, Apr 6, 2008 at 1:08 AM, LRP <[EMAIL PROTECTED]> wrote:

>
> This pesky problem transcends Django. But many Django users will
> encounter it.
>
> Say we're creating a contact or registration application.
>
> What is the best way to deal with the problem of two or more people
> with exactly the same name?
>
> This problem actually has two faces:
>
> 1) In an admin situation, it may be possible, though a bit pesky, to
> add an Instance field; e.g. Prefix FirstName MiddleName LastName
> Suffix Instance -- thus Mr. John Jasper Smith II 1; Mr. John Jasper
> Smith II 2 would be two different records in the database.
>
> -- Is there a better way to deal with this?
>
> 2) In a public registration system, we may not want a registrant to
> know that another John Jasper Smith II exists in the database.
>
> -- Is there a clever way to deal with this?
>
> Many thanks,
>
> Lloyd
>
>
>
> >
>

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