SEE INDIAN SEXY VIEDO AND PICS

2007-10-11 Thread suri

SEE INDIAN SEXY VIEDO AND PICS



http://chromoo.blogspot.com/


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



Re: How to only show records that are less than 20 days old?

2007-10-11 Thread James Bennett

On 10/11/07, Greg <[EMAIL PROTECTED]> wrote:
> I have a model called Style that contains a DateField.  It stores the
> date when the record was created.  I want my template to only show
> Style records that were created less than 20 days ago.  I think that
> this needs to be done within the view, but not sure if there is a
> filter that I can use in the template.  Here is my model:

You want to use Python's 'timedelta' class to calculate a date 20 days
in the past:

http://docs.python.org/lib/datetime-timedelta.html

And then use the 'gt' field lookup, combined with the calculated "20
days ago" date, to do the query:

http://www.djangoproject.com/documentation/db-api/#gt

So something like this:

import datetime

def newarrivals(request):
cutoff_date = datetime.date.today() - datetime.timedelta(days=20)
s = Style.objects.filter(newstyles__gt=cutoff_date)
...etc...



-- 
"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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Newforms Field Limit Question

2007-10-11 Thread machineghost

You are absolutely right Joseph, it was a bug in my code :-(

I had:
forms.ChoiceField(choices=["Yes", "No"])
instead of:
forms.ChoiceField(choices=[("Yes", 1), ("No", 0)])

Thanks for the help.

Jeremy


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



How to only show records that are less than 20 days old?

2007-10-11 Thread Greg

Hello,
I have a model called Style that contains a DateField.  It stores the
date when the record was created.  I want my template to only show
Style records that were created less than 20 days ago.  I think that
this needs to be done within the view, but not sure if there is a
filter that I can use in the template.  Here is my model:

//

models.py

class Style(models.Model):
newstyles = models.DateField(auto_now_add=True)

//

views.py

def newarrivals(request):
s = Style.objects.filter(===Not sure what to do here===)
return render_to_response('newarrivals.htm', {'main': s})

///

Thanks for any help


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



Re: Integrate xmpppy with django

2007-10-11 Thread est

Thank you all, I will try a daemon :)

On Oct 11, 3:34 pm, Jarek Zgoda <[EMAIL PROTECTED]> wrote:
> This is the simplest (and for me - obvious) way of doing such things.
> I see 2 possiblities: either write it as a "long-running", traditional
> daemon (if you do not have your own XMPP server) or as Jabber/XMPP
> server component. The former is simpler, the later gives you more
> flexibility and seems more stable (only one point of failure).
> You can always ask assistance on PyXMPP mailing list if you have any
> questions, I am sure Jacek Konieczny will help you with Jabber/XMPP
> issues.
>
> On 10 Paź, 11:56, est <[EMAIL PROTECTED]> wrote:
>
>
>
> > Thank you Christoph.
>
> > Yes I have tried a independent daemon, but that's a bit complicated
> > for a small site. Is there a simipler way?
>
> > Simple is better.
>
> > On Oct 10, 5:23 pm, Christoph Rauch <[EMAIL PROTECTED]> wrote:
>
> > > est schrieb:> I am writing a GoogleTalk bot for my django site, but I 
> > > don't know
> > > > were to initiate a xmpppy Client object in Django. Should I put it in
> > > > my project's __init__.py ? I need the bot to be always online so where
> > > > can I write a GLOBAL, long survival object in Django? How can I make
>
> > > I wouldn't put it into __init__.py
>
> > > Not knowing xmpppy, this may or may not be simple:
>
> > > I would build a seperate daemon and send commands to it from inside
> > > your Django project. If you need the other way round, just import the
> > > required models in your xmpp client and put some logic there.
>
> > > That way you can just fire off commands to the daemon without having
> > > to worry about your connection. It's up to the daemon then.
>
> > > You can start the daemon completely separate of your webserver/Django
> > > project. Just make sure that Django can connect to the daemon, e.g.
> > > via unix domain sockets. Domain sockets are great, because you can
> > > restrict access to it with basic filesystem rights.
>
> > > Christoph- Hide quoted text -
>
> - Show quoted text -


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



template loading and generic views

2007-10-11 Thread Leo Shklovskii

I've got a question about the templates that the generic views load.

I have a app (named 'foo' in this example) that has its templates in a 
templates folder to work with 
django.template.loaders.app_directories.load_template_source.

so:
foo/templates/bar.html
foo/templates/bar_list.html

However, trying to use the generic view 
django.views.generic.list_detail.object_list and by default, it looks 
for a template named 'foo/bar_list.html' by default, but that doesn't 
exist. I can move the templates into:

foo/templates/foo/bar.html
foo/templates/foo/bar_list.html

But it seems a little silly to repeat 'foo' twice, and breaks being able 
to use just the template name 'bar.html' in other parts of django.
Alternatively I can specify the template name to object_list, but its so 
nice to pick convention over configuration :-)

Am I just setting up my project incorrectly? Or is there a better 
suggestion for how to deal with this situation?

--
--Leo

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



new fastcgi for iis

2007-10-11 Thread Robert

Dunno who's seen this, but fyi: MS IIS now has official FastCGI
support.  I look forward to seeing how this'll work with Django
installs under IIS.

http://www.iis.net/php

--rbt


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



Re: Stuck on generic relations

2007-10-11 Thread Doug B

Anwering my own question... it helps to specify an actual join
condition.

This worked:
extra['last_event_when'] = "SELECT event_loggedevent.when FROM
event_loggedevent,event_eventrelation WHERE
(event_eventrelation.event_id = event_loggedevent.id) AND
(event_eventrelation.content_type_id = %s) AND
(event_eventrelation.object_id = common_idxlead.id) ORDER BY
event_loggedevent.when DESC limit 1" % ct

... off to amazon to look for a decent sql book so I can avoid asking
silly questions in the future.


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



Re: Object not callable

2007-10-11 Thread Cat

Hi Jeremy

This is the definition

Thanks

Cat

class SurveyForm(forms.Form):

survey_name = forms.CharField(required = True)
associated_company = forms.ModelChoiceField(queryset =
Company.objects.all(), required = True)
operator = forms.ModelChoiceField(queryset = Operator.objects.all(),
required = False)
contractor = forms.ModelChoiceField(queryset =
Contractor.objects.all(), required = False)
vessel = forms.ModelChoiceField(queryset = Vessel.objects.all(),
required = False)
survey_type = forms.ModelChoiceField(queryset =
SurveyType.objects.all(), required = True)
location = forms.CharField(required = True)
start_date = forms.DateField(required = True)
end_date = forms.DateField(required = False)
notes = forms.CharField(widget = forms.Textarea(), required = False)

def __init__(self, data = None, auto_id = 'id_%s', prefix = None,
initial = None, instance = None):

if instance is not None:
self.instance = instance
data = instance_dict(instance)
else:
self.instance = None
super(SurveyForm, self).__init__(data = data, auto_id = auto_id,
prefix = prefix, initial = initial)

def save(self, commit = True):
if self.instance is not None:
instance = self.instance
else:
instance = Survey()

instance.survey_type = self.cleaned_data['survey_type']
instance.associated_company =
self.cleaned_data['associated_company']
instance.operator = self.cleaned_data['operator']
instance.contractor = self.cleaned_data['contractor']
instance.vessel = self.cleaned_data['vessel']
instance.survey_name = self.cleaned_data['survey_name']
instance.location = self.cleaned_data['location']
instance.start_date = self.cleaned_data['start_date']
instance.end_date = self.cleaned_data['end_date']

if commit:
instance.save()
return instance


On Oct 12, 11:48 am, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote:
> On 10/11/07, Cat <[EMAIL PROTECTED]> wrote:
>
> > Can anyone tell me why when I get to the line - form =
> > InstanceForm(request.POST) in the following view (stepping through the
> > code), I get a Type Error SurveyForm object is not callable. My
> > understanding is that it should be as it subclasses Form
>
> What is the definition of SurveyForm?


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



Re: Object not callable

2007-10-11 Thread Jeremy Dunck

On 10/11/07, Cat <[EMAIL PROTECTED]> wrote:
> Can anyone tell me why when I get to the line - form =
> InstanceForm(request.POST) in the following view (stepping through the
> code), I get a Type Error SurveyForm object is not callable. My
> understanding is that it should be as it subclasses Form

What is the definition of SurveyForm?

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



Object not callable

2007-10-11 Thread Cat

Hello

Can anyone tell me why when I get to the line - form =
InstanceForm(request.POST) in the following view (stepping through the
code), I get a Type Error SurveyForm object is not callable. My
understanding is that it should be as it subclasses Form

def addEditSurvey(request, id = None):

if id is not None:
instance = Survey.objects.get(id=id)
InstanceForm = SurveyForm(instance = instance)
else:
InstanceForm = SurveyForm()

if request.method == 'POST':
form = InstanceForm(request.POST)
if form.is_valid():
form.save()
return HttpResponseRedirect("/event/survey/list")

return render_to_response('add_edit_survey.html', {'form':
InstanceForm})

Thanks in advance for any guidance on this

Cat


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



Re: generic views

2007-10-11 Thread Marty Alchin

On 10/11/07, jake elliott <[EMAIL PROTECTED]> wrote:
>
> Marty Alchin wrote:
> > You'd replace "what goes here" with what you put in
> > "template_object_name": "author" (only without the quotes). Of course,
> > it'd be a little more readable if you use the plural "authors", since
> > you're getting a list of more than one author.
>
> actually you'll use "author_list" here - list_detail.object_list appends
> "_list" to the value set for "template_object_name"

Ah, so it does. Thanks for catching that.

-Gul

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



Re: pagination documentation unclear

2007-10-11 Thread Steve Potter

On Oct 11, 5:43 pm, johnny <[EMAIL PROTECTED]> wrote:
> I was going over documentation on pagination and it mentions you can
> do it in two ways as follows:
>
> URL... ?page=x
> or
> (r'^objects/page(?P[0-9]+)/$', 'object_list', dict(info_dict))
>
> My question is, you would use
>
> "URL... ?page=x" for regular views?
>
> "(r'^objects/page(?P[0-9]+)/$', 'object_list', dict(info_dict))"
> for generic views?
>
> object_list is the function in django.views.generic.list_detail ?
>
> What is dict(info_dict) do?
>
> what is objects in "(r'^objects/page(?P[0-9]+)/$'", model name?

Johnny,

This example is just trying to demonstrate that you can either
paginate urls by using http://www.example.com/somepage/?page=2, or you
can use something like http://www.example.com/somepage/2/ neither one
is restricted to custom or generic views it is all about how you
configure your urls.py.

Steve


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



Stuck on generic relations

2007-10-11 Thread Doug B

I have a page that needs to display basic user information plus the
last logged activity date for the user, and I need to be able to sort
by that value. (there are two of these relations,I'm just mentioning
one here)  My SQL-fu is very, very weak and I just can't seem to get
it.

There is a table in the middle that is kind of like a many to many,
but with a generic foreign key on one side, EventRelation.  That has
the content_type and object_id values for user, and a normal
foreignkey into the LoggedEvent model that has the field I need.

class LoggedEvent(models.Model):
 when = models.DateTimeField()
 summary = models.CharField(maxlength=255,null=True)
 

class EventRelation(models.Model):
event = models.ForeignKey('LoggedEvent')
objects=generic_relations.GenericManager()
content_type = models.ForeignKey(ContentType,null=True,blank=True)
object_id = models.PositiveIntegerField(null=True,blank=True)
obj = models.GenericForeignKey()

I've tried using extra, but what I thought might work just grabs the
latest event by any user, not the latest event per user (idxlead
model).  If I could apply that select to each user, that is exactly
what I think I'm looking for:

extra['last_event_when'] = "SELECT event_loggedevent.when FROM
event_loggedevent,event_eventrelation WHERE
((event_eventrelation.object_id = common_idxlead.id) AND
(event_eventrelation.content_type_id = %s)) ORDER BY
event_loggedevent.when DESC limit 1" % ct

ct is the contenttype pk for the idxlead model.

There are quite a few users (25,000), and a lot more events.  I
thought about adding a field on the user model and updating that on
each event, but I was worried about an extra write on almost every
request.  I'd appreciate any suggestions.


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



Re: What's going on with Row Level Permissions?

2007-10-11 Thread Joseph Kocherhans

On 10/11/07, arv43 <[EMAIL PROTECTED]> wrote:
>
> Does anyone know how and if Generic Authorization and RLP are going to
> fit together? It says on the RLP page to look at Generic Authorization
> to know how they do, but I am not sure how they do. Maybe am missing
> something.
> Are they both going to be rolled into the trunk sometime? or is it one
> vs the other?

(Note, I am the author of the Generic Authorization branch.)

The merging was never completed, and has pretty much been put on hold
until the newforms-admin branch is merged to trunk. newforms-admin
makes it all a lot cleaner and easier. I expect to revisit
generic-auth sometime next year. I'm not sure that it will ever make
it into django though. The newforms-admin branch fills a lot of the
needs that generic-auth was trying to solve. It may end up as a 3rd
party add-on at some point.

Joseph

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



Re: What's going on with Row Level Permissions?

2007-10-11 Thread arv43

Does anyone know how and if Generic Authorization and RLP are going to
fit together? It says on the RLP page to look at Generic Authorization
to know how they do, but I am not sure how they do. Maybe am missing
something.
Are they both going to be rolled into the trunk sometime? or is it one
vs the other?

Thanks
Arvind


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



Accessing many-to-many relations in save()

2007-10-11 Thread Adam Endicott

I've got an app where I'd like to set some properties in an object's
save method based on ManyToMany relationships. I now realize that this
doesn't work (at least through the Django admin), because the
AddManipulator saves the object, and then saves the m2m relations
afterwards. Basically this is the same issue as [1].

I'm wondering if Malcolm's reply in that thread is still the case
(that a workaround would mean a custom manipulator), or if anyone else
has other ideas. If a custom manipulator is my best bet, how would I
do that? It seems like I would be trying to replace the automatic
AddManipulator with my own and just do extra stuff in the
manipulator's save() method, but how do I spell that?

Oh, it would probably help to mention that I'm on 0.96. Not sure if
newforms-admin would help here or not, but either way it's not really
relevant to me right now.

[1] 
http://groups.google.com/group/django-users/browse_thread/thread/99680b69d2d4799c/07093d3695163269

Thanks,
Adam


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



Re: IProblem with registration Form!

2007-10-11 Thread Prateek Parekh

I was able to solve the problem. The code was truncating the field in
Graduation year if it contained spaces. A little validation would fix
the error.

On Oct 11, 3:25 pm, Prateek Parekh <[EMAIL PROTECTED]> wrote:
> Apologies. I forgot to include the relevant views.py code
>
> if len(request.POST.get('team', '')) > 0:
> # there must be a team name to bother with this...
> t = Team(name=request.POST['team'])
> t.save()
> for i in range(int(request.POST['tmcount'])):
> # make sure there's a first and last name...
> if len(request.POST.get('tmfname%s' % i,
> '').strip()) == 0 or len(request.POST.get('tmlname%s' % i,
> '').strip()) == 0:
> continue
> mem = TeamMember(
> team = t,
> first_name = request.POST.get('tmfname
> %s' % i, ''),
> last_name = request.POST.get('tmlname
> %s' % i, ''),
> email = request.POST.get('tmemail%s' %
> i, ''),
> entsoc = request.POST.get('tmesoc%s' %
> i, '') == 'on',
> grad_date = request.POST.get('tmgrad
> %s' % i, '')
> )
> t.save()
> t.teammember_set.add(mem)
> t.registration_set.add(reg)
>
> Thanks again.
>
> On Oct 11, 2:56 pm, Prateek Parekh <[EMAIL PROTECTED]> wrote:
>
> > Hello Everyone,
> > I was working on a code created by someone else using the django
> > framework. It is a registration form posted 
> > at:http://apps.cob.sjsu.edu/svce/svnif/registration/
> > And, it recently went online. However, i started receiving complaints
> > from students that it doesn't work.
> > After some debugging i came to realize that it gives an error message
> > only if the "Team name" field is entered. Otherwise, it runs fine.
> > Also, i know, i can change the Debug option in settings.py to avoid
> > displaying the error log.
> > Here is the relevant code in the models.py file
>
> > class Team(models.Model):
> > name = models.CharField(maxlength=255)
> > def __str__(self):
> > return self.name
> > class Admin:
> > pass
>
> > class TeamMember(models.Model):
> > team = models.ForeignKey(Team)
> > first_name = models.CharField(maxlength=255)
> > last_name = models.CharField(maxlength=255)
> > email = models.EmailField()
> > entsoc = models.BooleanField("Member of Entrepreneurial
> > Society", default=False)
> > grad_date = models.IntegerField("Expected graduation date",
> > blank=True, null=True)
> > def __str__(self):
> > return "%s, %s" % (self.last_name, self.first_name)
> > class Admin:
> > pass
>
> > Any help would be greatly appreciated.
>
> > Thanks,
> > Prateek


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



pagination documentation unclear

2007-10-11 Thread johnny

I was going over documentation on pagination and it mentions you can
do it in two ways as follows:

URL... ?page=x
or
(r'^objects/page(?P[0-9]+)/$', 'object_list', dict(info_dict))

My question is, you would use

"URL... ?page=x" for regular views?

"(r'^objects/page(?P[0-9]+)/$', 'object_list', dict(info_dict))"
for generic views?

object_list is the function in django.views.generic.list_detail ?

What is dict(info_dict) do?

what is objects in "(r'^objects/page(?P[0-9]+)/$'", model name?


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



Contractual Django Developer Position

2007-10-11 Thread Adam Jenkins
The Institute of Design of Chicago, IL is seeking an experienced Django
developer to create an in-house contact and mailing web application. The
application manages the contacts for the different conferences and events at
the Institute of Design.

The ideal candidate has experience with at least one completed Django
application, the more the better. Good communication is required as the
applicant will also be involved with design of the application.

Pay is negotiable. This is a contractual position. Local applicants only.
Applicant must be able to attend meetings at the Institute of Design 350 N.
La Salle St. Chicago, IL 60610

please contact [EMAIL PROTECTED] and [EMAIL PROTECTED] if interested.


-- 
---
Adam Jenkins
[EMAIL PROTECTED]
312-595-2216
---

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



Re: IProblem with registration Form!

2007-10-11 Thread Prateek Parekh

Apologies. I forgot to include the relevant views.py code

if len(request.POST.get('team', '')) > 0:
# there must be a team name to bother with this...
t = Team(name=request.POST['team'])
t.save()
for i in range(int(request.POST['tmcount'])):
# make sure there's a first and last name...
if len(request.POST.get('tmfname%s' % i,
'').strip()) == 0 or len(request.POST.get('tmlname%s' % i,
'').strip()) == 0:
continue
mem = TeamMember(
team = t,
first_name = request.POST.get('tmfname
%s' % i, ''),
last_name = request.POST.get('tmlname
%s' % i, ''),
email = request.POST.get('tmemail%s' %
i, ''),
entsoc = request.POST.get('tmesoc%s' %
i, '') == 'on',
grad_date = request.POST.get('tmgrad
%s' % i, '')
)
t.save()
t.teammember_set.add(mem)
t.registration_set.add(reg)

Thanks again.

On Oct 11, 2:56 pm, Prateek Parekh <[EMAIL PROTECTED]> wrote:
> Hello Everyone,
> I was working on a code created by someone else using the django
> framework. It is a registration form posted 
> at:http://apps.cob.sjsu.edu/svce/svnif/registration/
> And, it recently went online. However, i started receiving complaints
> from students that it doesn't work.
> After some debugging i came to realize that it gives an error message
> only if the "Team name" field is entered. Otherwise, it runs fine.
> Also, i know, i can change the Debug option in settings.py to avoid
> displaying the error log.
> Here is the relevant code in the models.py file
>
> class Team(models.Model):
> name = models.CharField(maxlength=255)
> def __str__(self):
> return self.name
> class Admin:
> pass
>
> class TeamMember(models.Model):
> team = models.ForeignKey(Team)
> first_name = models.CharField(maxlength=255)
> last_name = models.CharField(maxlength=255)
> email = models.EmailField()
> entsoc = models.BooleanField("Member of Entrepreneurial
> Society", default=False)
> grad_date = models.IntegerField("Expected graduation date",
> blank=True, null=True)
> def __str__(self):
> return "%s, %s" % (self.last_name, self.first_name)
> class Admin:
> pass
>
> Any help would be greatly appreciated.
>
> Thanks,
> Prateek


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



Re: generic views

2007-10-11 Thread Gigs_

yes i figure out that after marty replay

On Oct 11, 10:01 pm, jake elliott <[EMAIL PROTECTED]> wrote:
> Marty Alchin wrote:
> > You'd replace "what goes here" with what you put in
> > "template_object_name": "author" (only without the quotes). Of course,
> > it'd be a little more readable if you use the plural "authors", since
> > you're getting a list of more than one author.
>
> actually you'll use "author_list" here - list_detail.object_list appends
> "_list" to the value set for "template_object_name"
>
> best
> jake


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



IProblem with registration Form!

2007-10-11 Thread Prateek Parekh

Hello Everyone,
I was working on a code created by someone else using the django
framework. It is a registration form posted at:
http://apps.cob.sjsu.edu/svce/svnif/registration/
And, it recently went online. However, i started receiving complaints
from students that it doesn't work.
After some debugging i came to realize that it gives an error message
only if the "Team name" field is entered. Otherwise, it runs fine.
Also, i know, i can change the Debug option in settings.py to avoid
displaying the error log.
Here is the relevant code in the models.py file

class Team(models.Model):
name = models.CharField(maxlength=255)
def __str__(self):
return self.name
class Admin:
pass

class TeamMember(models.Model):
team = models.ForeignKey(Team)
first_name = models.CharField(maxlength=255)
last_name = models.CharField(maxlength=255)
email = models.EmailField()
entsoc = models.BooleanField("Member of Entrepreneurial
Society", default=False)
grad_date = models.IntegerField("Expected graduation date",
blank=True, null=True)
def __str__(self):
return "%s, %s" % (self.last_name, self.first_name)
class Admin:
pass

Any help would be greatly appreciated.

Thanks,
Prateek


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



Re: Label and input Filed overlap

2007-10-11 Thread Phil Davis

On 11/10/2007, Nader <[EMAIL PROTECTED]> wrote:
>
> I suppose that I can copy the system 'forms.css' file to local
> directory (my own project directory) and change the parameter with
> which the distance will be adjusted.
> Could you tell me which parameter do I have to change?

Just look for "width:" and backtrack a bit to see if it applies to a label.

A really wonderful way to answer CSS questions like this is to use
Firefox and install Firebug. You can then display any page and use the
Inspect button in Firebug to tell you which CSS value came from which
CSS style line and even change it in the browser to test out what
effect any change would have.

http://www.getfirebug.com/

Cheers,

-- 
Phil Davis

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



Re: deseb installation in ubuntu

2007-10-11 Thread Derek Anderson

your previous bug was a standard import issue unrelated to deseb. 
however this looks like it may be a real one.  let me look into it.

derek



Xan wrote:
> 
> 
> On Oct 11, 5:13 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
> wrote:
>> On Thu, 2007-10-11 at 07:21 -0700, Xan wrote:
>>
>> [...]
>>
>>> Perhaps I have to read python doc, but my intention is only follow
>>> deseb/django documentation. If normal user have to read python doc,
>>> then django became not simple, I think
>> Django is a framework for *Python programmers*. You do need to have some
>> understanding of Python in order to be able to diagnose anything but the
>> most trivial problems. It would be redundant for us to repeat
>> information that is already in the Python documentation, so if your
>> expectations are that you will never have to read anything beyond
>> Django's documentation, then you are going to find things fairly
>> difficult.
>>
>> Even if the required knowledge is only how import paths work and how to
>> configure them, you need to do some background work here. We aren't
>> going to cover a lot of that information in Django's documentation
>> because it is so fundamental to the way Python works that it is covered
>> in the standard docs already.
>>
>> The concept of a "normal user" is fairly nebulous, since that could mean
>> somebody developing with Django or just using a Django application (an
>> installer -- the role you are playing -- would not typically be the
>> normal target audience for something like this). Unless you are
>> installing pre-packaged versions of everything (which you aren't), you
>> at least need to have a sys-admin's understanding of Python (which means
>> knowing about standard import paths, etc) to get things working.
>>
>> I'm also a bit concerned about what you expect to happen at the end of
>> this project. Something like deseb is *only* useful if you are
>> developing with Django, and only in semi-advanced situations. Which
>> means writing Python code. It's not really a tool for somebody just
>> starting out.
> 
> I don't want to discuss for discuss, but I'm not in agreement with you
> with this last paragraph. deseb is useful for database evolution (for
> example for adding models to modeles file), that I think it's very
> frequent request for normal users, not only developers.
> 
> For this reason is for that I want to install deseb. For migrate my
> database more easyly
> 
> For the other hand, how do you know that my error using deseb is path
> python error?. After I put "import deseb" in settings.py and run
> "python manage sqlevolve analisi" I get the following error:
> 
>  python manage.py sqlevolve analisi
> BEGIN;
> Traceback (most recent call last):
>   File "manage.py", line 11, in 
> execute_manager(settings)
>   File "/var/lib/python-support/python2.5/django/core/management.py",
> line 1672, in execute_manager
> execute_from_command_line(action_mapping, argv)
>   File "/usr/lib/python2.5/site-packages/deseb/__init__.py", line 90,
> in inner
> return func(*args, **kwargs)
>   File "/var/lib/python-support/python2.5/django/core/management.py",
> line 1632, in execute_from_command_line
> output = action_mapping[action](mod)
>   File "/usr/lib/python2.5/site-packages/deseb/__init__.py", line 83,
> in inner
> return schema_evolution.get_sql_evolution_v0_96(*args, **kwargs)
>   File "/usr/lib/python2.5/site-packages/deseb/schema_evolution.py",
> line 242, in get_sql_evolution_v0_96
> return get_sql_evolution(app, management.style)
>   File "/usr/lib/python2.5/site-packages/deseb/schema_evolution.py",
> line 248, in get_sql_evolution
> return get_sql_evolution_detailed(app, style)[2]
>   File "/usr/lib/python2.5/site-packages/deseb/schema_evolution.py",
> line 334, in get_sql_evolution_detailed
> sql, references = _get_sql_model_create(model, seen_models, style)
>   File "/usr/lib/python2.5/site-packages/deseb/schema_evolution.py",
> line 413, in _get_sql_model_create
>  
> style.SQL_FIELD(ops.quote_name(f.rel.to._meta.get_field(f.rel.field_name).column))
> + ')' #+
> AttributeError: DatabaseOperations instance has no attribute
> 'quote_name'
> 
> 
> If you see, it appears that deseb is starting (BEGIN line). So, the
> path seems to be good (at least it detects deseb). Isn't ?
> How can I know if it's path problem or another thing?
> 
> Thanks in advance, and sorry for long thread but I'm newbee user (yes,
> django users include newbees ;-))
> Xan.
> 
> PS: My export command output is:
> 
> export
> declare -x COLORTERM="Terminal"
> declare -x DBUS_SESSION_BUS_ADDRESS="unix:abstract=/tmp/dbus-
> xp4BcYOtii,guid=915223fcae6fa13470f8cc00470e66b6"
> declare -x DESKTOP_SESSION="xfce4"
> declare -x DISPLAY=":0.0"
> declare -x GDMSESSION="xfce4"
> declare -x GDM_XSERVER_LOCATION="local"
> declare -x GNOME_KEYRING_SOCKET="/tmp/keyring-oidSB3/socket"
> declare -x HISTCONTROL="ignoredups"
> declare -x HOME="/home/xan"
> declare -x LANG="[EMAIL PROTECTED]"
> 

Re: generic views

2007-10-11 Thread jake elliott

Marty Alchin wrote:
> You'd replace "what goes here" with what you put in
> "template_object_name": "author" (only without the quotes). Of course,
> it'd be a little more readable if you use the plural "authors", since
> you're getting a list of more than one author.

actually you'll use "author_list" here - list_detail.object_list appends
"_list" to the value set for "template_object_name"

best
jake

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



Re: deseb installation in ubuntu

2007-10-11 Thread Xan



On Oct 11, 5:13 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Thu, 2007-10-11 at 07:21 -0700, Xan wrote:
>
> [...]
>
> > Perhaps I have to read python doc, but my intention is only follow
> > deseb/django documentation. If normal user have to read python doc,
> > then django became not simple, I think
>
> Django is a framework for *Python programmers*. You do need to have some
> understanding of Python in order to be able to diagnose anything but the
> most trivial problems. It would be redundant for us to repeat
> information that is already in the Python documentation, so if your
> expectations are that you will never have to read anything beyond
> Django's documentation, then you are going to find things fairly
> difficult.
>
> Even if the required knowledge is only how import paths work and how to
> configure them, you need to do some background work here. We aren't
> going to cover a lot of that information in Django's documentation
> because it is so fundamental to the way Python works that it is covered
> in the standard docs already.
>
> The concept of a "normal user" is fairly nebulous, since that could mean
> somebody developing with Django or just using a Django application (an
> installer -- the role you are playing -- would not typically be the
> normal target audience for something like this). Unless you are
> installing pre-packaged versions of everything (which you aren't), you
> at least need to have a sys-admin's understanding of Python (which means
> knowing about standard import paths, etc) to get things working.
>
> I'm also a bit concerned about what you expect to happen at the end of
> this project. Something like deseb is *only* useful if you are
> developing with Django, and only in semi-advanced situations. Which
> means writing Python code. It's not really a tool for somebody just
> starting out.

I don't want to discuss for discuss, but I'm not in agreement with you
with this last paragraph. deseb is useful for database evolution (for
example for adding models to modeles file), that I think it's very
frequent request for normal users, not only developers.

For this reason is for that I want to install deseb. For migrate my
database more easyly

For the other hand, how do you know that my error using deseb is path
python error?. After I put "import deseb" in settings.py and run
"python manage sqlevolve analisi" I get the following error:

 python manage.py sqlevolve analisi
BEGIN;
Traceback (most recent call last):
  File "manage.py", line 11, in 
execute_manager(settings)
  File "/var/lib/python-support/python2.5/django/core/management.py",
line 1672, in execute_manager
execute_from_command_line(action_mapping, argv)
  File "/usr/lib/python2.5/site-packages/deseb/__init__.py", line 90,
in inner
return func(*args, **kwargs)
  File "/var/lib/python-support/python2.5/django/core/management.py",
line 1632, in execute_from_command_line
output = action_mapping[action](mod)
  File "/usr/lib/python2.5/site-packages/deseb/__init__.py", line 83,
in inner
return schema_evolution.get_sql_evolution_v0_96(*args, **kwargs)
  File "/usr/lib/python2.5/site-packages/deseb/schema_evolution.py",
line 242, in get_sql_evolution_v0_96
return get_sql_evolution(app, management.style)
  File "/usr/lib/python2.5/site-packages/deseb/schema_evolution.py",
line 248, in get_sql_evolution
return get_sql_evolution_detailed(app, style)[2]
  File "/usr/lib/python2.5/site-packages/deseb/schema_evolution.py",
line 334, in get_sql_evolution_detailed
sql, references = _get_sql_model_create(model, seen_models, style)
  File "/usr/lib/python2.5/site-packages/deseb/schema_evolution.py",
line 413, in _get_sql_model_create
 
style.SQL_FIELD(ops.quote_name(f.rel.to._meta.get_field(f.rel.field_name).column))
+ ')' #+
AttributeError: DatabaseOperations instance has no attribute
'quote_name'


If you see, it appears that deseb is starting (BEGIN line). So, the
path seems to be good (at least it detects deseb). Isn't ?
How can I know if it's path problem or another thing?

Thanks in advance, and sorry for long thread but I'm newbee user (yes,
django users include newbees ;-))
Xan.

PS: My export command output is:

export
declare -x COLORTERM="Terminal"
declare -x DBUS_SESSION_BUS_ADDRESS="unix:abstract=/tmp/dbus-
xp4BcYOtii,guid=915223fcae6fa13470f8cc00470e66b6"
declare -x DESKTOP_SESSION="xfce4"
declare -x DISPLAY=":0.0"
declare -x GDMSESSION="xfce4"
declare -x GDM_XSERVER_LOCATION="local"
declare -x GNOME_KEYRING_SOCKET="/tmp/keyring-oidSB3/socket"
declare -x HISTCONTROL="ignoredups"
declare -x HOME="/home/xan"
declare -x LANG="[EMAIL PROTECTED]"
declare -x LANGUAGE="[EMAIL PROTECTED]"
declare -x LESSCLOSE="/usr/bin/lesspipe %s %s"
declare -x LESSOPEN="| /usr/bin/lesspipe %s"
declare -x LOGNAME="xan"
declare -x

Re: generic views

2007-10-11 Thread Gigs_

yes i know. this is just for learning.

thanks

On Oct 11, 8:06 pm, "Marty Alchin" <[EMAIL PROTECTED]> wrote:
> You'd replace "what goes here" with what you put in
> "template_object_name": "author" (only without the quotes). Of course,
> it'd be a little more readable if you use the plural "authors", since
> you're getting a list of more than one author.
>
> -Gul


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



Re: generic views

2007-10-11 Thread Marty Alchin

You'd replace "what goes here" with what you put in
"template_object_name": "author" (only without the quotes). Of course,
it'd be a little more readable if you use the plural "authors", since
you're getting a list of more than one author.

-Gul

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



Re: development server,wmv

2007-10-11 Thread [EMAIL PROTECTED]

hm avi launches the media player, wmv comes back text

On Oct 11, 12:30 pm, aabele <[EMAIL PROTECTED]> wrote:
> Incorrect header. Try to change mimetype.
>
> On Oct 11, 6:46 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
>
>
> > i am  at a rudimentary level.  i have the development server properly
> > serving image files. when i tried to serve a wmv file, i got the text
> > data back.  am i missing a step?- Hide quoted text -
>
> - Show quoted text -


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



Re: generic views

2007-10-11 Thread Gigs_

and here is urls from myapp

from django.conf.urls.defaults import *
from django.views.generic import list_detail, date_based,
create_update
from books.models import Publisher, Author, Book

author_list_info = {
'queryset':Author.objects.all(),
"template_object_name" : "author",
"extra_context":{'name':'john', 'lname':'doe'}
}


urlpatterns = patterns('',
# we'll add URL patterns here
(r'author_list.html$', list_detail.object_list, author_list_info),
)




On Oct 11, 7:49 pm, Gigs_ <[EMAIL PROTECTED]> wrote:
> so if this is my template for that list
> 
> 
>
> my template
>
> 
> 
> my books app
> 
> {% for name in "what goes here" %}
> {{ name }}
> {% endfor %}
> 
>
> On Oct 11, 7:47 pm, Gigs_ <[EMAIL PROTECTED]> wrote:
>
> > so i cant get list from models?
> > from Author.objects.all()
>
> > On Oct 11, 4:03 pm, Alex Koshelev <[EMAIL PROTECTED]> wrote:
>
> > > the list you want to use in template must be in template context. use
> > > "extra_context" value
>
> > > On 11 окт, 17:31, Gigs_ <[EMAIL PROTECTED]> wrote:
>
> > > > hi all
>
> > > > im learning django with djangobook.com
> > > > im stuck in chapter 9 at Lists of objects.
> > > > i just cant get any list of objects in my template.
>
> > > > what should i put in template to make this work?
>
> > > > thanks!


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



Re: generic views

2007-10-11 Thread Gigs_

so if this is my template for that list



my template



my books app

{% for name in "what goes here" %}
{{ name }}
{% endfor %}



On Oct 11, 7:47 pm, Gigs_ <[EMAIL PROTECTED]> wrote:
> so i cant get list from models?
> from Author.objects.all()
>
> On Oct 11, 4:03 pm, Alex Koshelev <[EMAIL PROTECTED]> wrote:
>
> > the list you want to use in template must be in template context. use
> > "extra_context" value
>
> > On 11 окт, 17:31, Gigs_ <[EMAIL PROTECTED]> wrote:
>
> > > hi all
>
> > > im learning django with djangobook.com
> > > im stuck in chapter 9 at Lists of objects.
> > > i just cant get any list of objects in my template.
>
> > > what should i put in template to make this work?
>
> > > thanks!


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



Re: How to delete an image off the file system?

2007-10-11 Thread Joshua Simpson



On Oct 11, 8:34 am, Greg <[EMAIL PROTECTED]> wrote:
> Hello,
> I have a function 'thesignal' that deletes the Photo record from a db
> table.  However, after that is done the photo's still appear on the
> file system.  How do i delete these photos?  Here is what I have so
> far:
>
You'll have to derive the delete() method, and add an os.remove/
unlink() call in there, based upon the path stored in the row (as well
as calling the parent method)


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



Re: development server,wmv

2007-10-11 Thread aabele

Incorrect header. Try to change mimetype.

On Oct 11, 6:46 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> i am  at a rudimentary level.  i have the development server properly
> serving image files. when i tried to serve a wmv file, i got the text
> data back.  am i missing a step?


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



How to delete an image off the file system?

2007-10-11 Thread Greg

Hello,
I have a function 'thesignal' that deletes the Photo record from a db
table.  However, after that is done the photo's still appear on the
file system.  How do i delete these photos?  Here is what I have so
far:

///

models.py

class Photo(models.Model):
photo = models.ImageField(upload_to="site_media/thumbnails/")
thumbnail = models.ImageField(upload_to="site_media/thumbnails/",
editable=False)
thumbnail2 = models.ImageField(upload_to="site_media/thumbnails/",
editable=False)

/

sig.py

def thesignal(sender, instance, signal, *args, **kwargs):
from mysite.plush.models import Photo
a = Photo.objects.get(id=instance.image.id)
a.delete()



I assume I need to add some code to my 'thesignal' function


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



Re: Signals error - I can't do a import

2007-10-11 Thread RajeshD

Perhaps try the import this way:

//

sig.py

def thesignal(sender, instance, signal, *args, **kwargs):
 from mysite.plush.models import Photo
assert False, "It got here"


//



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



Re: Using Django's builtin documentation

2007-10-11 Thread Jeremy Dunck

On 10/11/07, James Bennett <[EMAIL PROTECTED]> wrote:
>
> On 10/11/07, Rufman <[EMAIL PROTECTED]> wrote:
> > Django uses docutils and restructured text for the documentation of
> > the admin. How can i get my own documentation of my views and models
> > (restructured text) to show on the documentation page in the django
> > admin (dashboard -> documentation)?
>
> It's generated from the docstrings, so if you're following good Python
> practice of writing docstrings in your code you'll see them show up in
> the admin as documentation.

...Except that attributes are lost when functions are decorated.  :)

What a handy example for the patch here:
http://code.djangoproject.com/ticket/5701

:)

N.B. There is some doubt that the included patch will be included in
Django due to provenance issues with the copied functools code.  There
is a current thread on django-dev regarding this.

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



Re: deseb installation in ubuntu

2007-10-11 Thread Malcolm Tredinnick

On Thu, 2007-10-11 at 07:21 -0700, Xan wrote:
[...]
> Perhaps I have to read python doc, but my intention is only follow
> deseb/django documentation. If normal user have to read python doc,
> then django became not simple, I think

Django is a framework for *Python programmers*. You do need to have some
understanding of Python in order to be able to diagnose anything but the
most trivial problems. It would be redundant for us to repeat
information that is already in the Python documentation, so if your
expectations are that you will never have to read anything beyond
Django's documentation, then you are going to find things fairly
difficult.

Even if the required knowledge is only how import paths work and how to
configure them, you need to do some background work here. We aren't
going to cover a lot of that information in Django's documentation
because it is so fundamental to the way Python works that it is covered
in the standard docs already.

The concept of a "normal user" is fairly nebulous, since that could mean
somebody developing with Django or just using a Django application (an
installer -- the role you are playing -- would not typically be the
normal target audience for something like this). Unless you are
installing pre-packaged versions of everything (which you aren't), you
at least need to have a sys-admin's understanding of Python (which means
knowing about standard import paths, etc) to get things working.

I'm also a bit concerned about what you expect to happen at the end of
this project. Something like deseb is *only* useful if you are
developing with Django, and only in semi-advanced situations. Which
means writing Python code. It's not really a tool for somebody just
starting out.

Regards,
Malcolm



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



Switching between databases with same project/model

2007-10-11 Thread [EMAIL PROTECTED]

We are in the process of moving an existing webapp/database to
django.  One of the features of our existing setup is the ability to
have a command line tool post data from a remote client to a
production version of our database for all to see or post to a test
database for personal/informal consumption.

We're planning on starting with 0.96 django and I'm looking for a
workaround to the one DB per project design.

The command line tool for submitting data to the DB is using the
django model and api.  To match our previous design we would need
multiple databases with the same schema with just different database
names.

Now my question.  Is there an easy way to change the database settings
dynamically?  Ideally I'd like to parse the url and call a view
function with the appropriate database settings.  This would allow us
to host one webapp for both DB's.

I'd also like our command line tool to grab the DB name from the args
and pass it to the django settings for the model.


If there's no easy way to do this the only idea I've had is to host
two versions of the project on the same web server with different DB
settings.  We could then wrap the command line tool with a sed script
to edit the setting.py file on a remote client using the tool before
submitting data to the server.

Any feedback is appreciated.

Cheers,

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



Need help with related objects.

2007-10-11 Thread aabele

Hallo - i'm kind of newbie in django, but actually like it very much.
I need to make a search panel in web site where users could search
worker by name, city etc, and by working time and day. I would like to
make this panel using django db-api, not raw sql.

Here are two models.
--
class worker(models.Model):
name = models.CharField(max_length=100,blank=True)
city = models.CharField(max_length=100,blank=True)
address = models.CharField(max_length=100,blank=True)
notes = models.TextField(blank=True)

class WorkingDay(models.Model):
day = models.ForeignKey(Notary)
worker = models.ForeignKey(Notary)
wrk_from = models.TimeField(blank=True,null=True)
wrk_to = models.TimeField(blank=True,null=True)
--

I made search function, and while I tried to search by the field of
first model it worked quite well. Now I'm stock with the search by
workingdays.

--
worker_list = worker.objects.filter(**notary).extra(
select = {
'found_wrk_days': 'SELECT COUNT(*) FROM worker_WorkingDay
WHERE worker_WorkingDay.worker_id = worker_worker.id etc blabla ... ',
},

where=['found_wrk_days > %s'],
params=[0,]

)
--
Any help (or just link to rtfm subject :) will be appreciated. Thanx
in advance.


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



Re: Signals error - I can't do a import

2007-10-11 Thread Benjamin Slavin

Sounds like a circular import problem.

You might want to try this:

8<= sig.py =

def thesignal(sender, instance, signal, *args, **kwargs):
   from mysite.plush.models import Photo
   assert False, "It got here"

8<= sig.py =

Regards,
  - Ben

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



Re: The signal is not working... I don't know what's wrong

2007-10-11 Thread Young Gyu Park
On 10/11/07, Alex Koshelev <[EMAIL PROTECTED]> wrote:
>
>
> 1. Related objects are deleted automatically


No it's not working. that's why I am making this signal stubs.

2. post_delete signal sends when object already is deleted. so it has
> no primary key(id=None)


When I see the error page, I can see the instance object. but I can't access
the member variable of the object.

On 11 окт, 17:33, "Young Gyu Park" <[EMAIL PROTECTED]> wrote:
> > > def delete_comment_by_entry(sender, instance, signal, *args,
> **kwargs):
> > > entry = instance.id
> > > try:
> > > FreeComment.objects.filter
> > > (object_id__exact=instance._get_pk_val()).delete()
> > > except (FreeComment.DoesNotExist, AssertionError):
> > > logger.info('free comment post delete : ' + entry)
> > > logger.info('free comment post delete : ' + entry.id )
> >
> > > # connect signal
> > > dispatcher.connect(delete_comment_by_entry, sender=Entry, signal=
> > > signals.post_delete)
> >
> > I have been making the blog system.
> >
> > When I deleted the entry, I want to delete the comments in conjunction
> with
> > entry automatically.
> >
> > So I try to use the signal but this is not working
> >
> > but It is not working I don't know why
> >
> > can you let me know a way?
> >
> > Thanks a lot always.
>
>
> >
>

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



Signals error - I can't do a import

2007-10-11 Thread Greg

Hello,
I have a very strange error.  When a Style gets deleted I want my
signal to get called and the signal function will delete the
appropriate photo.  I created a new file called sig.py which just
contains my 'thesignal' function.  The problem arises when I do 'from
mysite.plush.models import Photo' in my sig file.  I get the error
'ImportError: cannot import name Photo.  I have no idea why it's doing
this?  I wonder if it has something to do with because I'm doing a
'from mysite.plush.sig import thesignals' from within my models.py
file.  I wonder if since both .py files are importing functions from
each other if that is causing the error.  However, in all the
documentation I've read about signals the examples do the same
thing.

Below is my code:



models.py

from django.dispatch import dispatcher
from django.db.models import signals
from mysite.plush.sig import thesignal

class Photo(models.Model):
photo = models.ImageField(upload_to="site_media/thumbnails/")
thumbnail = models.ImageField(upload_to="site_media/thumbnails/",
editable=False)
thumbnail2 = models.ImageField(upload_to="site_media/thumbnails/",
editable=False)

class Style(models.Model):
name = models.CharField(maxlength=200, core=True)
theslug = models.SlugField(prepopulate_from=('name',), blank=True,
editable=False)
image = models.ForeignKey(Photo)

dispatcher.connect(thesignal, signal=signals.post_delete,
sender=Style)

///

sig.py

from mysite.plush.models import Photo

def thesignal(sender, instance, signal, *args, **kwargs):
assert False, "It got here"

//

The problem arises whenever I add the line 'from mysite.plush.models
import Photo' from within my sig.py file.  My command prompt
immediately errors out with 'ImportError: cannot import name Photo'


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



Re: deseb installation in ubuntu

2007-10-11 Thread Xan



On Oct 9, 8:41 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On 10/9/07, Xan <[EMAIL PROTECTED]> wrote:
>
> > Where is the error?
>
> In all seriousness, judging from your last several emails, it's time
> for you to sit down and read the official documentation for Python;
> most of your problems seem to stem from not understanding how Python's
> import path works.
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of correct."

Sorry James, but I'm not a programmer. I only want to run deseb easyly
as I run django.
The think I like to django is that it's simple: no SQL knowledge is
required, no programming language knowledge required, 

I choose django among others (ruby on rails requires SQL, symphony
have more complicate organization, etc. )for this reason

Perhaps I have to read python doc, but my intention is only follow
deseb/django documentation. If normal user have to read python doc,
then django became not simple, I think

But, thanks for your recommendation

Regards,
Xan.

PS: Not offend intention


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



Re: deseb installation in ubuntu

2007-10-11 Thread Xan



On Oct 9, 9:50 pm, Derek Anderson <[EMAIL PROTECTED]> wrote:
> well, is 7.04, site-packages is here:
> /usr/lib/python2.5/site-packages/
>
> but your problem obviously precedes this.  did you muck with you
> manage.py file?
>
> or, when you say "import setting.py", you're not literally typing
> "import setting.py" are you?  make sure you're not including the
> extension in your manage.py, or anywhere else you're calling it.  (same
> goes for DJANGO_SETTINGS_MODULE)

In theory (following instructions) I have only to touch settings.py
Why now I have to change manage.py?

What change I have to put in DJANGO_SETTINGS_MODULE?

Thanks in advance,
Xan.

>
> derek
>
>
>
> Xan wrote:
> > Hi,
>
> > * I have installed django 0.96 in ubuntu 7.04 [http://
> > packages.ubuntu.com/gutsy/python/python-django] (when I run dpkg -l I
> > get version "0.96-1~feisty1")
>
> > * I want to install deseb and I follow installation instructions
> > [http://code.google.com/p/deseb/wiki/Installation]
>
> > * The problem is that, after I do import als setting.py, I get the
> > following error:
>
> > python manage.py runserver
> > Error: Can't find the file 'settings.py' in the directory containing
> > 'manage.py'. It appears you've customized things.
> > You'll have to run django-admin.py, passing it your settings module.
> > (If the file settings.py does indeed exist, it's causing an
> > ImportError somehow.)
>
> > * I think that the problem is that I don't know where is
> > "/site-packages".  I created the directory  "site-
> > packages" in /usr/share/python/ and I put "deseb" as a subdirectory
>
> > Where is the error?
>
> > Thanks in advance,
> > Xan.
>
> --
>   looking to buy or sell anything?
>
>  try:http://allurstuff.com
>
>   it's a classified ads service that
>   shows on a map where the seller is
>   (think craigslist + google maps)
>
>   plus it's 100% free :)


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



Re: linking to external resources

2007-10-11 Thread Alex Koshelev

> open in the browser and just shows me lots of (IMHO) garbage
it just binary data of your chm file.
how do you serve static data? through apache or other?


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



Re: How to allow a ForeignKey field to be null

2007-10-11 Thread Alex Koshelev

You must recreate your database tables for this application. See docs
for "manage.py reset"


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



Re: The signal is not working... I don't know what's wrong

2007-10-11 Thread Alex Koshelev

1. Related objects are deleted automatically
2. post_delete signal sends when object already is deleted. so it has
no primary key(id=None)

On 11 окт, 17:33, "Young Gyu Park" <[EMAIL PROTECTED]> wrote:
> > def delete_comment_by_entry(sender, instance, signal, *args, **kwargs):
> > entry = instance.id
> > try:
> > FreeComment.objects.filter
> > (object_id__exact=instance._get_pk_val()).delete()
> > except (FreeComment.DoesNotExist, AssertionError):
> > logger.info('free comment post delete : ' + entry)
> > logger.info('free comment post delete : ' + entry.id )
>
> > # connect signal
> > dispatcher.connect(delete_comment_by_entry, sender=Entry, signal=
> > signals.post_delete)
>
> I have been making the blog system.
>
> When I deleted the entry, I want to delete the comments in conjunction with
> entry automatically.
>
> So I try to use the signal but this is not working
>
> but It is not working I don't know why
>
> can you let me know a way?
>
> Thanks a lot always.


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



Re: TinyMCE in admin

2007-10-11 Thread Kenneth Gonsalves


On 11-Oct-07, at 10:51 AM, Jeremy Dunck wrote:

>> . I still can't get django find the files textareas.js and
>> tiny_mce.js. it's returning 404. Please help. Thank you
>>
>
> What's your admin URL and what URL is being requested for the  
> textarea.js?
> This is generally a matter of putting the right number of ../ bits in
> your Admin.js attribute.

or symlink to ~/admin/media/js

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/



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



Re: How to allow a ForeignKey field to be null

2007-10-11 Thread Greg

Jeremy,
I tried and it still doesn't work.  Below are part of my models.py and
views.py files:



models.py

class Delivery(models.Model):
name = models.CharField(maxlength=100)
url = models.CharField(maxlength=100)

class Orders(models.Model):
s_name = models.CharField("Name", maxlength=100, blank=True)
s_address = models.CharField("Shipping Address", maxlength=100,
blank=True)
s_city = models.CharField("Shipping City", maxlength=100,
blank=True)
s_state = models.USStateField("Shipping State", blank=True)
s_zip = models.CharField("Shipping Zip", maxlength=100,
blank=True)
delivery_method = models.ForeignKey(Delivery, null=True,
blank=True)

/

views.py

def success(request):
o = Orders()
o.s_name = request.session['orderdetails']['s_firstname'] + " " +
request.session['orderdetails']['s_lastname']
o.s_address = request.session['orderdetails']['s_address']
o.s_city = request.session['orderdetails']['s_city']
o.s_state = request.session['orderdetails']['s_state']
o.s_zip = request.session['orderdetails']['s_zip']
o.save()

/

Notice how when I'm creating a new order in my view I don't specify a
value for o.delivery_method.

Here is the error that I'm getting when I get to o.save():

IntegrityError at /plush/cart/success/
plush_orders.delivery_method_id may not be NULL

//

Thanks for any help










On Oct 11, 12:41 am, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote:
> On 10/11/07, Greg <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > Hello,
> > I have the following field in my Orders class
>
> > delivery_method = models.ForeignKey(Delivery)
>
> > I want to be able to add a Order record and not specify a Delivery
> > option when the order is initially created.
>
> > I've tried
>
> > delivery_method = models.ForeignKey(Delivery, null=True)
> > and
> > delivery_method = models.ForeignKey(Delivery,blank=True)
>
> > However, when I do this I get the error 'This field is required'
>
> Try it with both.
> null=True, blank=True
>
> null is DB-specific.  blank is validation-specific.


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



Re: Multilanguage - I know what I want, should I do it this way?

2007-10-11 Thread simono

> Look at this:http://code.google.com/p/django-multilingual/

I dont want to use that, because it is basically unmantained - what it
does is very nice and if I were sure this works with django 1.0 and
such I would use it. Also I dont want to re-write D-M because it does
a lot of things I dont need.

>Well, IMO you would have some ForeignKey back to a language neutral
>model where you can also store those fields you want to share in all
>languages.

Hm, I dont want that, because *all* fields are to be translated in
every language. Its just simpler that way. No field sharing between
languages.

about my question: there seems no solution to make a model with
uniqueid=language+id? (I know mysql/postgres can do it)


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



Re: Better FileField

2007-10-11 Thread Marty Alchin

As Malcolm mentioned, I put a lot of time into a patch to solve a
great many problems with FileField, even more than the ones you
mentioned. It's not in trunk yet, and I don't know when it will be,
but I'll answer your questions to give you an overview of how things
will likely work. Keep in mind that it does more than this, but since
these are your concerns, I'll address just those.

> * I don't want to store the files in MEDIA_ROOT, since
>the access needs to go through django for authentication.

The new patch allows you to specify any root location you like,
independent of MEDIA_ROOT. You can even specify a root for any or all
of the FileFields in your project.

> * The containing directory should be given by the model of the FileField.
>   Example:
>
> class MyFriend(models.Model):
> picture=models.NewFileField(...)
>
>if myfriend has id=1234 the file should be in .../myfriends/1234/

Given that you would be able to specify a different root directory for
each FileField, the model name would be easy to include, it just
wouldn't be automatic. As for including the ID as part of the path,
that's something a few other people have requested, and I'm still
trying to work out if there's a decent way to go about that. As it
stands, the patch doesn't support it.

> * Unicode filenames should be encoded in pure ascii in the filesystem.
>The encoding should be reversable, so that you can get the unicode
>string back. This could be done with utils.http.urlquote().
>
> * The database should contain the unicode filename.

I'm not a unicode expert, so I won't pretend to know about the
"should" aspect of this, I'll defer to Malcolm on that. The patch
would, as Malcolm mentioned, provide a way for you to override how the
FileField generates the filename for use on the filesystem, as well as
what's stored in the database. So it would be fairly simple to include
this functionality on your own, even if it's not part of the standard
mechanism.

> Has someone the same problems?

Yes, and more. :)

> Has someone solved/coded this?

Mostly.

> This patch only uses a better filename normalization:
> http://code.djangoproject.com/ticket/3119
> The unicode name get's lost.

The new FileField patch provides a different (better, in my opinion)
approach to this, so I expect that ticket would end up getting closed
with a note on how to use the new system to do the same thing. We'll
see.

-Gul

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



The signal is not working... I don't know what's wrong

2007-10-11 Thread Young Gyu Park
>
> def delete_comment_by_entry(sender, instance, signal, *args, **kwargs):
> entry = instance.id
> try:
> FreeComment.objects.filter
> (object_id__exact=instance._get_pk_val()).delete()
> except (FreeComment.DoesNotExist, AssertionError):
> logger.info('free comment post delete : ' + entry)
> logger.info('free comment post delete : ' + entry.id )
>
> # connect signal
> dispatcher.connect(delete_comment_by_entry, sender=Entry, signal=
> signals.post_delete)
>

I have been making the blog system.

When I deleted the entry, I want to delete the comments in conjunction with
entry automatically.

So I try to use the signal but this is not working

but It is not working I don't know why

can you let me know a way?

Thanks a lot always.

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



Re: dict objects are unhashable

2007-10-11 Thread kevinski

You were right the problem was in the urls. Thank you so much for your
help!


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



Re: Linking dropdowns using newforms

2007-10-11 Thread Emmchen

Thanks guys!

I'll look into JS then and hopefully I'll be able to solve my
problem.
Thanks for the hints.

/emma


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



Re: Newforms Field Limit Question

2007-10-11 Thread Joseph Kocherhans

On 10/10/07, machineghost <[EMAIL PROTECTED]> wrote:
>
> I recently attempted to implement a very large form using the newforms
> library, and I discovered that if a form contains more than 45 fields
> it generates a "too many values to unpack" error when you try to
> render it in a template.  Does anyone know if this is deliberate
> (either because of some Pythonic limitation or simply to stop people
> from making insanely large forms), or whether this is something I
> should file a bug for?  If it is deliberate, I think that a line
> somewhere in the documentation about it would be helpful to anyone
> else who tries to make a way-too-big form.

This sounds more like a bug in *your* code than a bug in Django. There
is no limit that I'm aware of. "too many values to unpack" often
happens when you try to unpack what you think is a tuple but is
actually a sting... ie ('test') instead of ('test',).

No one can really help unless you post a traceback though.

Joseph

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



Re: Better FileField

2007-10-11 Thread Malcolm Tredinnick

On Thu, 2007-10-11 at 15:04 +0200, Thomas Guettler wrote:
> Hi,
> 
> I like django, but not models.FileField.
> 
> * I don't want to store the files in MEDIA_ROOT, since
>the access needs to go through django for authentication.
> 
> * The containing directory should be given by the model of the FileField.
>   Example: 
> 
> class MyFriend(models.Model):
> picture=models.NewFileField(...)
> 
>if myfriend has id=1234 the file should be in .../myfriends/1234/
> 
> * Unicode filenames should be encoded in pure ascii in the filesystem.
>The encoding should be reversable, so that you can get the unicode
>string back. This could be done with utils.http.urlquote().

Any halfway capable filesystems can handle non-ASCII characters, so this
is just an arbitrary restriction. It's something that could be
overridable (since people want pretty much arbitrary control over the
filename anyway, it's just another part of that), but it's not a default
requirement.

> 
> * The database should contain the unicode filename.
> 
> Has someone the same problems?
> 
> Has someone solved/coded this?

There's a ticket in track by Marty Alchin to redesign large portions of
the FileField storage and the like. That should solve most of your
issues.

Regards,
Malcolm



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



Re: Multilanguage - I know what I want, should I do it this way?

2007-10-11 Thread Alex Koshelev

Look at this:
http://code.google.com/p/django-multilingual/


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




Better FileField

2007-10-11 Thread Thomas Guettler

Hi,

I like django, but not models.FileField.

* I don't want to store the files in MEDIA_ROOT, since
   the access needs to go through django for authentication.

* The containing directory should be given by the model of the FileField.
  Example: 

class MyFriend(models.Model):
picture=models.NewFileField(...)

   if myfriend has id=1234 the file should be in .../myfriends/1234/

* Unicode filenames should be encoded in pure ascii in the filesystem.
   The encoding should be reversable, so that you can get the unicode
   string back. This could be done with utils.http.urlquote().

* The database should contain the unicode filename.

Has someone the same problems?

Has someone solved/coded this?

  Thomas

PS:
This patch only uses a better filename normalization: 
http://code.djangoproject.com/ticket/3119
The unicode name get's lost.

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



Re: utils.text.urlquote returns unicode?

2007-10-11 Thread Malcolm Tredinnick

On Thu, 2007-10-11 at 09:32 +0200, Thomas Guettler wrote:
> Hi,
> 
> I looked at the source of urlquote:
> 
> utils/text.py:
> 
> def urlquote(url, safe='/'):
> """
> A version of Python's urllib.quote() function that can operate on unicode
> strings. The url is first UTF-8 encoded before quoting. The returned 
> string
> can safely be used as part of an argument to a subsequent iri_to_uri() 
> call
> without double-quoting occurring.
> """
> return force_unicode(urllib.quote(smart_str(url)))
> 
> 1. safe gets ignored. I created a patch:
>http://code.djangoproject.com/ticket/5734

That's a bug.
> 
> 2. why force_unicode()?
>   urllib.quote should return a 7 bit ascii string.

No, it shouldn't. It should return a string that can be coerced to ASCII
(there's no such things as non-7-bit ASCII, so you can leave the prefix
off), but the type of the object is unicode in order to be consistent
with everything else Django returns.

Regards,
Malcolm



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



linking to external resources

2007-10-11 Thread bayo opadeyi
Hi,
I am new to django and am rewriting a site i did with php.
In the php app, i could link to some external .pdf or .chm files like this
file_name, where the path and filename were
drawn from a mysql database, and the file
will just open. while trying to reproduce this functionality in django,
i've tried putting the files in /site_media/resources' folder and
linking to it from
the template via  which works
well for the .pdf files (they open in the browser), but .chm files try to
open in the browser and just shows me lots of (IMHO) garbage
Help, anyone?

Bayo
Qrapht Software Dev. Co.
http://boyombo.blogspot.com
http://www.qrapht.com

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



Re: Multilanguage - I know what I want, should I do it this way?

2007-10-11 Thread Horst Gutmann

Well, IMO you would have some ForeignKey back to a language neutral
model where you can also store those fields you want to share in all
languages. Then you could use the unique_together attribute for the
Meta class of your language-dependent model.

Something like:

class Article(models.Model):
   pubdate = models.DatetimeField()

class ArticleI18n(models.Model):
   article = models.ForeignKey('Article)
   language = ...

   class Meta:
   unique_together=(('article','language'),)

Just an idea :-)

Greetings, Horst

2007/10/11, simono <[EMAIL PROTECTED]>:
>
> Hi,
> I'm currently working on a simple CMS that needs to be multilanguage.
> I've read through all the posts on the list and came up with this
> simple solution. My use scenario is like this:
>
> * translations are per model (not per field)
> * language selection is per request (saved in a cookie or so)
>
> I would do it like this:
>
> all models have an additional language field (charset or so). This
> field could be added automagically for every model. But lets make it
> explicit in the example:
>
> class Foo(models.Model):
> title = models.CharField()
> content = models.TextField()
> language = models.CharField(max_length=5)
>
> Question 1: the combination of language+id is unique for every entry.
> Can I use the two as one primary keys in django? I want several
> entries with the same id (!) but different languages to make the
> following work. I guess this is a problem for django ORM.
>
> Then I would write a custom Manager, that takes care of loading the
> correct language-version for a certain entry ID. something like this:
>
> class FooManager(models.Manager):
>def get_query_set(self):
> return super(FooManager,
> self).get_query_set().filter(language=cookievalue_or_smth)
>
> thanks for any input.
> greetings
>  simon
>
>
> >
>

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



Multilanguage - I know what I want, should I do it this way?

2007-10-11 Thread simono

Hi,
I'm currently working on a simple CMS that needs to be multilanguage.
I've read through all the posts on the list and came up with this
simple solution. My use scenario is like this:

* translations are per model (not per field)
* language selection is per request (saved in a cookie or so)

I would do it like this:

all models have an additional language field (charset or so). This
field could be added automagically for every model. But lets make it
explicit in the example:

class Foo(models.Model):
title = models.CharField()
content = models.TextField()
language = models.CharField(max_length=5)

Question 1: the combination of language+id is unique for every entry.
Can I use the two as one primary keys in django? I want several
entries with the same id (!) but different languages to make the
following work. I guess this is a problem for django ORM.

Then I would write a custom Manager, that takes care of loading the
correct language-version for a certain entry ID. something like this:

class FooManager(models.Manager):
   def get_query_set(self):
return super(FooManager,
self).get_query_set().filter(language=cookievalue_or_smth)

thanks for any input.
greetings
 simon


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



Re: Label and input Filed overlap

2007-10-11 Thread Nader

I suppose that I can copy the system 'forms.css' file to local
directory (my own project directory) and change the parameter with
which the distance will be adjusted.
Could you tell me which parameter do I have to change?

Cheers,
Nader

On Oct 11, 1:37 pm, "Phil Davis" <[EMAIL PROTECTED]> wrote:
> On 11/10/2007, Nader <[EMAIL PROTECTED]> wrote:
>
> > I have used the Admin interface in my model. In presentation of Admin
> > page some of the labels have been not present completely. I give an
> > example:
> [...]
> > transferMechanism ( here comes the widget).
> > I can't display the widget here but the widget has been overlapped on
> > the last 3 characters of label.
>
> > My question is: How can I self adjust the distance between them? It
> > isn't meant to make the label name shorter.
>
> The label width (in terms of screen layout) is defined by the style
> sheet that the admin app uses
> (django/contrib/admin/media/css/forms.css) so one way to fix your
> problem would be to edit that file or include your own style sheet
> after the forms.css which overrode the label element's width.
>
> Cheers,
>
> --
> Phil Davis


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



Re: manage.py test can't find the fixtures

2007-10-11 Thread Russell Keith-Magee

On 10/11/07, Simone Cittadini <[EMAIL PROTECTED]> wrote:
>
> if I 'manage.py test' it doesn't find fixtures
...
> class TestSmooth(unittest.TestCase):

This is the problem here - your test needs to extend
django.test.TestCase to identify and load fixtures.

Yours,
Russ Magee %-)

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



Re: Format date according to locale

2007-10-11 Thread Michal Konvalinka
I suppose that django should do this. In documentation are mentioned
some constants, which are present in
django/conf/locale/en/LC_MESSAGES/django.po : DATE_FORMAT,
DATETIME_FORMAT and others.

How can I use it in python and template code?


On 11/10/2007, Jarek Zgoda <[EMAIL PROTECTED]> wrote:
>
> Take a look at babel (http://babel.edgewall.org/). Not all formats are
> implemented, byt chances are, that you'd get something more if
> standard date filter is not enough.
>
> On 11 Paź, 10:19, "Michal Konvalinka" <[EMAIL PROTECTED]>
> wrote:
> > Hi,
> > I couldn't find anything about formatting a date according to locale.
> >
> > I have four languages in my settings.py, I use language switcher and
> > everything works fine. I have a date, for example
> > date_of_birth = models.DateField(null=True, blank=True)
> > in my model and I don't know how to format it according to selected locale.
> >
> > Thanks for any hint.
> > Michal
>
>
> >
>

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



Re: Label and input Filed overlap

2007-10-11 Thread Phil Davis

On 11/10/2007, Nader <[EMAIL PROTECTED]> wrote:
> I have used the Admin interface in my model. In presentation of Admin
> page some of the labels have been not present completely. I give an
> example:
[...]
> transferMechanism ( here comes the widget).
> I can't display the widget here but the widget has been overlapped on
> the last 3 characters of label.
>
> My question is: How can I self adjust the distance between them? It
> isn't meant to make the label name shorter.

The label width (in terms of screen layout) is defined by the style
sheet that the admin app uses
(django/contrib/admin/media/css/forms.css) so one way to fix your
problem would be to edit that file or include your own style sheet
after the forms.css which overrode the label element's width.

Cheers,

-- 
Phil Davis

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



manage.py test can't find the fixtures

2007-10-11 Thread Simone Cittadini

I have this directories structure

site/app_one/models.py
site/app_one/tests.py
site/app_one/fixtures/test.json

if I 'manage.py loaddata test' it works

if I 'manage.py test' it doesn't find fixtures

the test class starts with :

import unittest
from models import *
   
class TestSmooth(unittest.TestCase):
fixtures = ['test.json']
   
def testGetPrefisso(self):
p = Prefisso.objects.get(pre='01')
self.assertEquals(p.distretto, 'Italia Mobile')

[...]

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



Re: Add Column to ManyToMany Generated Table

2007-10-11 Thread Russell Keith-Magee

On 10/11/07, TopRamen <[EMAIL PROTECTED]> wrote:
>
> Gentlemen, I'm new to the Django seen and am currently working on my
> first application in it. In part of my model, I have a ManyToMany
> relationship between the Purchase class and the Product class. The
> ManyToMany relationship is called products and is in the Purchase
> class. I'd like to add some additional columns/fields to the
> automatically generated ManyToMany table. In this case, Django makes a
> new table called _purchase_products. I'd like to store some extra
> info in this table such as a password for a download for example. Is
> this possible in Django? I've combed the Model API and Google and
> can't find an answer to this anywhere.

There isn't anything explicitly in the API to support this, although
it has been discussed many times. Search the archives (including
django-developers) for 'm2m intermediate'.

There is also a workaround solution, described here:
http://www.djangoproject.com/documentation/models/m2m_intermediary/

Yours,
Russ Magee %-)

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



TransactionManagementError behind mod_python only

2007-10-11 Thread olivier

Hi group,

my setup : win xp, python 2.5, apache 2.2.4, postgres 8.2, mod_python
3.3.1,  psycopg2 2.0.5

I have some views decorated by @transaction.commit_manually.
I do transaction.commit() or transaction.rollback() before response,
as I should.

Everything is running fine when I run the development server.
Behind mod_python, I get :
TransactionManagementError: Transaction managed block ended with
pending COMMIT/ROLLBACK

Does anyone know what's going on and what could be the source of the
problem ? I know very little about Apache.

Thanks,

Olivier


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



Re: How to delete a table?

2007-10-11 Thread Nader

You can drop your table in sqlite session without deleting the other
tables. You can do that in sqlite by the next command:
sqlite>drop table Orders;



On Oct 11, 11:15 am, TopRamen <[EMAIL PROTECTED]> wrote:
> Greg, if you do not mind losing any sample data you may have in your
> tables, you could do a 'python manage.py reset . This will
> execute the output of 'python manage.py sqlreset  in your
> database. Basically, it will delete your tables, and re-run a syncdb,
> which will re-build your database's tables based on your model
> definition.
>
> On Oct 10, 10:01 pm, Greg <[EMAIL PROTECTED]> wrote:
>
> > Hello,
> > Simple question,  I have a database table called Orders.  I want to
> > delete this table so that when I do 'python manage.py syncdb' the
> > table will get recreated.  I want to make some modifications to the
> > columns in the table and I can't seem to do the with SQLite.  I don't
> > want to delete the information from my other tables...just the Orders
> > table.
>
> > Do I need to do this with my sqliteman software or ca I do something
> > like Orders.delete() in my djano command prompt.
>
> > Thanks


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



Label and input Filed overlap

2007-10-11 Thread Nader

Hallo,

I have used the Admin interface in my model. In presentation of Admin
page some of the labels have been not present completely. I give an
example:

 This the definition of a attribute in a model
transferMechanism = models.CharField(primary_key=True, maxlength=100)

But in presentation page It has been overlapped with the input field:

transferMechanism ( here comes the widget).
I can't display the widget here but the widget has been overlapped on
the last 3 characters of label.

My question is: How can I self adjust the distance between them? It
isn't meant to make the label name shorter.

Would you give me some information please?

With regards,
Nader


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



Re: Format date according to locale

2007-10-11 Thread Jarek Zgoda

Take a look at babel (http://babel.edgewall.org/). Not all formats are
implemented, byt chances are, that you'd get something more if
standard date filter is not enough.

On 11 Paź, 10:19, "Michal Konvalinka" <[EMAIL PROTECTED]>
wrote:
> Hi,
> I couldn't find anything about formatting a date according to locale.
>
> I have four languages in my settings.py, I use language switcher and
> everything works fine. I have a date, for example
> date_of_birth = models.DateField(null=True, blank=True)
> in my model and I don't know how to format it according to selected locale.
>
> Thanks for any hint.
> Michal


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



Re: TypeError in Django Admi with edit_inline

2007-10-11 Thread mrsynock

Finally, I use primary_key instead of Unique. this is not exactly the
same but does what I want.
And that's work


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



Using Django's builtin documentation

2007-10-11 Thread Rufman

Django uses docutils and restructured text for the documentation of
the admin. How can i get my own documentation of my views and models
(restructured text) to show on the documentation page in the django
admin (dashboard -> documentation)?

Just out of interest: Does anyone know how the core of the django
automatic documentation works (link to a tutorial)?

thx for the help


Stephane


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



Re: Users vs Sites

2007-10-11 Thread MarcoX

Good morning Chris.
Thank you for the reply.

I'm developing a CMS (Content management system).
I have 4 sites for 1 customer. For this 4 sites the users are the
same, but the inner users (journalist) that write the stories for the
CMS can write only for 1 site. Then I need to only bind a group of
users (journalist group) to write stories for a unique site.

The permissions that now is possible to specify in django admin
doesn't permit to carry out these specific ties.
I hope that my explanation is enough clear, otherwise I try to explain
it better.

Many thanks.

MarcoX




On 11 Ott, 11:09, Chris Hoeppner <[EMAIL PROTECTED]> wrote:
> There *can* be other solutions, but most would be cumbersome and ugly,
> like adding a "group" column to each table (the simple way), or using a
> polymorphic relationship (the cleaner, leaner, and harder way).
>
> You'll find yourself coding an authorization system on top of django's.
> And when it's done, there is the thing I'd call "let the admin know
> about it".
>
> What kind of system are you pretending to build? Maybe a few more
> details could get me on the right track.
>
> ~ Chris
>
> El mi?, 10-10-2007 a las 10:20 -0700, MarcoX escribi?:
>
> > thank you, Chris.
>
> > The solution of my problem is therefore very difficult to implement.
> > The branch of which you speak to me is still in testing. And however
> > it seems that it cannot resolve my problem completely.
> > Therefore not are others (simpler) solutions?
>
> > MarcoX
>
> > On 10 Ott, 18:31, Chris Hoeppner <[EMAIL PROTECTED]> wrote:
> > > You'd need row-level permission for that, and that's outside of the
> > > admin's intended philosophy. Though, there's such a branch being
> > > developed, and I can recall seeing somewhere a django app for that
> > > purpose. Just google it and it should pop up.
>
> > > Also, since row-level permission is not built into the admin in any way,
> > > you'd find yourself doing custom admin views, which is neither bad nor
> > > hard, but you might feel overwhelmed by the task, since it's a bit hard
> > > to grasp at first.
>
> > > ~Chris
>
> > > El mi?, 10-10-2007 a las 07:51 -0700, MarcoX escribi?:
>
> > > > Hi to all,
> > > > I have a problem on the configuration of the users in django.
> > > > In my plan I have 4 sites. I would want that in the admin view I can
> > > > specify for some users the possibility of being able to make
> > > > determined actions for determined sites.
> > > > For example, the user X can write the object Y only for the site Z.
>
> > > > 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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: NameError when following tutorial in djangobook.com/en/beta/chapter03/

2007-10-11 Thread Jeremy Dunck

On 10/10/07, drdukk <[EMAIL PROTECTED]> wrote:
>
> I'm new to python and django and I'm trying to follow the tutorial on
> djangobook.com, but when i get to the step (chapter 3) where the first
> piece of code should be executed (current_time) i get a NameError
> telling me "name 'current_datetime' is not defined"
>
> I'm running django 0.96 on python 2.5.1 on windows 2003.
>
> I get the "It worked" screen fine.
>
> I think I have all paths as they should be, my project is in
> pythonpath, I can import my project, the url is mapped.
>
> Any tips would be greatly appreciated, I can't seem to find anything
> about it elsewhere (as it's apparently a very generic error).
>

drdukk, sorry for lack of response on mailing list.  The beta version
of the book has been out for quite a while and is not in line w/
django is some respects.

Even so, when reporting errors like this, putting code on dpaste.com
as well as (full) traceback will generally get you a more helpful and
informed response.

Glad IRC worked for 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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to delete a table?

2007-10-11 Thread TopRamen

Greg, if you do not mind losing any sample data you may have in your
tables, you could do a 'python manage.py reset . This will
execute the output of 'python manage.py sqlreset  in your
database. Basically, it will delete your tables, and re-run a syncdb,
which will re-build your database's tables based on your model
definition.

On Oct 10, 10:01 pm, Greg <[EMAIL PROTECTED]> wrote:
> Hello,
> Simple question,  I have a database table called Orders.  I want to
> delete this table so that when I do 'python manage.py syncdb' the
> table will get recreated.  I want to make some modifications to the
> columns in the table and I can't seem to do the with SQLite.  I don't
> want to delete the information from my other tables...just the Orders
> table.
>
> Do I need to do this with my sqliteman software or ca I do something
> like Orders.delete() in my djano command prompt.
>
> Thanks


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



Add Column to ManyToMany Generated Table

2007-10-11 Thread TopRamen

Gentlemen, I'm new to the Django seen and am currently working on my
first application in it. In part of my model, I have a ManyToMany
relationship between the Purchase class and the Product class. The
ManyToMany relationship is called products and is in the Purchase
class. I'd like to add some additional columns/fields to the
automatically generated ManyToMany table. In this case, Django makes a
new table called _purchase_products. I'd like to store some extra
info in this table such as a password for a download for example. Is
this possible in Django? I've combed the Model API and Google and
can't find an answer to this anywhere.

The only alternative I can think of is to manually make my own
ManyToMany table by actually hand coding a 3rd class with two foreign
key fields... one pointing to Purchase, and the other to Product. Is
this what I should do to get around not being able to add additional
columns to the auto-generate ManyToMany table? Thanks in advance!


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



Re: Users vs Sites

2007-10-11 Thread Chris Hoeppner

There *can* be other solutions, but most would be cumbersome and ugly,
like adding a "group" column to each table (the simple way), or using a
polymorphic relationship (the cleaner, leaner, and harder way).

You'll find yourself coding an authorization system on top of django's.
And when it's done, there is the thing I'd call "let the admin know
about it".

What kind of system are you pretending to build? Maybe a few more
details could get me on the right track.

~ Chris

El mi�, 10-10-2007 a las 10:20 -0700, MarcoX escribi�:
> thank you, Chris.
> 
> The solution of my problem is therefore very difficult to implement.
> The branch of which you speak to me is still in testing. And however
> it seems that it cannot resolve my problem completely.
> Therefore not are others (simpler) solutions?
> 
> MarcoX
> 
> On 10 Ott, 18:31, Chris Hoeppner <[EMAIL PROTECTED]> wrote:
> > You'd need row-level permission for that, and that's outside of the
> > admin's intended philosophy. Though, there's such a branch being
> > developed, and I can recall seeing somewhere a django app for that
> > purpose. Just google it and it should pop up.
> >
> > Also, since row-level permission is not built into the admin in any way,
> > you'd find yourself doing custom admin views, which is neither bad nor
> > hard, but you might feel overwhelmed by the task, since it's a bit hard
> > to grasp at first.
> >
> > ~Chris
> >
> > El mi?, 10-10-2007 a las 07:51 -0700, MarcoX escribi?:
> >
> > > Hi to all,
> > > I have a problem on the configuration of the users in django.
> > > In my plan I have 4 sites. I would want that in the admin view I can
> > > specify for some users the possibility of being able to make
> > > determined actions for determined sites.
> > > For example, the user X can write the object Y only for the site Z.
> >
> > > 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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Validation of dynamically generated forms

2007-10-11 Thread pinco

Frank,

your snippet works great. I just removed the int conversion on
bf_data, since I want to have f.is_valid() = false if the user submits
something different than an integer.

Without you I would never be able to solve the problem.

Thanks a lot.

On 11 Ott, 09:51, pinco <[EMAIL PROTECTED]> wrote:
> Great!
>
> Thank you very much Frank.
>
> On 10 Ott, 22:03, FrankW <[EMAIL PROTECTED]> wrote:
>
>
>
> > I would swear that I posted a response to this earlier today, but it
> > doesn't seem to show up in the group.  The problem you're having is
> > because of the 'cart_item_' that you are adding in. It is not being
> > added into the dictionary that is assigned to the form's data.
>
> > >>> f.fields
>
> > {'cart_item_a':  > 0x01423130>, 'cart_item_b':  > object at 0x01423190>}>>> f.data
>
> > {'a': '1', 'b': '2'}
>
> > The validation logic checks against f.data, and doesn't find
> > 'cart_item_a' as a key.  Try this instead:
>
> > >>> class CartForm(forms.Form):
>
> > ... def __init__(self, a):
> > ... super(CartForm, self).__init__(a)
> > ... for key in a.keys():
> > ... self.fields[str(key)] =
> > forms.IntegerField(required  = True)
> > ... self.fields[str(key)].bf =
> > forms.forms.BoundField(self, self.fields[str(key)], str(key))
> > ... self.fields[str(key)].bf._data =
> > int(a[key])
> > ... return
> > ...
>
> > >>> j = CartForm({'a':'1','b':'2'})
> > >>> j.is_valid()
>
> > On Oct 8, 6:19 pm, pinco <[EMAIL PROTECTED]> wrote:
>
> > > Frank,
> > > thak you for your help.
>
> > > I worked on the form model using bound field, and now the forms is
> > > bound.
>
> > > class CartForm(forms.Form):
> > > def __init__(self, a):
> > > super(CartForm, self).__init__(a)
> > > for key in a.keys():
> > > self.fields['cart_item_' + str(key)] = 
> > > forms.IntegerField(required
> > > = True)
> > > self.fields['cart_item_' + str(key)].bf = 
> > > BoundField(self,
> > > self.fields['cart_item_' + str(key)], 'cart_item_' + str(key))
> > > self.fields['cart_item_' + str(key)].bf._data = 
> > > int(a[key])
> > > return
>
> > > However, I still have some problems.
> > > 1- I don't understand how the form validates:
>
> > > >>> f = CartForm({'a':'1', 'b':'2'})
> > > >>> f.is_bound
> > > True
> > > >>> f.is_valid()
> > > False
> > > >>> k = CartForm({'a':1, 'b':2})
> > > >>> k.is_bound
> > > True
> > > >>> k.is_valid()
>
> > > False
>
> > > I supposed the first one validation to be false since the field widget
> > > is an IntegerField.
>
> > > 2 - I'm not able to figure out to read the form after it has been
> > > posted.
>
> > > Can you help me?
>
> > > Many thanks
>
> > > On 7 Ott, 02:45, FrankW <[EMAIL PROTECTED]> wrote:
>
> > > > In your example,
> > > > self.fields[str(key)]=forms.CharField(initial=c[key])
> > > > isn't doing what you expect.
>
> > > > You are setting the initial attribute of a field, not creating
> > > > a BoundField. See django/newforms/forms.py, and look at the
> > > > comments for BaseForm and Form and the code for
> > > > BoundField.
>
> > > > On Oct 6, 8:31 am, pinco <[EMAIL PROTECTED]> wrote:
>
> > > > > Hi,
>
> > > > > I'm trying to figure out how to build a form to display x fields,
> > > > > where x is determined at runtime (e.g. a form to update the quantities
> > > > > of all the items in a shopping cart).
>
> > > > > My model is:
>
> > > > > class CartForm(forms.Form):
>
> > > > > def __init__(self, c, *args, **kwargs):
> > > > > super(CartForm, self).__init__(*args, **kwargs)
> > > > >   # c is a dictionary containing cart items
> > > > > for key in c.keys():
> > > > > 
> > > > > self.fields[str(key)]=forms.CharField(initial=c[key])
> > > > > return
>
> > > > > My view is:
>
> > > > > def show_cart(request):
> > > > > cart = Cart.objects.get(pk=request.session.get('cart_id', 
> > > > > None))
> > > > > cart_items = cart.cartitem_set.all() #Just to avoid two hits 
> > > > > for the
> > > > > same info
> > > > > form = CartForm(c=create_cart_dictionary(cart_items))
> > > > > return render_to_response('show_cart3.html', {'cart': cart,
> > > > > 'num_items': cart.no_items, 'cart_items': cart_items, 'form':form})
>
> > > > > def update_quantity(request):
>
> > > > > if request.method == 'POST':
> > > > > cart = 
> > > > > Cart.objects.get(pk=request.session.get('cart_id', None))
> > > > > form = CartForm(request.POST)
> > > > > #old_quantity =item.quantity
> > > > > if form.is_valid():
> > > > > for item in cart.cartitem_set.all():
> > > > > itemid = item.id
> > > > >  

Re: NameError when following tutorial in djangobook.com/en/beta/chapter03/

2007-10-11 Thread drdukk

Turned out I was missing an import statement for my code in urls.py
(and it's in the tutorial but I missed it)

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



Re: NameError when following tutorial in djangobook.com/en/beta/chapter03/

2007-10-11 Thread drdukk

Turned out I was missing an import statement for my code in urls.py
(and it's in the tutorial but I missed it)

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



Re: NameError when following tutorial in djangobook.com/en/beta/chapter03/

2007-10-11 Thread drdukk

Turned out I was missing an import statement for my code in urls.py
(and it's in the tutorial but I missed it)

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



recepci n a IslamInDepth.com en espa ol

2007-10-11 Thread malah

http://www.islamindepth.com/contents/details/125


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



Format date according to locale

2007-10-11 Thread Michal Konvalinka

Hi,
I couldn't find anything about formatting a date according to locale.

I have four languages in my settings.py, I use language switcher and
everything works fine. I have a date, for example
date_of_birth = models.DateField(null=True, blank=True)
in my model and I don't know how to format it according to selected locale.

Thanks for any hint.
Michal

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



Watch TV stations from around the World

2007-10-11 Thread jrou

Even watch the War in Iraq live and uncensored from your PC or Laptop
for FREE after a small onetime installment fee.  1,000's more
stations.  http://jblog.ipodpsp.hop.clickbank.net


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



Stockphoto and zipfiles

2007-10-11 Thread thomas_c

Hi everybody!

I have installed the application "Stockphoto" on my website. i can add
gallery and photos. I have read that we can upload zipfiles directly
for a gallery. And I don't know  how  can i make it!

If you have any idea, i'm interested

Thanks
Thomas


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



Re: Validation of dynamically generated forms

2007-10-11 Thread pinco

Great!

Thank you very much Frank.

On 10 Ott, 22:03, FrankW <[EMAIL PROTECTED]> wrote:
> I would swear that I posted a response to this earlier today, but it
> doesn't seem to show up in the group.  The problem you're having is
> because of the 'cart_item_' that you are adding in. It is not being
> added into the dictionary that is assigned to the form's data.
>
> >>> f.fields
>
> {'cart_item_a':  0x01423130>, 'cart_item_b':  object at 0x01423190>}>>> f.data
>
> {'a': '1', 'b': '2'}
>
> The validation logic checks against f.data, and doesn't find
> 'cart_item_a' as a key.  Try this instead:
>
> >>> class CartForm(forms.Form):
>
> ... def __init__(self, a):
> ... super(CartForm, self).__init__(a)
> ... for key in a.keys():
> ... self.fields[str(key)] =
> forms.IntegerField(required  = True)
> ... self.fields[str(key)].bf =
> forms.forms.BoundField(self, self.fields[str(key)], str(key))
> ... self.fields[str(key)].bf._data =
> int(a[key])
> ... return
> ...
>
> >>> j = CartForm({'a':'1','b':'2'})
> >>> j.is_valid()
>
> On Oct 8, 6:19 pm, pinco <[EMAIL PROTECTED]> wrote:
>
>
>
> > Frank,
> > thak you for your help.
>
> > I worked on the form model using bound field, and now the forms is
> > bound.
>
> > class CartForm(forms.Form):
> > def __init__(self, a):
> > super(CartForm, self).__init__(a)
> > for key in a.keys():
> > self.fields['cart_item_' + str(key)] = 
> > forms.IntegerField(required
> > = True)
> > self.fields['cart_item_' + str(key)].bf = 
> > BoundField(self,
> > self.fields['cart_item_' + str(key)], 'cart_item_' + str(key))
> > self.fields['cart_item_' + str(key)].bf._data = 
> > int(a[key])
> > return
>
> > However, I still have some problems.
> > 1- I don't understand how the form validates:
>
> > >>> f = CartForm({'a':'1', 'b':'2'})
> > >>> f.is_bound
> > True
> > >>> f.is_valid()
> > False
> > >>> k = CartForm({'a':1, 'b':2})
> > >>> k.is_bound
> > True
> > >>> k.is_valid()
>
> > False
>
> > I supposed the first one validation to be false since the field widget
> > is an IntegerField.
>
> > 2 - I'm not able to figure out to read the form after it has been
> > posted.
>
> > Can you help me?
>
> > Many thanks
>
> > On 7 Ott, 02:45, FrankW <[EMAIL PROTECTED]> wrote:
>
> > > In your example,
> > > self.fields[str(key)]=forms.CharField(initial=c[key])
> > > isn't doing what you expect.
>
> > > You are setting the initial attribute of a field, not creating
> > > a BoundField. See django/newforms/forms.py, and look at the
> > > comments for BaseForm and Form and the code for
> > > BoundField.
>
> > > On Oct 6, 8:31 am, pinco <[EMAIL PROTECTED]> wrote:
>
> > > > Hi,
>
> > > > I'm trying to figure out how to build a form to display x fields,
> > > > where x is determined at runtime (e.g. a form to update the quantities
> > > > of all the items in a shopping cart).
>
> > > > My model is:
>
> > > > class CartForm(forms.Form):
>
> > > > def __init__(self, c, *args, **kwargs):
> > > > super(CartForm, self).__init__(*args, **kwargs)
> > > >   # c is a dictionary containing cart items
> > > > for key in c.keys():
> > > > 
> > > > self.fields[str(key)]=forms.CharField(initial=c[key])
> > > > return
>
> > > > My view is:
>
> > > > def show_cart(request):
> > > > cart = Cart.objects.get(pk=request.session.get('cart_id', None))
> > > > cart_items = cart.cartitem_set.all() #Just to avoid two hits 
> > > > for the
> > > > same info
> > > > form = CartForm(c=create_cart_dictionary(cart_items))
> > > > return render_to_response('show_cart3.html', {'cart': cart,
> > > > 'num_items': cart.no_items, 'cart_items': cart_items, 'form':form})
>
> > > > def update_quantity(request):
>
> > > > if request.method == 'POST':
> > > > cart = 
> > > > Cart.objects.get(pk=request.session.get('cart_id', None))
> > > > form = CartForm(request.POST)
> > > > #old_quantity =item.quantity
> > > > if form.is_valid():
> > > > for item in cart.cartitem_set.all():
> > > > itemid = item.id
> > > > new_quantity = 
> > > > form.cleaned_data['cart_item' + str(itemid)]
> > > > ... save the new quantities
>
> > > > Create_cart_dictionary is a function that create a dictionary like
> > > > {'item_id': item}.
>
> > > > show_cart() works as expected, since it displays a dynamically
> > > > generated form with fields named by the item.id displayed.
>
> > > > update_quantity() do not works, since form.is_valid() is always false:
>
> > > > >>> form = CartForm({'a': 10, 'b':20})
> > > > >>> form
>
> > > > 

Re: Integrate xmpppy with django

2007-10-11 Thread Jarek Zgoda

This is the simplest (and for me - obvious) way of doing such things.
I see 2 possiblities: either write it as a "long-running", traditional
daemon (if you do not have your own XMPP server) or as Jabber/XMPP
server component. The former is simpler, the later gives you more
flexibility and seems more stable (only one point of failure).
You can always ask assistance on PyXMPP mailing list if you have any
questions, I am sure Jacek Konieczny will help you with Jabber/XMPP
issues.

On 10 Paź, 11:56, est <[EMAIL PROTECTED]> wrote:
> Thank you Christoph.
>
> Yes I have tried a independent daemon, but that's a bit complicated
> for a small site. Is there a simipler way?
>
> Simple is better.
>
> On Oct 10, 5:23 pm, Christoph Rauch <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > est schrieb:> I am writing a GoogleTalk bot for my django site, but I don't 
> > know
> > > were to initiate a xmpppy Client object in Django. Should I put it in
> > > my project's __init__.py ? I need the bot to be always online so where
> > > can I write a GLOBAL, long survival object in Django? How can I make
>
> > I wouldn't put it into __init__.py
>
> > Not knowing xmpppy, this may or may not be simple:
>
> > I would build a seperate daemon and send commands to it from inside
> > your Django project. If you need the other way round, just import the
> > required models in your xmpp client and put some logic there.
>
> > That way you can just fire off commands to the daemon without having
> > to worry about your connection. It's up to the daemon then.
>
> > You can start the daemon completely separate of your webserver/Django
> > project. Just make sure that Django can connect to the daemon, e.g.
> > via unix domain sockets. Domain sockets are great, because you can
> > restrict access to it with basic filesystem rights.
>
> > Christoph


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



utils.text.urlquote returns unicode?

2007-10-11 Thread Thomas Guettler

Hi,

I looked at the source of urlquote:

utils/text.py:

def urlquote(url, safe='/'):
"""
A version of Python's urllib.quote() function that can operate on unicode
strings. The url is first UTF-8 encoded before quoting. The returned string
can safely be used as part of an argument to a subsequent iri_to_uri() call
without double-quoting occurring.
"""
return force_unicode(urllib.quote(smart_str(url)))

1. safe gets ignored. I created a patch:
   http://code.djangoproject.com/ticket/5734

2. why force_unicode()?
  urllib.quote should return a 7 bit ascii string.

 Thomas

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



Re: form_for_model should return TextareaWidget

2007-10-11 Thread Thomas Guettler

Am Mittwoch, 10. Oktober 2007 15:09 schrieb Malcolm Tredinnick:
> On Wed, 2007-10-10 at 14:51 +0200, Thomas Guettler wrote:
> > Hi,
> >
> > How can I get a TextareaWidget with form_for_model()?
> >
> > I have a solution, but it is too much code. You need to create
> > an own DB-Field.
> What you want to do here is, given the particular field of the model,
> replace its default form field with you own version that uses the
> Textarea widget. This means using the formfield_callback parameter to
> form_for_model().

Sorry, I forgot to say that I search for a solution without using 
formfield_callback.

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



Re: problem with ChangeManipulator

2007-10-11 Thread Gio

if I do:

articolo = Articolo.objects.get(codice = c)
print articolo.id

everything goes right, it prints the right number

I'm on Django 0.96, btw

On 11 Ott, 05:38, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Are you sure that articolo is not None or that c is not an int or
> None?
>
> On Oct 10, 12:48 pm, Gio <[EMAIL PROTECTED]> wrote:
>
> > I get this error:
> > unsupported operand type(s) for +: 'NoneType' and 'int'
>
> > referred to this snippet of code, debug informations are pointing to
> > the line where the ChangeManipulator is:
> > -
> > articolo = Articolo.objects.get(codice = c)
> > try:
> > manipulator = Articolo.ChangeManipulator(articolo.id)
> > except Articolo.DoesNotExist:
> > return HttpResponse('{success:false}')
> > -
>
> > Articolo, as defined in models.py
> > -
> > class Articolo(models.Model):
> > codice= models.CharField(maxlength=255, unique=True)
> > descrizione   = models.CharField(maxlength=255)
> > immagine  = models.ImageField(upload_to='uploads')
> > brand = models.ForeignKey(Brand)
> > stagione  = models.ForeignKey(Stagione)
> > prefisso  = models.ForeignKey(Prefisso)
> > colore= models.ForeignKey(Colore)
> > costo_imposto = models.FloatField(null=True)
> > maggiorazione = models.IntegerField()
>
> > def __str__(self):
> > return self.codice
>
> > class Meta:
> > verbose_name_plural = 'articoli'
> > ordering = ['codice']
>
> > class Admin:
> > pass
>
> > def save(self):
> > size = 300, 100
> > try:
> > im = Image.open(self.get_immagine_filename())
> > im.thumbnail(size)
> > im.save(self.get_immagine_filename(), im.format)
> > except:
> > self.immagine = 'none.jpg'
> > super(Articolo, self).save()
>
> > def delete(self):
> > if self.immagine <> 'none.jpg':
> > remove(self.get_immagine_filename())
> > super(Articolo, self).delete()
> > -
>
> > Any idea?
> > tnx


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



Re: TinyMCE in admin

2007-10-11 Thread Jeremy Dunck

On 10/11/07, AniNair <[EMAIL PROTECTED]> wrote:
>
> I am trying to have tinyMCE for flatpages... Should I be using a model
> for that?

Ah, sorry, I missed that.

Did you follow these steps?
http://code.djangoproject.com/wiki/AddWYSIWYGEditor#UsingTinyMCEwithflatpages

If so, you've just got your src attribute for your script tags wrong.

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



Re: TinyMCE in admin

2007-10-11 Thread AniNair

I am trying to have tinyMCE for flatpages... Should I be using a model
for that?


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