object appears twice after filtering by many to many field

2010-12-22 Thread tom
Hi all!
I have 2 models: Clip, Tag.
class Clip(models.Model):
  name = models.CharField(max_length=80)
  tags = models.ManyToManyField(Tag, through = 'TagsToClips')

class Tag(models.Model):
  tagName = models.CharField(max_length=80, unique=True)

class TagsToClips(models.Model)
  clip = models.ForeignKey(Clip)
  tag = models.ForeignKey(Tag)
  start_frame = models.IntegerField()
duration = models.IntegerField()

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



object appears twice after filtering by many to many field

2010-12-22 Thread tom
Hi all!
I have 2 models: Clip, Tag.
class Clip(models.Model):
  name = models.CharField(max_length=80)
  tags = models.ManyToManyField(Tag, through = 'TagsToClips')

class Tag(models.Model):
  tagName = models.CharField(max_length=80, unique=True)

class TagsToClips(models.Model)
  clip = models.ForeignKey(Clip)
  tag = models.ForeignKey(Tag)
  start_frame = models.IntegerField()
  end_frame = models.IntegerField()
  class meta:
  unique_together = ("clip", "tag",
"start_frame","end_frame")

now, assume I have clip named "clip_1", and tag "adult_scene" with
tag.id = 1
if I tag the the same clip twice with the same tag but different
frames (clip has an adult scene from frame 1 to 10 and also from frame
50 to 70 )
now I wnat all clips with adult scenes - I filter:
clip_set = Clip.objects.filter(tags__id__exact = 1)

I get the clip "clip_1" twice! (clip_set.all() =
[,])
I tried to filter in different ways, but didn't succeed.
What am I doing wrong?
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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: object appears twice after filtering by many to many field

2010-12-22 Thread Dan Fairs
> Hi all!
> I have 2 models: Clip, Tag.
> class Clip(models.Model):
>  name = models.CharField(max_length=80)
>  tags = models.ManyToManyField(Tag, through = 'TagsToClips')
> 
> class Tag(models.Model):
>  tagName = models.CharField(max_length=80, unique=True)
> 
> class TagsToClips(models.Model)
>  clip = models.ForeignKey(Clip)
>  tag = models.ForeignKey(Tag)
>  start_frame = models.IntegerField()
>duration = models.IntegerField()

Great! Do you actually have a problem then? ;)

Joking aside, and taking a wild stab at what your problem is without any actual 
code, I'd say the underlying JOIN is producing multiple rows, and you probably 
need a distinct() call somewhere on your queryset.

Then again, that might not be the problem at all, because you haven't said :)

Cheers,
Dan

--
Dan Fairs | dan.fa...@gmail.com | www.fezconsulting.com


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



Re: object appears twice after filtering by many to many field

2010-12-22 Thread tom
Thanks for the quick replay.
The problem is the clip duplication, when relaying on clip_set.count()
and also in the admin site when you see raw duplication after
filtering , it is not very reasonable :)

1. in order to change this behavior in the admin site I need to
manipulate main.py and add distinct() somewhere?
2. I read everywhere that distinct() works really slow and you better
avoid using it.

what do you say?

Thanks again,

On Dec 22, 11:42 am, Dan Fairs  wrote:
> > Hi all!
> > I have 2 models: Clip, Tag.
> > class Clip(models.Model):
> >          name = models.CharField(max_length=80)
> >          tags = models.ManyToManyField(Tag, through = 'TagsToClips')
>
> > class Tag(models.Model):
> >          tagName = models.CharField(max_length=80, unique=True)
>
> > class TagsToClips(models.Model)
> >          clip = models.ForeignKey(Clip)
> >          tag = models.ForeignKey(Tag)
> >          start_frame = models.IntegerField()
> >    duration = models.IntegerField()
>
> Great! Do you actually have a problem then? ;)
>
> Joking aside, and taking a wild stab at what your problem is without any 
> actual code, I'd say the underlying JOIN is producing multiple rows, and you 
> probably need a distinct() call somewhere on your queryset.
>
> Then again, that might not be the problem at all, because you haven't said :)
>
> Cheers,
> Dan
>
> --
> Dan Fairs | dan.fa...@gmail.com |www.fezconsulting.com

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



Re: object appears twice after filtering by many to many field

2010-12-22 Thread Dan Fairs
> Thanks for the quick replay.
> The problem is the clip duplication, when relaying on clip_set.count()
> and also in the admin site when you see raw duplication after
> filtering , it is not very reasonable :)
> 

Ah, I didn't realise it was in the admin.

It'll still be the same underlying problem - the intermediate JOIN table 
producing too many rows. If you want to 'fix' that, I suspect you'll need to 
write a custom manager for your Clip model, give it a get_query_set() method 
that calls the superclass method with .distinct() on the end.

> 1. in order to change this behavior in the admin site I need to
> manipulate main.py and add distinct() somewhere?

Read up on custom managers and the default manager.

> 2. I read everywhere that distinct() works really slow and you better
> avoid using it.
> 
> what do you say?

Things are not 'slow' or 'fast' in isolation. They are either 'too slow', or 
'fast enough'. Try it, it may be fast enough for you. If it's not, you'll need 
to find a faster solution. In particular, if the resultant filtered set is 
relatively small, then I doubt you'll notice the difference. 

Cheers,
Dan

--
Dan Fairs | dan.fa...@gmail.com | www.fezconsulting.com


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



Re: How does Django handle Foreign Key in MySQL?

2010-12-22 Thread Tom Evans
On Wed, Dec 22, 2010 at 7:55 AM, Andy  wrote:
> Say I have these models:
>
> class Musician(models.Model):
>    first_name = models.CharField(max_length=50)
>    last_name = models.CharField(max_length=50)
>
> class Album(models.Model):
>    artist = models.ForeignKey(Musician)
>    name = models.CharField(max_length=100)
>
> MySQL with MyISAM tables doesn't support Foreign Key. So in this case
> what CREATE TABLE statements will be generated for Musician & Album?
> Will the FOREIGN KEY clause still be generated if MyISAM is being used?
>

Yes. Django has no concept of your underlying DB engine.

Use this command to see how django would create all your models.

python manage.py sqlall

Cheers

Tom

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



Re: Nested iteration through related models

2010-12-22 Thread Tom Evans
On Tue, Dec 21, 2010 at 9:48 PM, Dopster  wrote:
> Let's say I have the following models:
>
> class Group(models.Model):
>     group_name = models.CharField(max_length=20)
>
> class Person(models.Model):
>     group = models.ForeignKey(Group)
>     name = models.CharField(max_length=50)
>
> How do I get an output of the following?
>
> GroupA: John, Stacy, Pete
> GroupB: Bob, Bill, Mary
>
> I want to cycle through the groups and then output the people in each group.
> In rough pseudo-code:
>
> groups = Group.objects.all()
>
> for g in groups:
>   print g.group_name, ": "
>   for p in g.person_set.all:
>  print p.person
>
> However, this leads to a query being run for each person in order to access
> the person's name, which I find to be really unnecessary. I only want to run
> one query per group -- will I have to use raw SQL to do this? My initial
> thought was to run a query that returns all the people in a group, and then
> cycling through the queryset to append the names into a list and then
> attaching the list to the project object.
>

Are you sure? What you have written should result in precisely what
you asked for, 1 query to get the list of groups, 1 query per group to
get the list of users. Your pseudo-code is a little wrong (for p in
g.person_set.all(): print p.person - isn't p already a person? :), but
if I correct that (and use standard contrib.auth models):

>>> from django.contrib.auth.models import User, Group
>>> from django.db import connection
>>> for g in Group.objects.all():
...   print g.name, ':'
...   for u in g.user_set.all():
... print u.get_full_name()
...
...
>>> pprint(connection.queries)
[{'sql': u'SELECT `auth_group`.`id`, `auth_group`.`name` FROM `auth_group`',
  'time': '0.000'},
 {'sql': u'SELECT `auth_user`.`id`, `auth_user`.`username`,
`auth_user`.`first_name`, `auth_user`.`last_name`,
`auth_user`.`email`, `auth_user`.`password`, `auth_user`.`is_staff`,
`auth_user`.`is_active`, `auth_user`.`is_superuser`,
`auth_user`.`last_login`, `auth_user`.`date_joined` FROM `auth_user`
INNER JOIN `auth_user_groups` ON (`auth_user`.`id` =
`auth_user_groups`.`user_id`) WHERE `auth_user_groups`.`group_id` = 1
',
  'time': '0.002'},
 {'sql': u'SELECT `auth_user`.`id`, `auth_user`.`username`,
`auth_user`.`first_name`, `auth_user`.`last_name`,
`auth_user`.`email`, `auth_user`.`password`, `auth_user`.`is_staff`,
`auth_user`.`is_active`, `auth_user`.`is_superuser`,
`auth_user`.`last_login`, `auth_user`.`date_joined` FROM `auth_user`
INNER JOIN `auth_user_groups` ON (`auth_user`.`id` =
`auth_user_groups`.`user_id`) WHERE `auth_user_groups`.`group_id` = 2
',
  'time': '0.007'},
 {'sql': u'SELECT `auth_user`.`id`, `auth_user`.`username`,
`auth_user`.`first_name`, `auth_user`.`last_name`,
`auth_user`.`email`, `auth_user`.`password`, `auth_user`.`is_staff`,
`auth_user`.`is_active`, `auth_user`.`is_superuser`,
`auth_user`.`last_login`, `auth_user`.`date_joined` FROM `auth_user`
INNER JOIN `auth_user_groups` ON (`auth_user`.`id` =
`auth_user_groups`.`user_id`) WHERE `auth_user_groups`.`group_id` = 3
',
  'time': '0.006'}]


On Tue, Dec 21, 2010 at 9:59 PM, Javier Guerra Giraldez
 wrote:
> in the view:
> persons = Person.objects.all().order_by('group')
>
> in the template:
> {% for p in persons %}
>  {% ifchanged p.group %}
>      {{p.group}}:
>  {%endifchanged%}
>  {{p.name}}
> {% endfor %}
>
>

No, that's even worse - that is one query to get the list of people,
and one query per person to build their group model object. If the
ifchanged checked 'p.group_id' instead of  'p.group', then that avoid
unnecessarily instantiating the group object, and would cut it down to
num_groups + 1 queries.

Cheers

Tom

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



Django version 1.3 alpha 1 - no css in admin when using builtin webserver

2010-12-22 Thread fredrik70
Hi all,
Just getting back to some django devel after a few years hiatus. Have
a problem with css on my dev webserver (just the builtin one that
comes with django). Running this on windows XP.
It refuses to serve the css for the admin site. I haven't changed
anything in the settings.py and what I recall was that this just
worked out of the box. A quick google only seems to bring up people
havning this problen on apache, etc, which is not the case here. Does
anyone have an idea what's missing?

settings:


# Absolute filesystem path to the directory that will hold user-
uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = ''

# URL that handles the media served from MEDIA_ROOT. Make sure to use
a
# trailing slash if there is a path component (optional in other
cases).
# Examples: "http://media.lawrence.com/media/";, "http://example.com/
media/"
MEDIA_URL = ''

# Absolute path to the directory that holds static files.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = ''

# URL that handles the static files served from STATIC_ROOT.
# Example: "http://media.lawrence.com/static/";
STATIC_URL = '/static/'

# URL prefix for admin media -- CSS, JavaScript and images.
# Make sure to use a trailing slash.
# Examples: "http://foo.com/static/admin/";, "/static/admin/".
ADMIN_MEDIA_PREFIX = '/static/admin/'

# A list of locations of additional static files
STATICFILES_DIRS = ()

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



Re: How does Django handle Foreign Key in MySQL?

2010-12-22 Thread Javier Guerra Giraldez
On Wed, Dec 22, 2010 at 2:55 AM, Andy  wrote:
> MySQL with MyISAM tables doesn't support Foreign Key.

to be precise, it's supported but ignored.  so, Django generates it,
and if you're using InnoDB tables, it will work as intended; if it's
MyISAM, it won't make a difference.

-- 
Javier

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



Re: FormSet validation - not sure how to implement

2010-12-22 Thread Michael Thamm
Never mind - I changed it to ModelForm class instead.
>From what I have read, FormSet is not designed to be used in the
generic form way.
Rather for bulk adds or something like that.
ModelForm works nice and easy.


On Dec 21, 7:04 am, Michael Thamm  wrote:
> I am using 2 formsets on a template form and it shows fine but I don't
> know how to implement the form validation. Not allow a field to be
> empty.
> I have tried the basic method as documented but it doesn't trigger any
> messages.
> However, I also haven't put any defined errors anywhere so I don't
> know how an error message would appear.
> Bottom line is I don't understand the process and therefore can't set
> it up properly.
> If someone could show how to not allow the field
> {{ AddShirtFormSet.form.madeIn }} to NOT be empty, that would be a big
> help - thanks
>
> def addShirt(request):
>     AddShirtFormSet =
> modelformset_factory(Shirt,exclude=('create_date',))
>     AddUserShirtFormSet =
> modelformset_factory(UsersShirt,exclude=('shirt',))
>     if request.method == 'POST':
>         AddShirtFormSet = AddShirtFormSet(request.POST, request.FILES,
> prefix = 'shirt')
>         AddUserShirtFormSet = AddUserShirtFormSet(request.POST,
> request.FILES,prefix = 'usershirt')
>         if AddShirtFormSet.is_valid():
>             #formset.save()
>             # do something.
>             return HttpResponseRedirect('/shirt/') # Redirect after
> POST
>     else:
>         AddShirtFormSet = AddShirtFormSet(prefix = 'shirt')
>         AddUserShirtFormSet = AddUserShirtFormSet(prefix =
> 'usershirt')
>
>     return render_to_response("shirt/addshirt.html",
> RequestContext(request,{'AddShirtFormSet':
> AddShirtFormSet,'AddUserShirtFormSet': AddUserShirtFormSet,'error':
> True,}))
>
> *** In template 
> 
>   {{ form.non_field_errors }}
>   {% csrf_token %}
>   {{ AddShirtFormSet.management_form }}
>   {{ AddUserShirtFormSet.management_form }}
>   
>
>     
>         {{ AddShirtFormSet.form.madeIn.errors }}
>         Country made in?:
>         {{ AddShirtFormSet.form.madeIn }}
>     

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



Calling a Method from a Form

2010-12-22 Thread Brian Callies
Good Day,

As a part of a project I want to create a single page that has a number
of different utilities on it. One of those is a dice roller. Ultimately
I'd like to be able to type in the number of dice and number of sides,
click a button, and return the result on the page.

I understand you cannot pass arguments from a template without creating
custom tags (I think). So, ignore that aspect for now. 

For now, if someone could just point me in the right direction on how to
call a method from a template and return a result.

Do I want to create a view as such (assume I have a Class for making
dice rolls):

def Dice_Roll(request):
roll = Roll(3, 8)
total = roll.output()
return render_to_response('utils/diceroll.html', {'total': total})

And call it from the template?
Or, am I going about this all wrong since this page doesn't have dynamic
or database data? Would a static HTML page work better? 

Ah-ha! I see I should use Flatpages, most likely. But, I'm not sure that
solves my problem since it would still use templates and would still
have to call a method.  

Thanks, and hope this wasn't too rambling,
Brian



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



CSRF verification failed. Request aborted.

2010-12-22 Thread Harbhag Singh Sohal
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.middleware.csrf.CsrfResponseMiddleware',
)

Above is my settings.py file, even then I am getting the CSRF
verification failure error.
-- 
Harbhag Singh Sohal
http://harbhag.wordpress.com

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



Detecting camera type from image file

2010-12-22 Thread Sithembewena Lloyd Dube
Hi all,

Is there a method to detect what camera took an image in Python/ Django?

-- 
Regards,
Sithembewena Lloyd Dube

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



Re: CSRF verification failed. Request aborted.

2010-12-22 Thread Harbhag Singh Sohal
I am also using {% csrf_token %}, even then I am getting error.

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



Re: Detecting camera type from image file

2010-12-22 Thread Thomas Weholt
Look at pyexiv2 or PIL.

On Wed, Dec 22, 2010 at 2:36 PM, Sithembewena Lloyd Dube
 wrote:
> Hi all,
>
> Is there a method to detect what camera took an image in Python/ Django?
>
> --
> Regards,
> Sithembewena Lloyd Dube
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

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



Re: CSRF verification failed. Request aborted.

2010-12-22 Thread robos85
Do You pass *RequestContext* to your template during rendering it in view?
Example from manual:

def my_view(request):
c = {}
# ...
return render_to_response("a_template.html", c,
   context_instance=RequestContext(request))

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



Re: CSRF verification failed. Request aborted.

2010-12-22 Thread Harbhag Singh Sohal
from django.template import RequestContext
return render_to_response('abook_view.html',
locals(),context_instance=RequestContext(request))

this is what I am using. Is it ok ?

-- 
Harbhag Singh Sohal
http://harbhag.wordpress.com

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



Re: CSRF verification failed. Request aborted.

2010-12-22 Thread Dan Fairs
> from django.template import RequestContext
> return render_to_response('abook_view.html',
> locals(),context_instance=RequestContext(request))

What you're doing should be fine, in terms of whether it works or not. However, 
I'd strongly recommend against passing locals(). While it may seem to violate 
DRY to do anything else, experience has shown me that it makes maintaining the 
code a lot harder in the long run, as it's not immediately obvious exactly what 
is being passed to the template. It's obvious what's being passed from the tiny 
view you've got there, but as your views grow, this will become a problem.

Cheers,
Dan

--
Dan Fairs | dan.fa...@gmail.com | www.fezconsulting.com


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



fcgi, runfastcgi, parameters, docs [noob question]

2010-12-22 Thread Richard Brosnahan
Hi all,

I'm new to django but not new to Python. My goal is to build a web site using 
django, replacing an old, tired php framework.

The django 1.2.3 tutorials were fine. I got the basics of my site working 
locally, after going thru the entire tutorial. Before going any further, I 
wanted to see if I could get that same basic tutorial site going on my 1and1 
host. If I can't, I may have to go with drupal.

The django 1and1 site is a no go. 

I've installed my own Python 2.7.1, since the default version on 1and1 is 
extremely old.

1and1 does provide fcgi, by default. Indeed, my .htaccess file and mysite.fcgi 
work to a point. The script is using my version of python. The .fcgi script 
runs until I get to the line where I try to execute runfastcgi.

from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")

I'm using the docs provided with the svn version of django. In particular, this 
page:
file:///work/django-trunk/docs/_build/html/howto/deployment/fastcgi.html

These docs are those issued with the version of django I'm using, and that's up 
to date as of yesterday (via svn checkout).

What's the problem?

I get an error saying "method" is not defined, and "daemonize" is not defined. 
Further, those parameters don't match the method in the source:

fastcgi.py:89: 
def runfastcgi(argset=[], **kwargs):

So, I'm trying to pass (method="threaded", daemonize="false") to a method which 
expects (argset=[], **kwargs). No wonder it 'splodes.

Can anyone direct me to a way to get this to work? What am I missing?

Thanks in advance


-- 
Richard Brosnahan


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



Re: CSRF verification failed. Request aborted.

2010-12-22 Thread Harbhag Singh Sohal
> What you're doing should be fine, in terms of whether it works or not. 
> However, I'd strongly recommend against passing locals(). While it may seem 
> to violate DRY to do anything else, experience has shown me that it makes 
> maintaining the code a lot harder in the long run, as it's not immediately 
> obvious exactly what is being passed to the template. It's obvious what's 
> being passed from the tiny view you've got there, but as your views grow, 
> this will become a problem.
>
The error is solved now, and I will keep your advice about locals() in
my mind. Thanks
-- 
Harbhag Singh Sohal
http://harbhag.wordpress.com

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



Re: Detecting camera type from image file

2010-12-22 Thread Sithembewena Lloyd Dube
Thanks Thomas, looks like this can handle what I have in mind. Much
appreciated.

On Wed, Dec 22, 2010 at 3:44 PM, Thomas Weholt wrote:

> Look at pyexiv2 or PIL.
>
> On Wed, Dec 22, 2010 at 2:36 PM, Sithembewena Lloyd Dube
>  wrote:
> > Hi all,
> >
> > Is there a method to detect what camera took an image in Python/ Django?
> >
> > --
> > Regards,
> > Sithembewena Lloyd Dube
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com
> .
> > For more options, visit this group at
> > http://groups.google.com/group/django-users?hl=en.
> >
>
>
>
> --
> Mvh/Best regards,
> Thomas Weholt
> http://www.weholt.org
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Regards,
Sithembewena Lloyd Dube

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



Requesting Quote

2010-12-22 Thread sidhu
Hello Developers,I am looking for developers for a project (see requirements below). I would appreciate a quote if you can take on the work. There is an IndivoX learning curve. I am supplying links to documents:http://dl.dropbox.com/u/12539855/prototype-contract-package/prototype-requirements-main-version-c.pdfhttp://dl.dropbox.com/u/12539855/prototype-contract-package/prototype-requirement-diseases.pdfhttp://dl.dropbox.com/u/12539855/prototype-contract-package/prototype-requirements-allergies.pdfhttp://dl.dropbox.com/u/12539855/prototype-contract-package/nda-version2.pdf-- Yudhvir Singh SidhuCEO, MediGrail LLCmedigrail.comNOTICE TO RECIPIENT: Information contained in this e-mail is confidential and proprietary. Any disclosure or use of its content outside of business use and benefit to development for MediGrail will be considered a breach of the fiduciary duty to protect the oral or written partnership formed between the parties. If you are not the intended recipient of this e-mail, you are prohibited from sharing, copying, or otherwise using or disclosing its contents. If you have received this e-mail in error, please notify the sender immediately by reply e-mail and permanently delete this e-mail and any attachments without reading, forwarding or saving them. Thank you.



-- 
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/django-users?hl=en.




Excellent Python/Django Opportunity in Atlanta!!!

2010-12-22 Thread ATL Recruiter
Hello All,

I am an IT Recruiter based out of Atlanta, GA, and I was hoping that
someone out there could help me out. I am looking for some top Python/
Django talent, so I figured; why not go directly to the source!

Our client is building a team of world-class Python Developers with
varying degrees of seniority and skills to build a brand new
application that will drive this company to their future-state. If you
are hungry, entrepreneurial, dynamic, tired of cleaning up other’s
messes and want to create your own mess using the latest / greatest in
Python and related technologies, this is the place to work!  This team
is a start-up group within an established company that has deep
pockets. They are doing some cutting edge development, and are looking
for candidates with strong Python/Django experience, but also people
who are hungry and interested in learning new technologies. People
that are very creative, and can effectively communicate new ideas and
run with the process of building and implementing those ideas. We are
looking for hardcore backend developers first and foremost, but the
more well-rounded background the better.

Come one, come all!!! This client is looking to bring on 5 developers
as quickly as they can find them. This is arguably one of, if not the
best Django groups in the southeast, so if you want a chance to work
alongside the best and brightest, in an environment that encourages
creativity rather than stifling it, then this is the job for you.
If you or someone you know are a fit for this position, then please
send an updated word version of your resume to
skipjohn...@technisource.com , or feel free to call me directly at
(404) 442-0455.

Thanks for your time, and thanks in advance for your help. I look
forward to speaking with you!

Skip Johnson
IT Recruiter
Technisource

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



visual quickpro chapter 10 - csrf token

2010-12-22 Thread SurfSim
Hi i'm a new but enthusiast django user. After succesfully running the
django project tutorials and expirimenting a bit I bought two books
(visual quick pro and django tdg) ran by the first 9 chapters easily
but bumped into a problem with chapter 10 which simulates a login/
logout page.. After some investigation I understood that the book
didn't cover the integration of middleware class csrf.CsrfView.
Commenting out this class worked, but I got the point it is there for
a reason, so I tried to adopt csrfView by adding {% csrf_token %} to
my login.html template

This worked. However trying to logout I get this message:

TypeError at /logout/
'str' object is not callable

I suppose I should fix my logout view this is what I have:

from django.http import HttpResponse, Http404, HttpResponseRedirect
from django.contrib.auth import logout
from django.contrib.auth.models import User
from django.template import RequestContext
from django.shortcuts import render_to_response

# Create your views here.

def main_page(request):
  return render_to_response('main_page.html', RequestContext(request))

def logout_page(request):
  logout(request)
  return HttpResponseRedirect('/')


Please advise, regards

Django newbie.

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



Succeeding with SSL

2010-12-22 Thread Jakob H
Hi,

I have a Django site hosted on Bluehost, and I'm trying to get SSL to
work, but have some problems. I've got a dedicated IP with SSL
certificates all ready to go.

1. Whenever I enter a https://... I'm automatically re-directed to a
http:// address. I assumed that this cannot be Django related, and
only Apache related. Bluehost claims this is a Django related issue,
but I disagree. In general, what makes more sense? I also believe that
I do not have any Apache re-directs that directs https:// to http://.
Has anyone seen similar issues? I can provide more info if needed.

2. I have a sub-domain to serve static files http://static.[domain].org.
I do this to avoid having static files served by Django through the
WSGI interface. As I understand, whenever I use SSL I must serve
static files via SSL as well. Will this cause problems if my SSL
certificate is only for my domain (www.[domain].org) and not for
static.[domain].org? What is the solution here? Do I either get two
certificates (one for 'www' and one for 'static'), or do I serve
static files via Apache in some other fashion (in that case, how?)?

Any help is grateful,
Jakob

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



Building app on already existing set of DB tables

2010-12-22 Thread Vikram
Hi,

I am working on building an app that reports the data from the already
existing tables in the Oracle DB. These tables are data-dictionary
tables and my application will connect to these tables using read-only
access to SELECT and draw graphs on the webpage.
How do I build my application that queries the already existing
tables? Am new to web development and all Django documentation
discusses models that get created according to the models.py.

Scenario:
table v$session contains all the current sessions information and is
under SYS user. My web application should connect as webinfo user that
has read-only access on v$session table, query the data and present it
in webpage.

Do I write views that directly talk to these tables, pull data and
render it online? Or is there a better way?

Thanks
Vikram

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



Re: Building app on already existing set of DB tables

2010-12-22 Thread Fred Chevitarese
I think you can configure your settings to access the database, and after
that, you can run this command:

python manage.py inspectdb > youtfile.txt

Than, you'll have to realocate the models, 'cause django will output all
tables in the database like models.py ;)

Is that what you want?

Hope it help!


Fred Chevitarese - GNU/Linux
http://chevitarese.wordpress.com



2010/12/22 Vikram 

> Hi,
>
> I am working on building an app that reports the data from the already
> existing tables in the Oracle DB. These tables are data-dictionary
> tables and my application will connect to these tables using read-only
> access to SELECT and draw graphs on the webpage.
> How do I build my application that queries the already existing
> tables? Am new to web development and all Django documentation
> discusses models that get created according to the models.py.
>
> Scenario:
> table v$session contains all the current sessions information and is
> under SYS user. My web application should connect as webinfo user that
> has read-only access on v$session table, query the data and present it
> in webpage.
>
> Do I write views that directly talk to these tables, pull data and
> render it online? Or is there a better way?
>
> Thanks
> Vikram
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Building app on already existing set of DB tables

2010-12-22 Thread bruno desthuilliers
On 22 déc, 17:22, Vikram  wrote:
> Hi,
>
> I am working on building an app that reports the data from the already
> existing tables in the Oracle DB. These tables are data-dictionary
> tables and my application will connect to these tables using read-only
> access to SELECT and draw graphs on the webpage.
> How do I build my application that queries the already existing
> tables? Am new to web development and all Django documentation
> discusses models that get created according to the models.py.

http://docs.djangoproject.com/en/dev/howto/legacy-databases/
http://www.djangobook.com/en/1.0/chapter16/

HTH

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



Re: Excellent Python/Django Opportunity in Atlanta!!!

2010-12-22 Thread Venkatraman S
On Wed, Dec 22, 2010 at 9:05 PM, ATL Recruiter wrote:

>
> Our client is building a team of world-class Python Developers with
> varying degrees of seniority and skills to build a brand new
> application that will drive this company to their future-state.
>

Mentioning the name of the client always adds some credibility to the post.

"future-state" -- nice! What are they building? :)

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



Re: Admin Site: how to add apps with no db model?

2010-12-22 Thread creecode
Hello armandoperico,

Sounds like a job for cron, Celery, or any other number of task
schedulers.

Alternately you could create a url at your website that runs the
script.  Of course putting in appropriate checks so that only you can
run it.

You could then probably customize the admin app index template <
http://docs.djangoproject.com/en/dev/ref/contrib/admin/#templates-which-may-be-overridden-per-app-or-model
> to show your link.  The link doesn't have to be put there of course,
it really could go anywhere that makes sense.

On Dec 21, 4:47 pm, armandoperico  wrote:

> on my "homepage" app i have some helper classes//scripts that are
> responsible for doing some specific "ADMIN" tasks:

> right now i have a script that does that for me, but every time i need
> run it, i have to run it by hand (via terminal).
>
> There is a way to add it on the Admin Site like we do with the models?
> i.e.: "admin.site.register(ModelClass)" or something like this ?

Toodle-lo
creecode

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



Re: Problem with simple file upload.

2010-12-22 Thread Nick Serra
I'm too lazy to check, but i'm pretty sure the name of your file input
needs to match the name of the form field. Also, try troubleshooting.
Use print statements in the view to see if the file object is being
posted, etc.

On Dec 21, 11:54 pm, vivek_12315  wrote:
> Awaiting reply!
>
> On Dec 22, 3:36 am, vivek_12315  wrote:
>
>
>
> > I am a beginner in Django programming. I am writing a simple module
> > for file upload looking at link:
>
> >http://docs.djangoproject.com/en/dev/topics/http/file-uploads/?from=o...
>
> > I have made a view = upload.py and corresponding html = upload.html.
>
> > Its content are as follows:
>
> > ~upload.py~~~
>
> > from django import
> > forms
> > from django.http import HttpResponseRedirect
> > from django.shortcuts import render_to_response
>
> > # Imaginary function to handle an uploaded file.
> > #from somewhere import handle_uploaded_file
> > class UploadFileForm(forms.Form):
> >     title = forms.CharField(max_length=100)
> >     file  = forms.FileField()
>
> > def upload_file(request):
> >     if request.method == 'POST':
> >         form = UploadFileForm(request.POST, request.FILES)
> >         if form.is_valid():
> >             handle_uploaded_file(request.FILES['file'])
> >             html = "success in upload "
> >             return HttpResponseRedirect(html)
> >     else:
> >         form = UploadFileForm()
> >     return render_to_response('upload.html', {'form': form})
>
> > def handle_uploaded_file(f):
> >     destination = open('/home/bluegene/doom.txt', 'wb+')
> >     for chunk in f.chunks():
> >         destination.write(chunk)
> >     destination.close()
>
> > end
>
> > ~upload.html~~~
> > 
> > 
> > 
> > 
> >  ---Upload--- Documents
> > 
> > 
> >         
> >         
> > 
> > 
> > Please enter the /path/name/of/directory containing
> > the documents to be indexed.
> > 
> > 
> > 
>
> > 
> >  > html>
>
> > end
>
> > When I browse for the file and hit 'upload' button, the shell shows a
> > POST request like:
>
> > [21/Dec/2010 16:31:32] "POST /index/ HTTP/1.1" 200 437
>
> > but I don't get a new file named "doom.txt" which I should.
>
> > Is there something wrong in my 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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django Debug Toolbar -- getting 404s for javascript file when using request.GET in SHOW_TOOLBAR_CALLBACK

2010-12-22 Thread Brian S
Thanks to kr who answered this offline. Some static files in the 
debug_toolbar need to be modified to include the ?debug arg. I put his 
suggestions into the attached patch file. 

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

--- debug_toolbar/templates/debug_toolbar/base.html	Wed Dec 22 12:27:31 2010
+++ debug_toolbar/templates/debug_toolbar/base.html	Wed Dec 22 12:34:58 2010
@@ -5,7 +5,7 @@
 var DEBUG_TOOLBAR_MEDIA_URL = "{{ DEBUG_TOOLBAR_MEDIA_URL }}";
 // ]]>
 
-
+
 
 	
 		
--- debug_toolbar/media/debug_toolbar/js/toolbar.min.js	 Wed Dec 22 12:30:44 2010
+++ debug_toolbar/media/debug_toolbar/js/toolbar.min.js	 Wed Dec 22 12:37:38 2010
@@ -1 +1 @@
-(function(g,a,b,i){var f,h;var e=false;if(!(f=g.jQuery)||b>f.fn.jquery||i(f)){var c=a.createElement("script");c.type="text/javascript";c.src=DEBUG_TOOLBAR_MEDIA_URL+"js/jquery.js";c.onload=c.onreadystatechange=function(){if(!e&&(!(h=this.readyState)||h=="loaded"||h=="complete")){i((f=g.jQuery).noConflict(1),e=true);f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}})(window,document,"1.3",function(b,a){b.cookie=function(f,n,q){if(typeof n!="undefined"){q=q||{};if(n===null){n="";q.expires=-1}var j="";if(q.expires&&(typeof q.expires=="number"||q.expires.toUTCString)){var k;if(typeof q.expires=="number"){k=new Date();k.setTime(k.getTime()+(q.expires*24*60*60*1000))}else{k=q.expires}j="; expires="+k.toUTCString()}var p=q.path?"; path="+(q.path):"";var l=q.domain?"; domain="+(q.domain):"";var e=q.secure?"; secure":"";document.cookie=[f,"=",encodeURIComponent(n),j,p,l,e].join("")}else{var h=null;if(document.cookie&&document.cookie!=""){var o=document.cookie.split(";");for(var m=0;m');var d="djdt";var c={init:function(){b("#djDebug").show();var e=null;b("#djDebugPanelList li a").click(function(){if(!this.className){return false}e=b("#djDebug #"+this.className);if(e.is(":visible")){b(document).trigger("close.djDebug");b(this).parent().removeClass("active")}else{b(".panelContent").hide();e.show();b("#djDebugToolbar li").removeClass("active");b(this).parent().addClass("active")}return false});b("#djDebug a.djDebugClose").click(function(){b(document).trigger("close.djDebug");b("#djDebugToolbar li").removeClass("active");return false});b("#djDebug a.remoteCall").click(function(){b("#djDebugWindow").load(this.href,{},function(){b("#djDebugWindow a.djDebugBack").click(function(){b(this).parent().parent().hide();return false})});b("#djDebugWindow").show();return false});b("#djDebugTemplatePanel a.djTemplateShowContext").click(function(){c.toggle_arrow(b(this).children(".toggleArrow"));c.toggle_content(b(this).parent().next());return false});b("#djDebugSQLPanel a.djSQLShowStacktrace").click(function(){c.toggle_content(b(".djSQLHideStacktraceDiv",b(this).parents("tr")));return false});b("#djHideToolBarButton").click(function(){c.hide_toolbar(true);return false});b("#djShowToolBarButton").click(function(){c.show_toolbar();return false});b(document).bind("close.djDebug",function(){if(b("#djDebugWindow").is(":visible")){b("#djDebugWindow").hide();return}if(b(".panelContent").is(":visible")){b(".panelContent").hide();return}if(b("#djDebugToolbar").is(":visible")){c.hide_toolbar(true);return}});if(b.cookie(d)){c.hide_toolbar(false)}else{c.show_toolbar(false)}},toggle_content:function(e){if(e.is(":visible")){e.hide()}else{e.show()}},close:function(){b(document).trigger("close.djDebug");return false},hide_toolbar:function(e){b("#djDebugWindow").hide();b(".panelContent").hide();b("#djDebugToolbar li").removeClass("active");b("#djDebugToolbar").hide("fast");b("#djDebugToolbarHandle").show();b(document).unbind("keydown.djDebug");if(e){b.cookie(d,"hide",{path:"/",expires:10})}},show_toolbar:function(e){b(document).bind("keydown.djDebug",function(f){if(f.keyCode==27){c.close()}});b("#djDebugToolbarHandle").hide();if(e){b("#djDebugToolbar").show("fast")}else{b("#djDebugToolbar").show()}b.cookie(d,null,{path:"/",expires:-1})},toggle_arrow:function(f){var e=String.fromCharCode(9654);var g=String.fromCharCode(9660);f.html(f.html()==e?g:e)}};b(document).ready(function(){c.init()})});
\ No newline at end of file
+(function(g,a,b,i){var f,h;var e=false;if(!(f=g.jQuery)||b>f.fn.jquery||i(f)){var c=a.createElement("script");c.type="text/javascript";c.src=DEBUG_TOOLBAR_MEDIA_URL+"js/jquery.js";c.onload=c.onreadystatechange=function(){if(!e&&(!(h=this.readyState)||h=="loaded"||h=="complete")){i((f=g.jQuery).noConflict(1),e=true);f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}})(window,document,"1.3",function(b,a){b.cookie=function(f,n,q){if(typeof n!="undefined"){q=q||{};if(n===null){n="";q.expires=-1}var j="";if(q.expires&&(typeof q.expires=="number"||q.expires.toUTCSt

Re: Problem with simple file upload.

2010-12-22 Thread yiftah
Nick is right, you need to change your view code to
handle_uploaded_file(request.FILES['uploaded'])
instead of
handle_uploaded_file(request.FILES['file'])

I'm not sure a request object can process a file upload
you may need to use RequestContext in your view definition

On Dec 22, 7:50 pm, Nick Serra  wrote:
> I'm too lazy to check, but i'm pretty sure the name of your file input
> needs to match the name of the form field. Also, try troubleshooting.
> Use print statements in the view to see if the file object is being
> posted, etc.
>
> On Dec 21, 11:54 pm, vivek_12315  wrote:
>
> > Awaiting reply!
>
> > On Dec 22, 3:36 am, vivek_12315  wrote:
>
> > > I am a beginner in Django programming. I am writing a simple module
> > > for file upload looking at link:
>
> > >http://docs.djangoproject.com/en/dev/topics/http/file-uploads/?from=o...
>
> > > I have made a view = upload.py and corresponding html = upload.html.
>
> > > Its content are as follows:
>
> > > ~upload.py~~~
>
> > > from django import
> > > forms
> > > from django.http import HttpResponseRedirect
> > > from django.shortcuts import render_to_response
>
> > > # Imaginary function to handle an uploaded file.
> > > #from somewhere import handle_uploaded_file
> > > class UploadFileForm(forms.Form):
> > >     title = forms.CharField(max_length=100)
> > >     file  = forms.FileField()
>
> > > def upload_file(request):
> > >     if request.method == 'POST':
> > >         form = UploadFileForm(request.POST, request.FILES)
> > >         if form.is_valid():
> > >             handle_uploaded_file(request.FILES['file'])
> > >             html = "success in upload "
> > >             return HttpResponseRedirect(html)
> > >     else:
> > >         form = UploadFileForm()
> > >     return render_to_response('upload.html', {'form': form})
>
> > > def handle_uploaded_file(f):
> > >     destination = open('/home/bluegene/doom.txt', 'wb+')
> > >     for chunk in f.chunks():
> > >         destination.write(chunk)
> > >     destination.close()
>
> > > end
>
> > > ~upload.html~~~
> > > 
> > > 
> > > 
> > > 
> > >  ---Upload--- Documents
> > > 
> > > 
> > >         
> > >         
> > > 
> > > 
> > > Please enter the /path/name/of/directory containing
> > > the documents to be indexed.
> > > 
> > > 
> > > 
>
> > > 
> > >  > > html>
>
> > > end
>
> > > When I browse for the file and hit 'upload' button, the shell shows a
> > > POST request like:
>
> > > [21/Dec/2010 16:31:32] "POST /index/ HTTP/1.1" 200 437
>
> > > but I don't get a new file named "doom.txt" which I should.
>
> > > Is there something wrong in my 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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



What's your workflow?

2010-12-22 Thread Dana
I've been bashing my head against a wall lately trying to determine
the best (highly subjective, I know) workflow for developing Django
projects.

What I have gathered so far is:

* Buildout -- For building and packaging your projects.
* Fabric -- For easy deployment/testing of code on devel/staging/
production servers
* PIP -- For installing Python packages into your project.
* virtualenv -- For creating an isolated Python environment.

... but what I am having trouble figuring out is how the workflow
should be between these tools.

* What's the relationship between PIP and buildout in development vs.
deployment?
* Is buildout used solely for installing/packaging stuff for
deployment?
* Do you use fabric to run buildout on a server?
* What role does PIP requirements file play in all this? Is it used?
* Are you using setuptools or distribute?

I know this is a very broad and subjective topic but I'd love to hear
what you guys and gals are doing out there to develop rapidly and to
deploy efficiently and predictably.

Cheers

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



XBAP application

2010-12-22 Thread stegzzz
Hi, I have an XBAP application that I want to run from my django
website. At the moment I'm just setup on my local machine using the
development server and it is working OK for straightforward html pages
and the XBAP program works OK if I just click on the XBAP file.

However when I want to run the XBAP from django I just end up with the
xml contents of the XBAP file onscreen.
I was trying to use a view function like this:

def current_XABP(request):
s=open('C:/Python26/Lib/site-packages/django/myproject/
WpfBrowserApplication1.xbap')
xml=s.read()
s.close()
return HttpResponse(xml, mimetype="application/x-ms-xbap")

Any ideas what I'm doing wrong?

Thanks, stegzzz

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



Re: What's your workflow?

2010-12-22 Thread Subramanyam
Hi

After working on couple of big projects I felt the best way to start on
django once you have the basic setup ready is

1.) Have a complete list of the features into your requirement documents
if its not possible and you want a agile development methodology split
into features that makes sense w.r.t sub-releases

2.) understand what all external django apps you may need and go through
their documentation as well

3.) Create the db model as completely as possible i.e include any future
fields that you need, or you feel could be important for you project,
 addressing in the first go would be great
( I messed up DB modelling and I had to redo quite some )

4.) Start working on the views page by page w.r.t the requirement

5.) Have the unit test case after you are done ( or even before you develop
if you are using TDD model )

6.) once you feel complete then go for selenium , deployment automation, ...
and the rest


Subramanyam


On Thu, Dec 23, 2010 at 12:10 AM, Dana  wrote:

> I've been bashing my head against a wall lately trying to determine
> the best (highly subjective, I know) workflow for developing Django
> projects.
>
> What I have gathered so far is:
>
> * Buildout -- For building and packaging your projects.
> * Fabric -- For easy deployment/testing of code on devel/staging/
> production servers
> * PIP -- For installing Python packages into your project.
> * virtualenv -- For creating an isolated Python environment.
>
> ... but what I am having trouble figuring out is how the workflow
> should be between these tools.
>
> * What's the relationship between PIP and buildout in development vs.
> deployment?
> * Is buildout used solely for installing/packaging stuff for
> deployment?
> * Do you use fabric to run buildout on a server?
> * What role does PIP requirements file play in all this? Is it used?
> * Are you using setuptools or distribute?
>
> I know this is a very broad and subjective topic but I'd love to hear
> what you guys and gals are doing out there to develop rapidly and to
> deploy efficiently and predictably.
>
> Cheers
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: What's your workflow?

2010-12-22 Thread Dana
Subramanyam, thanks for the response.

In regard to 3, I am not clear why it would be a good idea to add in
model fields for things you *think* you might want some day.

I would think that using Django South or something similar to create
SQL migrations for your model after a change would be a cleaner
solution... I don't like the idea of adding fields to a model that I
will not use right away as it adds cruft and complexity to my models
and makes it so determining what is being used and what is not more
difficult. Also, since you would be planning for the future, there is
a good chance things will change so much that it would render those
fields obsolete or inaccurate.

Do you use PIP, virtualenv or any of the other tools I mentioned in my
first post?

Cheers

On Dec 22, 11:12 am, Subramanyam  wrote:
> Hi
>
> After working on couple of big projects I felt the best way to start on
> django once you have the basic setup ready is
>
> 1.) Have a complete list of the features into your requirement documents
>     if its not possible and you want a agile development methodology split
> into features that makes sense w.r.t sub-releases
>
> 2.) understand what all external django apps you may need and go through
> their documentation as well
>
> 3.) Create the db model as completely as possible i.e include any future
> fields that you need, or you feel could be important for you project,
>  addressing in the first go would be great
> ( I messed up DB modelling and I had to redo quite some )
>
> 4.) Start working on the views page by page w.r.t the requirement
>
> 5.) Have the unit test case after you are done ( or even before you develop
> if you are using TDD model )
>
> 6.) once you feel complete then go for selenium , deployment automation, ...
> and the rest
>
> Subramanyam
>
> On Thu, Dec 23, 2010 at 12:10 AM, Dana  wrote:
> > I've been bashing my head against a wall lately trying to determine
> > the best (highly subjective, I know) workflow for developing Django
> > projects.
>
> > What I have gathered so far is:
>
> > * Buildout -- For building and packaging your projects.
> > * Fabric -- For easy deployment/testing of code on devel/staging/
> > production servers
> > * PIP -- For installing Python packages into your project.
> > * virtualenv -- For creating an isolated Python environment.
>
> > ... but what I am having trouble figuring out is how the workflow
> > should be between these tools.
>
> > * What's the relationship between PIP and buildout in development vs.
> > deployment?
> > * Is buildout used solely for installing/packaging stuff for
> > deployment?
> > * Do you use fabric to run buildout on a server?
> > * What role does PIP requirements file play in all this? Is it used?
> > * Are you using setuptools or distribute?
>
> > I know this is a very broad and subjective topic but I'd love to hear
> > what you guys and gals are doing out there to develop rapidly and to
> > deploy efficiently and predictably.
>
> > Cheers
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

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



Re: XBAP application

2010-12-22 Thread Mr. Gerardo Gonzalez Cruz
Why don't use a iframe, inside iframe call a your xbap application.



On Wed, Dec 22, 2010 at 12:35 PM, stegzzz  wrote:

> Hi, I have an XBAP application that I want to run from my django
> website. At the moment I'm just setup on my local machine using the
> development server and it is working OK for straightforward html pages
> and the XBAP program works OK if I just click on the XBAP file.
>
> However when I want to run the XBAP from django I just end up with the
> xml contents of the XBAP file onscreen.
> I was trying to use a view function like this:
>
> def current_XABP(request):
>s=open('C:/Python26/Lib/site-packages/django/myproject/
> WpfBrowserApplication1.xbap')
>xml=s.read()
>s.close()
>return HttpResponse(xml, mimetype="application/x-ms-xbap")
>
> Any ideas what I'm doing wrong?
>
> Thanks, stegzzz
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Greetings / Saludos
Gerardo González Cruz (GGC)

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



Re: English translation for error message?

2010-12-22 Thread Nick Serra
http://translate.google.com/#auto|en|%20list%20index%20out%20of%20range

On Dec 21, 6:10 pm, Bill Freeman  wrote:
> On Tue, Dec 21, 2010 at 5:53 PM, Jonathan Hayward <
>
>
>
>
>
> christos.jonathan.hayw...@gmail.com> wrote:
> > [jhayw...@cmlnxbld01 invdb]$ python manage.py shell
> > Python 2.7 (r27:82500, Dec  2 2010, 14:06:29)
> > [GCC 4.2.4] on linux2
> > Type "help", "copyright", "credits" or "license" for more information.
> > (InteractiveConsole)
> > >>> import models
> > Traceback (most recent call last):
> >   File "", line 1, in 
> >   File "/home/jhayward/invdb/models.py", line 50, in 
> >     class architecture(models.Model):
> >   File
> > "/tools/python/2.7/Linux_x86_64/lib/python2.7/site-packages/django/db/model 
> > s/base.py",
> > line 48, in __new__
> >     kwargs = {"app_label": model_module.__name__.split('.')[-2]}
> > IndexError: list index out of range
>
> > What is going on in this error message?
>
> The "English" translation is "list index out of range".
>
> As to what causes it, I'd guess that model_module.__name__ has not '.' in
> it, so the split returns a list of one item, and -2 is then an illegal
> index.
>
> This would seem to be because your models.py is in the same directory as
> your manage.py (and presumably settings.py), thus your ability to try and
> import it as just "import models".  Looking at the base.py code, it really
> expects a models.py file to be in a package (an app package, whose name this
> code is trying to figure out), and fails when it is not.
>
> The fix, if all this is true, is to create a sub folder for your "app", put
> the models.py (and views.py and maybe forms.py, admin.py, app specific
> urls.py) in that folder, allong with a (probably empty) file called
> __init__.py (that's two underscores before and two after, the word init).
> The name of this folder becomes your app name, e.g.; "my_app".  Then you
> would retry your experiment by typing "import my_app.models".
>
>
>
>
>
> > It occurred after I went through and added docstrings, __str__(), and
> > __unicode__() methods; I get the same error, referring to the same class,
> > when I go through and comment out the docstring and __str__() and
> > __unicode__() methods.
>
> > What are the likely causes, and what can I do to fix this?
>
> > --
> > [image: Christos Jonathan Hayward] 
> > Christos Jonathan Hayward, an Orthodox Christian author.
>
> > Author Bio  • 
> > Books
> >  • *Email * • 
> > Facebook
> >  • LinkedIn  • 
> > Twitter
> >  • *Web * • What's 
> > New?
> > I invite you to visit my "theology, literature, and other creative works"
> > site.
>
> >  --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com > groups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

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



Re: Building app on already existing set of DB tables

2010-12-22 Thread Ian
On Dec 22, 9:22 am, Vikram  wrote:
> Scenario:
> table v$session contains all the current sessions information and is
> under SYS user. My web application should connect as webinfo user that
> has read-only access on v$session table, query the data and present it
> in webpage.
>
> Do I write views that directly talk to these tables, pull data and
> render it online? Or is there a better way?

Yes, you should create synonyms (or views, if you want more fine-
grained control) that pull those tables into the Django user's
schema.  Inspectdb will not work for synonyms or views in Oracle, so
you will need to write the models by hand.

Cheers,
Ian

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



Re: Creating initial Security/Auth objects with syncdb

2010-12-22 Thread Nick Serra
Could just put the group in the initial data for sync db. Look up
django fixtures. It will load data into the database from a json feed
on syncdb.

On Dec 21, 1:50 pm, "Mark (Nosrednakram)" 
wrote:
> Hello,
>
> I would like to install an auth_group with my application and am
> considering using the following code in app/management/__init__.py.
> Is this an acceptable solution?  Is there a better way to do this?
>
> Thanks,
> Mark
>
> from django.db.models import signals
> try:
>     from django.contrib.auth.models import Permission, Group
>     skip = False
> except:
>     print """Please add django.contrib.auth to your INSTALLED_APPS in
> setting.py.
>     If this is your first syncdb please re-run so security groups get
> added for my_app."""
>     skip = True
>
> def create_groups(sender, **kwargs):
>     if skip:
>         return
>     try:
>         Group.objects.get(name='workorder_admin')
>     except:
>         wo_admin_g = Group(name='workorder_admin').save()
>
> signals.post_syncdb.connect(create_groups)

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



Re: What's your workflow?

2010-12-22 Thread W. Craig Trader
Dana ...

How you build and deploy your project will be shaped by the environment
where you're deploying.  Thus my choices about "best practices" will be very
different that yours.  That said, here are my thoughts (worth exactly what
they cost you):


   - You're definitely right about using South migrations to allow you to
   refactor your database model as needed.  (I wish I could use it on my
   current project -- long story that I can't tell.)  If you do intend to use
   South, start using it early, instead of adding it in later.
   - VirtualEnv and Pip have proven very useful to me in several
   environments -- the ability to easily install and uninstall packages into a
   controlled environment is critical when you are deploying to servers where
   you don't have administrative access (ie: hosting environments).
   - Most of the Python package infrastructure (pip, setuptools, distribute)
   believes that it will be used on systems that are connected to the Internet,
   and their developers rarely test anything without a live connection to the
   Internet, which means that frequently the tools are broken for offline use.
   (Note that once you point out the breakage, they will fix it, but it can be
   confusing for the unwary).

- Craig -

On Wed, Dec 22, 2010 at 13:40, Dana  wrote:

> I've been bashing my head against a wall lately trying to determine
> the best (highly subjective, I know) workflow for developing Django
> projects.
>
> What I have gathered so far is:
>
> * Buildout -- For building and packaging your projects.
> * Fabric -- For easy deployment/testing of code on devel/staging/
> production servers
> * PIP -- For installing Python packages into your project.
> * virtualenv -- For creating an isolated Python environment.
>
> ... but what I am having trouble figuring out is how the workflow
> should be between these tools.
>
> * What's the relationship between PIP and buildout in development vs.
> deployment?
> * Is buildout used solely for installing/packaging stuff for
> deployment?
> * Do you use fabric to run buildout on a server?
> * What role does PIP requirements file play in all this? Is it used?
> * Are you using setuptools or distribute?
>
> I know this is a very broad and subjective topic but I'd love to hear
> what you guys and gals are doing out there to develop rapidly and to
> deploy efficiently and predictably.
>
> Cheers
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: XBAP application

2010-12-22 Thread stegzzz
Thanks for the reply. I did try this already, like this:

The html file xdt.html was:

 
XBAP test
 

HTMLx#1

HTMLx#2
 

and the view file contained:

def current_XABP(request):
 t = get_template('xdt.html')
 s='C:/Python26/Lib/site-packages/django/myproject/
WpfBrowserApplication1.xbap'
 html=t.render(Context({'app':s}))
 return HttpResponse(html)

and I ended onscreen with an empty frame.

I don't know which approach is best, but whatever, neither seem to
work; if you can spot what is wrong that would be great...

Stegzzz

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



Re: What's your workflow?

2010-12-22 Thread Subramanyam
hi Dana


On Thu, Dec 23, 2010 at 12:51 AM, Dana  wrote:

> Subramanyam, thanks for the response.
>
> In regard to 3, I am not clear why it would be a good idea to add in
> model fields for things you *think* you might want some day.
>
> I would think that using Django South or something similar to create
> SQL migrations for your model after a change would be a cleaner
> solution... I don't like the idea of adding fields to a model that I
> will not use right away as it adds cruft and complexity to my models
> and makes it so determining what is being used and what is not more
> difficult. Also, since you would be planning for the future, there is
> a good chance things will change so much that it would render those
> fields obsolete or inaccurate.
>

My point exactly is to lessen the changes that one may want to say I can do
them later and that ends up being a daunting task later
( personally we have re factored much of the code that way)

The fields I mentioned are mostly relation for tables that would be part of
your project but which are required to be implemented later

South is a good tool, but my point is its better not to get to the point
that we have to use South
( Invariably we end up with that its a different case )

Regarding changes of DB, we dont want to predict that there may be many
changes, that I dont know now,  instead I feel it should be "I have
estimated all of the project`s DB schema now as per the features and dont
need anymore unless the features are completely changed

- Subramanyam

>
> Do you use PIP, virtualenv or any of the other tools I mentioned in my
> first post?
>
> Cheers
>
> On Dec 22, 11:12 am, Subramanyam  wrote:
> > Hi
> >
> > After working on couple of big projects I felt the best way to start on
> > django once you have the basic setup ready is
> >
> > 1.) Have a complete list of the features into your requirement documents
> > if its not possible and you want a agile development methodology
> split
> > into features that makes sense w.r.t sub-releases
> >
> > 2.) understand what all external django apps you may need and go through
> > their documentation as well
> >
> > 3.) Create the db model as completely as possible i.e include any future
> > fields that you need, or you feel could be important for you project,
> >  addressing in the first go would be great
> > ( I messed up DB modelling and I had to redo quite some )
> >
> > 4.) Start working on the views page by page w.r.t the requirement
> >
> > 5.) Have the unit test case after you are done ( or even before you
> develop
> > if you are using TDD model )
> >
> > 6.) once you feel complete then go for selenium , deployment automation,
> ...
> > and the rest
> >
> > Subramanyam
> >
> > On Thu, Dec 23, 2010 at 12:10 AM, Dana  wrote:
> > > I've been bashing my head against a wall lately trying to determine
> > > the best (highly subjective, I know) workflow for developing Django
> > > projects.
> >
> > > What I have gathered so far is:
> >
> > > * Buildout -- For building and packaging your projects.
> > > * Fabric -- For easy deployment/testing of code on devel/staging/
> > > production servers
> > > * PIP -- For installing Python packages into your project.
> > > * virtualenv -- For creating an isolated Python environment.
> >
> > > ... but what I am having trouble figuring out is how the workflow
> > > should be between these tools.
> >
> > > * What's the relationship between PIP and buildout in development vs.
> > > deployment?
> > > * Is buildout used solely for installing/packaging stuff for
> > > deployment?
> > > * Do you use fabric to run buildout on a server?
> > > * What role does PIP requirements file play in all this? Is it used?
> > > * Are you using setuptools or distribute?
> >
> > > I know this is a very broad and subjective topic but I'd love to hear
> > > what you guys and gals are doing out there to develop rapidly and to
> > > deploy efficiently and predictably.
> >
> > > Cheers
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Django users" group.
> > > To post to this group, send email to django-us...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > django-users+unsubscr...@googlegroups.com
> 
> >
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@goog

Forms Questions

2010-12-22 Thread hank23
I've been going through a lot of the forms related documentation and
some things are still not clear, partly because of information
overload. First do I have to code/generate my forms using my models?
If not then if I code my form from scratch will it still have all or
most of the background functionality as it would if I had generated it
driectly from the models? Like will I still be able to use field
validators and be able to use some of the methods like is_valid(),
clean(), is_bound, as_p(), as_ul(), as_table(), etc.? I would
appreciate any help, explanations, or links to good examples or
tutorials of using forms, other than the introductory django tutorial.
Thanks in advance for the help.

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



Re: Forms Questions

2010-12-22 Thread ringemup
> First do I have to code/generate my forms using my models?

No.  Model forms are basically a shortcut to the very common use case
of creating a form to update or save a single model object.  With
regular forms, you just have to explicitly declare your form fields
instead of counting on the modelform module to build the fields for
you based on the model.

> If not then if I code my form from scratch will it still have all or
> most of the background functionality as it would if I had generated it
> driectly from the models?

Much of it.  You won't have save() functionality built in, and the
only validators run will be those related to your specific form field
declarations, and those you explicitly define yourself -- i.e. it
won't inherit any validation from your models because it's not linked
to your models.

> Like will I still be able to use field
> validators and be able to use some of the methods like is_valid(),
> clean(), is_bound, as_p(), as_ul(), as_table(), etc.?

Yes, all of those.

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



Accessing Form Field Values / Using Javascript

2010-12-22 Thread hank23
Is it possible to use javascript to capture and react to events and
possibly enable/disable screen controls by setting values or flags?
How do I access the values or selected option(s) of say a checkbox
control, dropdown box so that I can react to them in my views? Is it
possible to react to control events at the browser level, as opposed
to my views level? 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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django session InvalidOperation

2010-12-22 Thread Ignacio
Hi kinder. I've got this exact problem with django 1.2.3 and python
2.7.
Could you find a fix for it?

On 11 dic, 16:18, Leo  wrote:
> Hard to know from what's shown here, but it seems likely that your
> database didn't get created properly on the new server.  The error
> suggests that the expire_date column of the django_session table in
> the MySQL database is of type DECIMAL rather than the expected
> DATETIME.  How did you migrate the database to the new server?  It's
> best to use  mysqldump and not simply copy the data files when you're
> changing MySQL versions.
>
> On Dec 11, 12:31 pm, kinder  wrote:
>
>
>
>
>
>
>
> > I'm stumped... even removing mod_php from the apache config (which is
> > where I suspected a different mysql shared library), I still get the
> > same InvalidOperation error. Any suggestions what to try next?

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



Re: Forms Questions

2010-12-22 Thread Łukasz Rekucki
On 22 December 2010 22:27, hank23  wrote:
> I've been going through a lot of the forms related documentation and
> some things are still not clear, partly because of information
> overload.

> First do I have to code/generate my forms using my models?
No, forms can be used independently of models.

> If not then if I code my form from scratch will it still have all or
> most of the background functionality as it would if I had generated it
> driectly from the models?
Yes, they just won't be auto-generated from your models.

> Like will I still be able to use field validators,
Yes. Most form fields have some validators defined (like EmailField)
and you can add more:
http://docs.djangoproject.com/en/dev/ref/forms/validation/#using-validators

and be able to use some of the methods like is_valid(),
> clean(), is_bound, as_p(), as_ul(), as_table(), etc.?

Everything except save(), 'cause there is nothing to save.

> I would
> appreciate any help, explanations, or links to good examples or
> tutorials of using forms, other than the introductory django tutorial.
> Thanks in advance for the help.

You can take a look at djangobook: http://www.djangobook.com/en/2.0/chapter07/

-- 
Łukasz Rekucki

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



Where Are Forms Built

2010-12-22 Thread hank23
I've seen how to build my own forms in the documentation and how to
import the Django base forms class, but where does the code to build
my own screens get put? Is it supposed to be put in the views module
for my app or somewhere else? I'm guessing it goes in the views, but
that's only my best guess.

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



Re: Where Are Forms Built

2010-12-22 Thread ringemup

> I've seen how to build my own forms in the documentation and how to
> import the Django base forms class, but where does the code to build
> my own screens get put? Is it supposed to be put in the views module
> for my app or somewhere else? I'm guessing it goes in the views, but
> that's only my best guess.

Wherever you like.  A lot of people will add a forms.py module to any
app that uses custom forms.  You can then import your form classes
into views.py for use in views.  The views are where you process the
form and views + templates deal with displaying them.

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



Re: What's your workflow?

2010-12-22 Thread Cal Leeming [Simplicity Media Ltd]
Apologies if I have repeated what anyone else has said, or if some of 
these comments aren't directly related, but here's my two cents worth.


And remember, rapid development isn't always about the different pieces 
of software or frameworks that you use, so hopefully some of the below 
comments give some food for thought.


   * Make sure your workflow is sensible for the size of the project
 you are working on. For example, there's no point putting
 significant time into enterprise grade unit testing, if the app is
 not business critical, or the client doesn't want to pay too much.

   * If the project is in-house (i.e. its one of your own projects),
 then these are the best times to experiment with new methods and
 solutions, because then you are not putting your clients product
 at risk, and you learn from mistakes the easy way. (we've all been
 there!)

   * It is nice to use isolated Python environments where ever
 possible, but remember, they will need to be maintained manually
 (for security patches etc). This does have its benefits, for
 example if your Django app has dependancies for a specific version
 of a module, and the sys admin upgrades Python, and thus breaks
 your app.

   * Before you even touch anything, make sure you have a spec from the
 client first. This is absolutely crucial if you want an easy life.
 Again, if this is your own project, you may choose to either draw
 up a spec to give you a good idea as to how one should look
 (you'll learn along the way), or think up the spec as you go
 along. Some clients will say there is no spec, and that they are
 thinking of things off the top of their head. In these cases, you
 must *insist* that you work on a daily rate, no exceptions,
 otherwise clients will take you for a ride (again, we've all been
 there before).

   * It's good to start with the database models first, to make sure
 that the underlaying foundations of your application are sound.
 Try to anticipate future modifications, and don't bother too much
 with tuning to begin with. As long as you have some decent skills
 in the database you have chosen to use, then it is an easy enough
 task to create indexes along the way etc.

   * If you want to test work flow, then try and make good use of the
 "manage.py shell" and also the ability to create management
 commands. This will allow you to quickly test code changes,
 without having to do app restarts, or going through login
 processes. I know this sounds like a minimal amount of time saves,
 but when you're doing 200-300 test runs a day, it soon adds up!
 Again, use your own discretion as to whether this approach is
 sensible for the size of the project.

Also, as a side comment, I haven't used either buildout or fabric, so I 
can't offer much advice on these.


On 22/12/2010 18:40, Dana wrote:

I've been bashing my head against a wall lately trying to determine
the best (highly subjective, I know) workflow for developing Django
projects.

What I have gathered so far is:

* Buildout -- For building and packaging your projects.
* Fabric -- For easy deployment/testing of code on devel/staging/
production servers
* PIP -- For installing Python packages into your project.
* virtualenv -- For creating an isolated Python environment.

... but what I am having trouble figuring out is how the workflow
should be between these tools.

* What's the relationship between PIP and buildout in development vs.
deployment?
* Is buildout used solely for installing/packaging stuff for
deployment?
* Do you use fabric to run buildout on a server?
* What role does PIP requirements file play in all this? Is it used?
* Are you using setuptools or distribute?

I know this is a very broad and subjective topic but I'd love to hear
what you guys and gals are doing out there to develop rapidly and to
deploy efficiently and predictably.

Cheers



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



SSL through WSGI

2010-12-22 Thread Jakob H
Hi, I have a related SSL question using WSGI and Apache.

In my .htaccess file I have something like this:

RewriteEngine On
RewriteBase /
RewriteRule ^(adminmedia/.*)$ - [L]
RewriteRule ^(django\.fcgi/.*)$ - [L]
RewriteCond %{REQUEST_FILENAME} !^/?resources/
RewriteRule ^(.*)$ django.fcgi/$1 [L]
SetEnvIf X-Url-Scheme https HTTPS=1

And in my django.wsgi file I have something like this:

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

Whenever I request a 'resource' file using https://[host].org/resources/...
SSL works fine. This is because WSGI is not involved and the request
is handled by Apache directly. However, whenever something is passed
through WSGI and rendered by the Django engine, all requests using the
HTTPS protocol are automatically forwarded to using the HTTP protocol,
and why sites are not served using SSL. Why does this happen? Where do
I go wrong?

Thanks,
Jakob

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



Re: What's your workflow?

2010-12-22 Thread ringemup

>     * If you want to test work flow, then try and make good use of the
>       "manage.py shell" and also the ability to create management
>       commands. This will allow you to quickly test code changes,
>       without having to do app restarts, or going through login
>       processes.

Cal, would you be willing to elaborate a bit on this point, or maybe
share an example?

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



Re: What's your workflow?

2010-12-22 Thread Cal Leeming [Simplicity Media Ltd]

Sure thing.

In several previous projects, they required the user to upload a file 
via the browser (usually above 10mb), and this was then sent off into 
the queuing system to be processed. Now, because of the huge amounts of 
time it took to upload, we instead created a management command, which 
did a file read directly from disk rather than requiring an upload each 
time. At the same time, the command also spat out huge amounts of debug 
during processing, so when we needed to figure out why the adapter (i.e. 
the piece of code that was scanning for content inside the file) wasn't 
working, we could easily do this without the overhead of uploading and 
waiting for debug emails to come back from the queuing system.


As for the django shell, this is extremely useful for testing individual 
pieces of code on the fly. It is a tad annoying that if any of the 
python modules change after being imported, reload() doesn't seem to 
play nicely all the time, so this usually means restarting the shell. 
But, for things like model lookups etc, I find it a great deal easier 
than writing huge chunks of SELECT SQL.



On 22/12/2010 22:12, ringemup wrote:

 * If you want to test work flow, then try and make good use of the
   "manage.py shell" and also the ability to create management
   commands. This will allow you to quickly test code changes,
   without having to do app restarts, or going through login
   processes.

Cal, would you be willing to elaborate a bit on this point, or maybe
share an example?



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



Re: What's your workflow?

2010-12-22 Thread ringemup

Thanks, Cal -- that's extremely helpful.

On Dec 22, 5:42 pm, "Cal Leeming [Simplicity Media Ltd]"
 wrote:
> Sure thing.
>
> In several previous projects, they required the user to upload a file
> via the browser (usually above 10mb), and this was then sent off into
> the queuing system to be processed. Now, because of the huge amounts of
> time it took to upload, we instead created a management command, which
> did a file read directly from disk rather than requiring an upload each
> time. At the same time, the command also spat out huge amounts of debug
> during processing, so when we needed to figure out why the adapter (i.e.
> the piece of code that was scanning for content inside the file) wasn't
> working, we could easily do this without the overhead of uploading and
> waiting for debug emails to come back from the queuing system.
>
> As for the django shell, this is extremely useful for testing individual
> pieces of code on the fly. It is a tad annoying that if any of the
> python modules change after being imported, reload() doesn't seem to
> play nicely all the time, so this usually means restarting the shell.
> But, for things like model lookups etc, I find it a great deal easier
> than writing huge chunks of SELECT SQL.
>
> On 22/12/2010 22:12, ringemup wrote:
>
> >>      * If you want to test work flow, then try and make good use of the
> >>        "manage.py shell" and also the ability to create management
> >>        commands. This will allow you to quickly test code changes,
> >>        without having to do app restarts, or going through login
> >>        processes.
> > Cal, would you be willing to elaborate a bit on this point, or maybe
> > share an example?
>
>

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



Django RSS feed consolidator?

2010-12-22 Thread Christophe Pettus
Is there a feed consolidator for Django-related RSS feeds?  One exists for the 
PostgreSQL project, and it's pretty nice to keep track of what PG-related stuff 
is being written by various bloggers.  If not, is there interest in such a 
thing?

--
-- Christophe Pettus
   x...@thebuild.com

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



Re: Django RSS feed consolidator?

2010-12-22 Thread Christophe Pettus
Like, say, the one at:

http://www.djangoproject.com/community/

You know, something like that?

Never mind!

On Dec 22, 2010, at 3:04 PM, Christophe Pettus wrote:

> Is there a feed consolidator for Django-related RSS feeds?  One exists for 
> the PostgreSQL project, and it's pretty nice to keep track of what PG-related 
> stuff is being written by various bloggers.  If not, is there interest in 
> such a thing?
> 
> --
> -- Christophe Pettus
>   x...@thebuild.com
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 

--
-- Christophe Pettus
   x...@thebuild.com

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



Modifying default permissions given to a model

2010-12-22 Thread Burhan
Hello All:

I am creating a model that should only be 'read-only' in the admin.
That is, the only way to add new records in the database for this
model is through the code, not manually.

However, I would like the admin user to be able to view entries in
this model. An example of such a model would be a system log - users
can't write to a system log, but they can view it.

So I would like to know of a way to prevent 'add' permissions being
added to models in this application - in other words, modify the
default permissions set by the django admin application.

Currently I am manually removing "add" permissions by listening to the
post_save signal, but this doesn't remove the permissions from the
django "add users" form, and am thinking of writing a SQL hack to
remove these permissions as part of manage.py syncdb, but I'm hoping
there is a simpler way to do this.

Thanks for any pointers.

Django version: 1.2.3

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



Re: fcgi, runfastcgi, parameters, docs [noob question]

2010-12-22 Thread Karen Tracey
On Wed, Dec 22, 2010 at 8:52 AM, Richard Brosnahan wrote:

> The .fcgi script runs until I get to the line where I try to execute
> runfastcgi.
>
> from django.core.servers.fastcgi import runfastcgi
> runfastcgi(method="threaded", daemonize="false")
>
> [snip]
>
> I get an error saying "method" is not defined, and "daemonize" is not
> defined. Further, those parameters don't match the method in the source:
>
> fastcgi.py:89:
> def runfastcgi(argset=[], **kwargs):
>
>
You are passing a couple of keyword arguments to a function that accepts
keyword arguments (**kwargs), that's not a problem. Nor is not passing
argset, since the function definition includes a default value for that if
it is not passed by the caller. Specifics of the exact error message you are
getting may help someone help you; the problem is not that the provided
arguments don't match what is accepted by that function definition.

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

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



django/contrib/auth/models.py goes nuts

2010-12-22 Thread John Fabiani
Hi,
I had a working website for about the last 2 weeks.  I was using a test 
database (Postgres).  I am also using SVN for my code and have tried to revert 
back many versions and I still get these new errors.

The error first appeared as datetime has no Attribute 'None' for a line in my 
views.py
user = User.objects.create_user(c.registration_id, c.email, 
request.POST['txtPassword'])

The error was from in django/contrib/auth/models.py
now = datetime.datetime.now()

No datetime?? But the module imports the datetime module at the top.  This is 
django code and I made no changes to the code.

So I added the following just for testing (just in case I had re-defined 
datetime):
try:
now = datetime.datetime.now()
except:
import datetime
now = datetime.datetime.now()

But now in the same module I get a new error:

TypeError: 'NoneType' object is not callable for 
salt = get_hexdigest(algo, str(random.random()), str(random.random()))[:5]

This is crazy!  I can not understand what has happened!

I'm hoping someone understands this better than I do!

Just running 
python manage.py runserver
I get a 500.  

I'm on openSUSE 11.3, python 2.6.5, django 1.2.3 (was on 1.2.1).  I really 
need help!

Johnf

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



Re: django/contrib/auth/models.py goes nuts

2010-12-22 Thread John Fabiani
On Wednesday, December 22, 2010 06:44:47 pm John Fabiani wrote:
> Hi,
> I had a working website for about the last 2 weeks.  I was using a test
> database (Postgres).  I am also using SVN for my code and have tried to
> revert back many versions and I still get these new errors.
> 
> The error first appeared as datetime has no Attribute 'None' for a line in
> my views.py
> user = User.objects.create_user(c.registration_id, c.email,
> request.POST['txtPassword'])
> 
> The error was from in django/contrib/auth/models.py
> now = datetime.datetime.now()
> 
> No datetime?? But the module imports the datetime module at the top.  This
> is django code and I made no changes to the code.
> 
> So I added the following just for testing (just in case I had re-defined
> datetime):
> try:
>   now = datetime.datetime.now()
>   except:
>   import datetime
>   now = datetime.datetime.now()
> 
> But now in the same module I get a new error:
> 
> TypeError: 'NoneType' object is not callable for
> salt = get_hexdigest(algo, str(random.random()), str(random.random()))[:5]
> 
> This is crazy!  I can not understand what has happened!
> 
> I'm hoping someone understands this better than I do!
> 
> Just running
> python manage.py runserver
> I get a 500.
> 
> I'm on openSUSE 11.3, python 2.6.5, django 1.2.3 (was on 1.2.1).  I really
> need help!
> 
> Johnf

I'm guessing but could this have something to do with my imports?
from django.shortcuts import render_to_response, get_object_or_404
from django.http import Http404, HttpResponseRedirect, HttpResponse
from django.db import connection, transaction
from django.contrib.auth.models import User
from pesweb.esclient.models import Client, CellCarrier, CCTransactions
from pesweb.course.models import Course
import random
import datetime
import time
import json
import cc
import pycurl

Johnf

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



get id to be used in a foreign key with two model forms

2010-12-22 Thread Michael Thamm
Hi,
I am using 2 model forms and when I save the I get a save error since
the foreign key field can't be blank.
I try to add the new id at save, but it doesn't work.
This is the code for the save.

temp=shirtForm.save(commit=False)
userForm.shirt=temp.id
userForm.save()


Is the newly created record id store in the field temp.id and can I
assign that value directly as I am doing?

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



Subdomain/Accounts

2010-12-22 Thread Parra
Hello,

I'm new to Django and thinking of using it for a project.

In this project, there will be accounts and each account will have a
subdomain.
Based on the subdomain/account, the user will just see the records
that belongs to them.
The tables will be unique for all accounts, so there should be a field
to identify the account/records

I think this is maybe a common task and that there is a "right" way to
do this...

Can someone give me some tips on where to get started with this ??

Thanks,

Marcello

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



[ANN] Security releases and Django 1.3 beta 1

2010-12-22 Thread James Bennett
Tonight we've released Django 1.3 beta 1, as well as Django 1.2.4 and
Django 1.1.3 to correct a pair of security issues.

* Beta announcement: http://www.djangoproject.com/weblog/2010/dec/22/13-beta-1/

* Security announcement:
http://www.djangoproject.com/weblog/2010/dec/22/security/

All affected users are urged to upgrade immediately.


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

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



Project management / bugtracking app?

2010-12-22 Thread Dopster
Hi any recommendations for a Django project management and bugtracking 
application? Also, Git(hub) integration would be a nice-to-have.

I looked at Redmine but its a Ruby app and I'd rather not venture there. How 
about Trac?  

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



Re: django/contrib/auth/models.py goes nuts

2010-12-22 Thread John Fabiani
On Wednesday, December 22, 2010 07:18:15 pm John Fabiani wrote:
> On Wednesday, December 22, 2010 06:44:47 pm John Fabiani wrote:
> > Hi,
> > I had a working website for about the last 2 weeks.  I was using a test
> > database (Postgres).  I am also using SVN for my code and have tried to
> > revert back many versions and I still get these new errors.
> > 
> > The error first appeared as datetime has no Attribute 'None' for a line
> > in my views.py
> > user = User.objects.create_user(c.registration_id, c.email,
> > request.POST['txtPassword'])
> > 
> > The error was from in django/contrib/auth/models.py
> > now = datetime.datetime.now()
> > 
> > No datetime?? But the module imports the datetime module at the top. 
> > This is django code and I made no changes to the code.
> > 
> > So I added the following just for testing (just in case I had re-defined
> > datetime):
> > 
> > try:
> > now = datetime.datetime.now()
> > 
> > except:
> > import datetime
> > now = datetime.datetime.now()
> > 
> > But now in the same module I get a new error:
> > 
> > TypeError: 'NoneType' object is not callable for
> > salt = get_hexdigest(algo, str(random.random()),
> > str(random.random()))[:5]
> > 
> > This is crazy!  I can not understand what has happened!
> > 
> > I'm hoping someone understands this better than I do!
> > 
> > Just running
> > python manage.py runserver
> > I get a 500.
> > 
> > I'm on openSUSE 11.3, python 2.6.5, django 1.2.3 (was on 1.2.1).  I
> > really need help!
> > 
> > Johnf
> 
> I'm guessing but could this have something to do with my imports?
> from django.shortcuts import render_to_response, get_object_or_404
> from django.http import Http404, HttpResponseRedirect, HttpResponse
> from django.db import connection, transaction
> from django.contrib.auth.models import User
> from pesweb.esclient.models import Client, CellCarrier, CCTransactions
> from pesweb.course.models import Course
> import random
> import datetime
> import time
> import json
> import cc
> import pycurl
> 
> Johnf

I don't know - it's working again??
I did change the import TO
import datetime as MYDATETIME

I deleted the models.pyc file
I removed 
import random
import pycurl  
they were not being used.

I'm only changing a views.py file.

and
I rebooted.

None of the above code chages I believe would do  anything.  And remember this 
was running.

In my editor (Wing) there is a list of the modules being used.  I did see 
something that said 'datetime' but it was not the normal datetime.  It said 
something about the datetime fast lib.  I'm not sure what that is and I doubt 
it had anything to do with the server because I only saw it on my devel 
machine.  But I thought I should bring it up anyway.

This sucks big time.  I'm getting ready to deploy and now I'm worried I might 
have to reboot the server to get it working again.  Not cool!

Johnf

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



Re: fcgi, runfastcgi, parameters, docs [noob question]

2010-12-22 Thread Shamail Tayyab
You may want to try running your fastcgi daemon via command line,

This is the exact command that I am using at production:
python manage.py runfcgi daemonize=false method=threaded
host=127.0.0.1 port=9001

Tx

--
Shamail Tayyab
Blog: http://shamail.in/blog

On Dec 22, 6:52 pm, Richard Brosnahan  wrote:
> Hi all,
>
> I'm new to django but not new to Python. My goal is to build a web site using 
> django, replacing an old, tired php framework.
>
> The django 1.2.3 tutorials were fine. I got the basics of my site working 
> locally, after going thru the entire tutorial. Before going any further, I 
> wanted to see if I could get that same basic tutorial site going on my 1and1 
> host. If I can't, I may have to go with drupal.
>
> The django 1and1 site is a no go.
>
> I've installed my own Python 2.7.1, since the default version on 1and1 is 
> extremely old.
>
> 1and1 does provide fcgi, by default. Indeed, my .htaccess file and 
> mysite.fcgi work to a point. The script is using my version of python. The 
> .fcgi script runs until I get to the line where I try to execute runfastcgi.
>
> from django.core.servers.fastcgi import runfastcgi
> runfastcgi(method="threaded", daemonize="false")
>
> I'm using the docs provided with the svn version of django. In particular, 
> this page:
> file:///work/django-trunk/docs/_build/html/howto/deployment/fastcgi.html
>
> These docs are those issued with the version of django I'm using, and that's 
> up to date as of yesterday (via svn checkout).
>
> What's the problem?
>
> I get an error saying "method" is not defined, and "daemonize" is not 
> defined. Further, those parameters don't match the method in the source:
>
> fastcgi.py:89:
> def runfastcgi(argset=[], **kwargs):
>
> So, I'm trying to pass (method="threaded", daemonize="false") to a method 
> which expects (argset=[], **kwargs). No wonder it 'splodes.
>
> Can anyone direct me to a way to get this to work? What am I missing?
>
> Thanks in advance
>
> --
> Richard Brosnahan

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



default django admin theme

2010-12-22 Thread Jos? Moreira
Hello,

are there any plans to improve the default Django admin theme?
I'm aware of projects like Grapelli, that the admin is intended to be 
customized by the developers and that the default theme is nice, clean and 
usable but the default theme could be improved a lot, from my perspective.
I started thinking about this while i was browsing google analytics and the 
default django admin and i really like the analytics interface:

- nice clear background
- clear space around content and good black/white font contrasting
- consistent and minimal color palette
- menus on the right side which allow the content to expand indefinitely if 
required to the right

and so on ...

Of course this is all based on my personal opinion and also that:

- grappelli attaches a number of dependencies to the project, which may lock 
the project in regard to django and other libraries versions
- customizing the admin interface requires maintenance in regard of keeping 
track of changes brought by new django versions, which isn't that difficult 
it's one more thing a developer has to keep track of, especially for single 
developer's managing projects
- having an improved and slicker interface by default would improve the 
commercial aspect, a lot


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