Re: Data representation question

2008-06-23 Thread Adi

I figured it out after going through the django source.. gotta create
a subclass of MultiValueField and MultiWidget and then use em
together.

By the way.. django kicks is AWESOME. the best piece of code i have
seen..
The django developers kick ASS!!

On Jun 23, 9:23 pm, Adi <[EMAIL PROTECTED]> wrote:
> What is the best way of of implementing a form field that is comprised
> of multiple text fields.. lets say.. i want to capture the time that
> an athlete took to run a marathon. I'd want the user to be able to
> enter the hour, minute, seconds and milliseconds in separate fields..
>
> Other ideas of represeting such information on the webpage as well as
> store in the databse are welcome.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



edit_inline and field order

2008-06-23 Thread Wanrong Lin

Hi,

I have a few models with "edit_inline=models.STACKED". How can I control 
the field order of those models in the administration form? Even with

class Admin:
fields = ()

it won't work. Plus, the above will expose those models individually in 
the administration form.

Can someone please show me the right way to do it? Thank you very much.

Wanrong



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: dynamic value of a ModelChoiceField

2008-06-23 Thread [EMAIL PROTECTED]

thanks rishabh,

i tried that -- it doesnt display the 'selected' cooking method for
the recipe. shows the value corresponding to empty_label.

thnx,
-p

On Jun 24, 12:23 am, "Rishabh Manocha" <[EMAIL PROTECTED]> wrote:
> You're probably looking 
> forhttp://www.djangoproject.com/documentation/newforms/#initial
>
> Best,
>
> Rishabh
>
> On Tue, Jun 24, 2008 at 9:04 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> > I probably need to be more specific..
>
> > here's my model:
>
> > class Recipe(modesl.Model):
>
> >   recipetitle = models.CharField()
> >   cooking_method = models.ForeignKey(CookingMethod)
>
> > class CookingMethod(models.Model):
>
> >   cookmethodname = models.CharField()
>
> > forms.py
>
> >  class RecipeForm(forms.Form):
>
> >        title = forms.CharField()
> >        cookmethod =
> > forms.ModelChoiceField(queryset=CookingMethod.objects.all())
>
> > views.py
>
> >   def edit_recipe(request,recipe_id):
>
> >     if request.method == "POST":
> >        yadda yadda
>
> >    else:
> >           recipe = Recipe.objects.get(id=recipe_id)
> >           recipeform = RecipeForm()
> >           recipeform.fields['title'] = recipe.recipetitle
> >           recipeform.fields['cooking_method'] = recipe.cooking_method
>
> > When a new recipe is created, all the different cooking methods
> > correctly show up in the recipe form as a  html element
> > (corresponding to the ModelChoice field in the form).
>
> > However, when an existing recipe is being edited, the recipe title is
> > retrieved correctly, but the corresponding recipe cooking method is
> > not displayed in the  html element. instead, the one
> > corresponding to the empty label (--) shows up.
>
> > Any ideas ? I'm losing my mind over this.
>
> > thanks in advance.
>
> > On Jun 22, 11:15 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> > > In a form, I have a field defined asModelChoiceField
>
> > > class myForm(forms.Form)
> > >   myfield = forms.ModelChoiceField(MyClass.objects.all())
> > >  myfield2 = forms.CharField()
>
> > > My problem is that I cant seem to dynamically set the value that the
> > > user selected for this field. When ever, user edits the record, this
> > > select list always gets set to no value instead of the value that the
> > > user had originally selected.
>
> > > the input text field has no problems in showing the saved data
> > > correctly.
>
> > > am I missing something ?
>
> > > thnx,
> > > -p
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 do I include a link in the emails that I send out?

2008-06-23 Thread Jonas Oberschweiber

Hi,

as far as I know you have to set the correct MIME-type in your
subject. This Wikipedia article should be a good start:
http://en.wikipedia.org/wiki/MIME

On Tue, Jun 24, 2008 at 3:51 AM, Greg <[EMAIL PROTECTED]> wrote:
>
> Hello,
> I have the following line in my code:
>
> message = "This is my email" + a.name + "Here is the link  href=http://mysite.com>Click Here"
> send_mail('My Subject', message, '[EMAIL PROTECTED]', ['[EMAIL PROTECTED]'],
> fail_silently=False)
>
> 
>
> Whenever I receive this email it's not a linkit's just regular
> text.  I see the  make this appear as an link in my email?
>
> 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: dynamic value of a ModelChoiceField

2008-06-23 Thread Rishabh Manocha
You're probably looking for
http://www.djangoproject.com/documentation/newforms/#initial

Best,

Rishabh

On Tue, Jun 24, 2008 at 9:04 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

>
> I probably need to be more specific..
>
> here's my model:
>
> class Recipe(modesl.Model):
>
>   recipetitle = models.CharField()
>   cooking_method = models.ForeignKey(CookingMethod)
>
> class CookingMethod(models.Model):
>
>   cookmethodname = models.CharField()
>
>
> forms.py
>
>  class RecipeForm(forms.Form):
>
>title = forms.CharField()
>cookmethod =
> forms.ModelChoiceField(queryset=CookingMethod.objects.all())
>
> views.py
>
>   def edit_recipe(request,recipe_id):
>
> if request.method == "POST":
>yadda yadda
>
>else:
>   recipe = Recipe.objects.get(id=recipe_id)
>   recipeform = RecipeForm()
>   recipeform.fields['title'] = recipe.recipetitle
>   recipeform.fields['cooking_method'] = recipe.cooking_method
>
>
> When a new recipe is created, all the different cooking methods
> correctly show up in the recipe form as a  html element
> (corresponding to the ModelChoice field in the form).
>
> However, when an existing recipe is being edited, the recipe title is
> retrieved correctly, but the corresponding recipe cooking method is
> not displayed in the  html element. instead, the one
> corresponding to the empty label (--) shows up.
>
> Any ideas ? I'm losing my mind over this.
>
> thanks in advance.
>
>
> On Jun 22, 11:15 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> > In a form, I have a field defined asModelChoiceField
> >
> > class myForm(forms.Form)
> >   myfield = forms.ModelChoiceField(MyClass.objects.all())
> >  myfield2 = forms.CharField()
> >
> > My problem is that I cant seem to dynamically set the value that the
> > user selected for this field. When ever, user edits the record, this
> > select list always gets set to no value instead of the value that the
> > user had originally selected.
> >
> > the input text field has no problems in showing the saved data
> > correctly.
> >
> > am I missing something ?
> >
> > thnx,
> > -p
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 filters to the Users List/Page in the admin app

2008-06-23 Thread Rishabh Manocha
Ok, so I need a bit more direction here. I've got newforms-admin setup and
working as far as displaying the various FK relationships a user has on
his/her page. However, I'm still not able to figure out how to display FK
relationships in the list_filter page. Here is my setup (the UserTechSkill
from above has not changed, except for the admin stuff):

Note: I haven't copied and pasted here - don't have my work laptop with me
right now - so there might be some typos, but the logic is the same.

in models.py:

from django.contrib.auth.admin import UserAdmin

...

class MyUserAdmin(UserAdmin):
inlines = [UserTechSkillsAdmin,...]
list_filter = ('is_staff',)

admin.site.unregister(User)
admin.site.register(User,MyUserAdmin)

Now what I would like to be able to do is be able to add a TechSkillsList
filter to the list_filter tuple. I figure that since a user is related to
the UserTechSkill class and a UserTechSkill class is related to the
TechSkillsList class, there must be some way I can get a list of
TechSkillsList in the User class (a list of TechSkillsList which includes
skills chosen by all users, but not the ones that haven't been selected by
anyone yet). Can someone point me in the right direction here??

Best,

Rishabh

On Thu, Jun 12, 2008 at 7:00 PM, Rajesh Dhawan <[EMAIL PROTECTED]>
wrote:

>
> Hi Rishabh,
>
> >
> > Now, the django admin app provides (by default) a page where user details
> > are listed. I do not want to change that list. However, I would like to
> add
> > filters on that page (remove the superuser status and staff status
> filters
> > and add others like TechSkillsList etc.). I was wondering if this were
> > possible, and if so, how. I am using a (somewhat out of date) trunk
> checkout
> > of the djago code. If this is not possible in the current admin, is it
> > possible using newforms-admin??
>
> Yes, newsforms-admin will let you create an admin area for the
> auth.User model using your own admin options (list filters, search,
> etc.) It's worth switching to that branch and trying this out.
>
> http://code.djangoproject.com/wiki/NewformsAdminBranch
> http://code.djangoproject.com/wiki/NewformsHOWTO
>
> -Rajesh D
>
>
> >
>

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



Re: Django - Apache - mod_python setup

2008-06-23 Thread Karen Tracey
On Mon, Jun 23, 2008 at 7:38 PM, Nagu <[EMAIL PROTECTED]> wrote:

>
> Hi,
>
> I am very new to programming in general. I start to teach myself some
> python and django stuff.
>
> I followed the instructions in the chapter 3 of the book Professional
> Python Frameworks by Moore, Budd, and Wright. Just to give some idea,
> it is a simple pet owner site, select the owner and it displays their
> pets in the browser.
>
> It is working fine from a localhost, i.e. when I type
> http://127.0.0.1:8000/petview.
> Now I want to set it up on a local area network so that I can access
> it from other machine, for example, http://cobra.mycompany.com/petview.
> Here Cobra is the my machine name and mycompany.com is my company
> domain. I do not have access to tinker with mycompany.com. Cobra is a
> windows xp machine attached to the mycompany.com
>
> I installed postgresSQL and Apache and mod_python on the machine
> cobra. Apache is running OK by default. I ran http://cobra.mycompany.com
> from another machine, and it displays OK. But when I type
> http://cobra.mycompany.com/petview, I get a 404. I am sure that I am
> doing wrong. I want to learn how to set this kind of settings. Please
> advice.
>

Did you follow the instructions here:

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

for how to configure Apache/mod_python to forward requests to your Django
code?

Karen

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



Re: dynamic value of a ModelChoiceField

2008-06-23 Thread [EMAIL PROTECTED]

I probably need to be more specific..

here's my model:

class Recipe(modesl.Model):

   recipetitle = models.CharField()
   cooking_method = models.ForeignKey(CookingMethod)

class CookingMethod(models.Model):

   cookmethodname = models.CharField()


forms.py

  class RecipeForm(forms.Form):

title = forms.CharField()
cookmethod =
forms.ModelChoiceField(queryset=CookingMethod.objects.all())

views.py

   def edit_recipe(request,recipe_id):

 if request.method == "POST":
yadda yadda

else:
   recipe = Recipe.objects.get(id=recipe_id)
   recipeform = RecipeForm()
   recipeform.fields['title'] = recipe.recipetitle
   recipeform.fields['cooking_method'] = recipe.cooking_method


When a new recipe is created, all the different cooking methods
correctly show up in the recipe form as a  html element
(corresponding to the ModelChoice field in the form).

However, when an existing recipe is being edited, the recipe title is
retrieved correctly, but the corresponding recipe cooking method is
not displayed in the  html element. instead, the one
corresponding to the empty label (--) shows up.

Any ideas ? I'm losing my mind over this.

thanks in advance.


On Jun 22, 11:15 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> In a form, I have a field defined asModelChoiceField
>
> class myForm(forms.Form)
>   myfield = forms.ModelChoiceField(MyClass.objects.all())
>  myfield2 = forms.CharField()
>
> My problem is that I cant seem to dynamically set the value that the
> user selected for this field. When ever, user edits the record, this
> select list always gets set to no value instead of the value that the
> user had originally selected.
>
> the input text field has no problems in showing the saved data
> correctly.
>
> am I missing something ?
>
> thnx,
> -p
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Overriding the JOIN type in contrib.admin's search forms?

2008-06-23 Thread Karen Tracey
On Mon, Jun 23, 2008 at 4:01 PM, Paul Winkler <[EMAIL PROTECTED]> wrote:

> Nobody cares?
> To me this seems like a significant bug in contrib.admin ...  okay I'm
> filing it as such:
> http://code.djangoproject.com/ticket/7528
>

It's a leap from no response to nobody cares.  Remember people on this list
are doing so primarily in their spare time.  So your report could just have
come at a bad time when people didn't have the extra time to devote to it.

One thing, though, which may have made a lot of people pass over it is that
you are reporting a problem with they way queries are constructed on 0.96.
Since 0.96 was released the guts of the query-construction logic inside
Django has been completely rewritten.  (You've probably seen this referenced
on this list -- the 'queryset-refactor' branch that was merged back into the
SVN trunk a couple of months ago.)  It's quite possible that the problem you
are reporting was fixed as a result of that major change.

Can you try your scenario on current trunk?  You'll probably get more
interest in a problem reported against trunk than 0.96.  Certainly any fix
made for the problem will only become available in a trunk checkout and then
in 1.0; the only fixes made to 0.96 are security related.

Karen

>
> On Jun 17, 2:08 pm, Paul Winkler <[EMAIL PROTECTED]> wrote:
> > Bear with me, I'm a Django novice, still reading docs...
> >
> > I'm trying to build my first app using django admin (release 0.96),
> > because it's a good match to the requirements (a quick and simple CRUD
> > application).
> >
> > I found a thread from last yearhttp://
> groups.google.com/group/django-users/browse_thread/thread/b086...
> > where the last post describes the same problem I'm having, but there
> > were no further replies.
> >
> > All was coming along nicely until I started using 'the lookup API
> > "follow" notation' to get a foreign key into my search_fields, like
> > this:
> >
> > class FilmClip(models.Model):
> > ...
> > class Admin:
> > ...
> > search_fields = ('clip_id', 'label', 'description',
> >  'filmcliplog__description'   # This is the
> > line that causes problems
> >  )
> >
> > class FilmClipLog(models.Model):
> > clip = models.ForeignKey(FilmClip,
> >  edit_inline=models.TABULAR,
> >  num_in_admin=3)
> > ...
> >
> > There are two problems with the resulting behavior:
> > 1) Any matching FilmClip thas has at least one FilmClipLog will show
> > up in the results twice.
> > 2) Any matching FilmClip that has no FilmClipLogs will not show up at
> > all.
> >
> > From the mysql query log, I've found that the query looks like:
> >
> >   SELECT ... FROM `filmy_filmclip` INNER JOIN `filmy_filmcliplog` ...
> >
> > But what I want is this:
> >
> >   SELECT DISTINCT ... FROM `filmy_filmclip` LEFT OUTER JOIN
> > `filmy_filmcliplog` ...
> >
> > So, my questions:
> >
> > 1) Is this a Django bug? When would the existing behavior be
> > desirable?
> >
> > 2) Is there a way to specify the type of join in the search query?
> >
> > 3) Is there a way to add DISTINCT to the search query?
> >
> > 4) If no, what's the quickest way to get the behavior I want?
> >
> > Thanks,
> >
> > - PW
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Data representation question

2008-06-23 Thread Adi

What is the best way of of implementing a form field that is comprised
of multiple text fields.. lets say.. i want to capture the time that
an athlete took to run a marathon. I'd want the user to be able to
enter the hour, minute, seconds and milliseconds in separate fields..

Other ideas of represeting such information on the webpage as well as
store in the databse are welcome.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Another question about form validation?

2008-06-23 Thread Adi

Thanks everyone.

On Jun 23, 1:43 pm, phillc <[EMAIL PROTECTED]> wrote:
> class FormFoo(ModelForm):
>   def __init__(self, obj1, *args, **kwargs):
>     super(FormFoo, self).__init__(*args, **kwargs)
>     self.object1 = obj1
>   def clean(self):
>     # use self.object1 here
>
> On Jun 23, 12:23 pm, Adi <[EMAIL PROTECTED]> wrote:
>
>
>
> > do you mean something like this.
>
> > class FormFoo(ModelForm):
>
> >         def __init__(self,*args,**kwargs):
> >                    self.object1 = kwargs.pop('obj1')
>
> >         def clean(self):
> >                   # use the self.object1 here
>
> > 
>
> > On Jun 23, 10:48 am, Alex Koshelev <[EMAIL PROTECTED]> wrote:
>
> > > Pass it through form custom constructor
>
> > > On Jun 23, 7:12 pm, Adi <[EMAIL PROTECTED]> wrote:
>
> > > > How do you pass model objects that you may need access to when
> > > > implementing the clean() or clean_ methods?
>
> > > > In other words, how can a form access model objects that it may need
> > > > access to perform its validation?- 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
-~--~~~~--~~--~--~---



Basic CRUD form with navigation layout

2008-06-23 Thread Leandro Severino

Hi Djangers,

   This is my first post and sorry by my terrible english.

   Well,
  My customer needs a page with this layout:

 [div id="toolbar"]
 NEW - SAVE - DELETE - SEARCH - <<(previous) - >>(next) -
PRINT  ( elements)
 [/div]

 [div id="content"]
  The forms fields, for example:

   [label]Description: [/label]  [input type='text'
id='description']
 [/div]

 [div id="statusPanel"]
Record 01 of 20 records.
 [/div]

This page is a basic crud in the style 'all-in-one', because all
operations are in the same page and if I remember... this is the style
of Oracle-Forms applications (with a toolbar and navigations buttons)

Then, my question is:
- How to resolve this problem, what is the best approach or
the best solution to this situation ?





--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 do I include a link in the emails that I send out?

2008-06-23 Thread Greg

Hello,
I have the following line in my code:

message = "This is my email" + a.name + "Here is the link http://mysite.com>Click Here"
send_mail('My Subject', message, '[EMAIL PROTECTED]', ['[EMAIL PROTECTED]'],
fail_silently=False)



Whenever I receive this email it's not a linkit's just regular
text.  I see the http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



feeds and get_object()

2008-06-23 Thread Eric Montgomery

I'm using the syndication framework to generate feeds for my blogging
app, and everything is working fine so far.  I have multiple blogs
each with their own feeds, but I would like to add a combined feed.
The documentation seems to mention that this is possible, but it
doesn't provide an example and I'm not sure what's the best way to
implement it.
Here is the documentation code, which I pretty much directly copied:

class BeatFeed(Feed):
def get_object(self, bits):
# In case of "/rss/beats/0613/foo/bar/baz/", or other such
clutter,
# check that bits has only one member.
if len(bits) != 1:
raise ObjectDoesNotExist
return Beat.objects.get(beat__exact=bits[0])

In this case, if len(bits) is not 1, then ObjectDoesNotExist is raised
(this would correspond to the url "domain.com/rss/beats/").
I would like to generate a combined feed from all of my blogs, but the
only way I can seem to do this is to have get_object() return None,
and then check if obj is None in each of my title(), description(),
link() and items() methods in order to handle the special case.  It
seems to work, but doesn't feel ideal.  If anyone knows a better way
to do this, I'd love to know it.

Thanks,
Eric
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: User Profile in Admin interface (using trunk)

2008-06-23 Thread [EMAIL PROTECTED]

I am doing this in newforms-admin. As far as I cannot tell, you cannot
do this using the default root site, because the inline is diclared in
the parent model rather than the child model. The User creates and
registers with the default admin site on it's own, so you have to
declare your own AdminSite, subclass the
django.contrib.auth.admin.UserAdmin, and register Usey and your
subclassed object with your custom Adminsite object.

It works really well once I set it up.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: sending large downloads

2008-06-23 Thread Michael P. Soulier
Russell Keith-Magee wrote:
> Apologies for the misdirection.

So perhaps a feature request is needed then? A simple way to hijack the
response to have full control over said response would be sufficient. We
certainly can't assume that putting all responses through the entire
Django stack is always desirable. Sometimes you just need more flexibility.

I suppose that piece of code could be a simple Python CGI, but having to
break out of the framework indicates a deficiency there.

I wonder if I could pull this off with a custom HttpResponse subclass.

Mike
-- 
Michael P. Soulier <[EMAIL PROTECTED]>
"Any intelligent fool can make things bigger and more complex... It
takes a touch of genius - and a lot of courage to move in the opposite
direction." --Albert Einstein



signature.asc
Description: OpenPGP digital signature


Django - Apache - mod_python setup

2008-06-23 Thread Nagu

Hi,

I am very new to programming in general. I start to teach myself some
python and django stuff.

I followed the instructions in the chapter 3 of the book Professional
Python Frameworks by Moore, Budd, and Wright. Just to give some idea,
it is a simple pet owner site, select the owner and it displays their
pets in the browser.

It is working fine from a localhost, i.e. when I type 
http://127.0.0.1:8000/petview.
Now I want to set it up on a local area network so that I can access
it from other machine, for example, http://cobra.mycompany.com/petview.
Here Cobra is the my machine name and mycompany.com is my company
domain. I do not have access to tinker with mycompany.com. Cobra is a
windows xp machine attached to the mycompany.com

I installed postgresSQL and Apache and mod_python on the machine
cobra. Apache is running OK by default. I ran http://cobra.mycompany.com
from another machine, and it displays OK. But when I type
http://cobra.mycompany.com/petview, I get a 404. I am sure that I am
doing wrong. I want to learn how to set this kind of settings. Please
advice.

Thank you,
Nagu

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 best to delete one of multiple records?

2008-06-23 Thread Arien

On Mon, Jun 23, 2008 at 1:51 PM, Peter Melvyn <[EMAIL PROTECTED]> wrote:
>
> On 6/23/08, Emil Styrke <[EMAIL PROTECTED]> wrote:
>
>> Having a GET request delete records is usually a bad idea - see for example
>> http://www.w3.org/2001/tag/doc/whenToUseGet.html
>
> Yes, this is a recommendation, not a dogma. IMHO GET method is
> suitable for dense tables with dozens of operations.

Whether it's a good idea to use GET or not doesn't depend on
presentation issues.


Arien

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: sending large downloads

2008-06-23 Thread Russell Keith-Magee

On Tue, Jun 24, 2008 at 6:46 AM, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
>
> Russell, #2070 refers to uploads, not downloads.

Bah! You are correct.

That's what happens when I try to answer email before my morning coffee. :-)

Apologies for the misdirection.

Russ %-)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: sending large downloads

2008-06-23 Thread [EMAIL PROTECTED]

Russell, #2070 refers to uploads, not downloads.

On Jun 23, 5:38 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On Tue, Jun 24, 2008 at 1:42 AM, msoulier <[EMAIL PROTECTED]> wrote:
>
> > Hello,
>
> > I saw some posts on this but not many useful responses. Apologies if
> > there's already a known solution.
>
> > For a web-based backup, I need to send a large file, basically the
> > output of a tar process, to the browser. We have legacy Perl code
> > doing this now but I'd like to use Django. Is there a way to stream
> > this without reading the entire file into memory and writing it into
> > the HttpResponse object?
>
> This is an open ticket: #2070. This ticket has a patch which has been
> in development for a while. I can't comment on the current readiness
> of the patch, but the feature is listed as an optional feature for
> v1.0.
>
> 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: sending large downloads

2008-06-23 Thread Russell Keith-Magee

On Tue, Jun 24, 2008 at 1:42 AM, msoulier <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> I saw some posts on this but not many useful responses. Apologies if
> there's already a known solution.
>
> For a web-based backup, I need to send a large file, basically the
> output of a tar process, to the browser. We have legacy Perl code
> doing this now but I'd like to use Django. Is there a way to stream
> this without reading the entire file into memory and writing it into
> the HttpResponse object?

This is an open ticket: #2070. This ticket has a patch which has been
in development for a while. I can't comment on the current readiness
of the patch, but the feature is listed as an optional feature for
v1.0.

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: Add db tables on-the-fly

2008-06-23 Thread Michael P. Soulier
MickaelC wrote:
> It is not really a problem
> It's for a multi user app. For each new users, i create a serie table
> or all data in the same table?
> If it's easy to create table on-the-fly when a new user registers, i
> prefere.
> 
> but I do not see how

If you must, that is what raw SQL is for.

Mike



signature.asc
Description: OpenPGP digital signature


Re: FlatPageSitemap broken?

2008-06-23 Thread Adam Woodbeck

I apologize. The problem is solved.

On Jun 23, 3:09 pm, Adam Woodbeck <[EMAIL PROTECTED]> wrote:
> I'm in the process of setting up a sitemap for our website.  I've
> successfully used GenericSitemap to add our blog posts to the
> sitemap.  However, I'm running into problems getting FlatPageSitemap
> to work correctly.  I keep getting the error, "'Site' object has no
> attribute 'flatpage_set'."
>
> I opened a django shell and created a Site object using the code in
> the FlatPageSitemap class.  A dir() on the Site object showed that it
> truly doesn't have a flatpage_set() attribute.  In fact, I grepped all
> of the django source code and the only place "flatpage_set" is
> referenced is in the FlatPageSitemap class in django/contrib/sitemaps/
> __init__.py.
>
> Am I missing something here or is this a bug?  BTW, I'm using the
> latest django source.
>
> 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: Getting the name of a class

2008-06-23 Thread Dan Lazewatsky

I just tried this out from the shell - for me __class__ returns the name 
of the class, not the parent class. If you want just the name and not 
all the other junk that goes with it, you can use obj.__class__.__name__.

-Dan

mwebs wrote:
> Hi,
>
> thanks for your answer but I already tried this and it returns
> something like this: 
>
> But I only need the Name of the class. And it seems that __class__
> returns the parent class of my model...
>
> is there any other way?
> >   

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



Re: Overriding the JOIN type in contrib.admin's search forms?

2008-06-23 Thread Paul Winkler

Nobody cares?
To me this seems like a significant bug in contrib.admin ...  okay I'm
filing it as such:
http://code.djangoproject.com/ticket/7528

- PW

On Jun 17, 2:08 pm, Paul Winkler <[EMAIL PROTECTED]> wrote:
> Bear with me, I'm a Django novice, still reading docs...
>
> I'm trying to build my first app using django admin (release 0.96),
> because it's a good match to the requirements (a quick and simple CRUD
> application).
>
> I found a thread from last 
> yearhttp://groups.google.com/group/django-users/browse_thread/thread/b086...
> where the last post describes the same problem I'm having, but there
> were no further replies.
>
> All was coming along nicely until I started using 'the lookup API
> “follow” notation' to get a foreign key into my search_fields, like
> this:
>
> class FilmClip(models.Model):
> ...
> class Admin:
> ...
> search_fields = ('clip_id', 'label', 'description',
>  'filmcliplog__description'   # This is the
> line that causes problems
>  )
>
> class FilmClipLog(models.Model):
> clip = models.ForeignKey(FilmClip,
>  edit_inline=models.TABULAR,
>  num_in_admin=3)
> ...
>
> There are two problems with the resulting behavior:
> 1) Any matching FilmClip thas has at least one FilmClipLog will show
> up in the results twice.
> 2) Any matching FilmClip that has no FilmClipLogs will not show up at
> all.
>
> From the mysql query log, I've found that the query looks like:
>
>   SELECT ... FROM `filmy_filmclip` INNER JOIN `filmy_filmcliplog` ...
>
> But what I want is this:
>
>   SELECT DISTINCT ... FROM `filmy_filmclip` LEFT OUTER JOIN
> `filmy_filmcliplog` ...
>
> So, my questions:
>
> 1) Is this a Django bug? When would the existing behavior be
> desirable?
>
> 2) Is there a way to specify the type of join in the search query?
>
> 3) Is there a way to add DISTINCT to the search query?
>
> 4) If no, what's the quickest way to get the behavior I want?
>
> Thanks,
>
> - PW
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Getting the name of a class

2008-06-23 Thread mwebs

Hi,

thanks for your answer but I already tried this and it returns
something like this: 

But I only need the Name of the class. And it seems that __class__
returns the parent class of my model...

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



Re: Getting the name of a class

2008-06-23 Thread Rodolpho Eckhardt

You probably want obj.__class__

On Mon, June 23, 2008 4:47 pm, mwebs wrote:
>
> I have an object that represents a modelClass.
>
> when I do print(obj) then I obviously get something like this:  'package.ModelName'>
>
> Is there a way to retrieve only the name of the model?
>
> Thanks, Toni
> >
>


-- 
Rodolpho Eckhardt
<[EMAIL PROTECTED]>
http://rodolpho.eckhardt.com.br/
(11) 83709223


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Getting the name of a class

2008-06-23 Thread mwebs

I have an object that represents a modelClass.

when I do print(obj) then I obviously get something like this: 

Is there a way to retrieve only the name of the model?

Thanks, Toni
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Getting the name of a class

2008-06-23 Thread mwebs

I have an object that represents a modelClass.

when I do print(obj) then I obviously get something like this: 

Is there a way to retrieve only the name of the model?

Thanks, Toni
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



FlatPageSitemap broken?

2008-06-23 Thread Adam Woodbeck

I'm in the process of setting up a sitemap for our website.  I've
successfully used GenericSitemap to add our blog posts to the
sitemap.  However, I'm running into problems getting FlatPageSitemap
to work correctly.  I keep getting the error, "'Site' object has no
attribute 'flatpage_set'."

I opened a django shell and created a Site object using the code in
the FlatPageSitemap class.  A dir() on the Site object showed that it
truly doesn't have a flatpage_set() attribute.  In fact, I grepped all
of the django source code and the only place "flatpage_set" is
referenced is in the FlatPageSitemap class in django/contrib/sitemaps/
__init__.py.

Am I missing something here or is this a bug?  BTW, I'm using the
latest django source.

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: Multiple fields without manytomanyfield?

2008-06-23 Thread Richard Dahl
I am a bit confused, are you looking for this:

class IntegerRelation(models.Model):
content = models.IntegerField()

class A(models.Model):
integers = models.ManyToManyField(IntegerRelation)

-richard



On 6/22/08, Xan <[EMAIL PROTECTED]> wrote:
>
>
> Hi,
>
> Suposing you want a model A with several and indetermined number of
> integer fields. Is there any possibility of defining A without
> creating a Integer class and then add ManyToManyField(Integer) in
> class A?
>
> Thanks a lot!
> Xan.
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: media server implementation - context processor, custom template tag, or custom filter

2008-06-23 Thread phillc

that is an extremely complex problem for such small problem...

if you are worried about caching, just append a number to the file or
add a date to it.

On Jun 22, 6:48 pm, alex <[EMAIL PROTECTED]> wrote:
> I already have {{ MEDIA_URL }} set in html, css, and js templates and
> that's working great. I would like to start setting far future caching
> headers on media files based on the git abbreviated commit hash for
> each file. i can think of three options for implementing this and
> would appreciate feedback, especially in regard to the processing or
> performance penalties any of these approaches may incur. i've
> implemented proof-of-concept versions of all of them in development
> and they at least accomplish what I want, though I haven't yet done
> any benchmarking.
>
> as part of the production deployment process, a script is run which
> essentially does the following: for every static media file, find the
> git abbreviated commit hash which looks like "857vb4". the results are
> written to disk as a python dictionary:
>
> STATIC_ASSETS = {
>     "/media/image/button.png": "/857vb4",
>     "/media/image/submit.png": "/219cb3",
>     etc.
>
> }
>
> the dictionary has approx 100 entries and may grow to 200.
>
> all of the approaches below generate html like this:
>
> http://media.example.com/857vb4/media/image/button.png;>
> http://media.example.com/219cb3/media/image/submit.png;>
>
> but the actual paths on disk do not include version numbers. apache
> has a re-write rule which removes the revision information, so that
> clients can be told to cache the static files for a long time into the
> future because whenever the file changes, the revision number in the
> url will change. here are some ways i've come up with for adding the
> revision info to the static file urls.
>
> 1) simple string filter
> templates look like this: 
> and the template filter is approx:
>
> @register.filter
> @stringfilter
> def get_file_version(value, arg):
>     if arg in STATIC_ASSETS:
>         value = STATIC_ASSETS[arg] + arg;
>     else:
>         value = arg;
>     return value
>
> 2) simple custom template tag
> templates look like:  media/image/button.png" %}">
>
> template tag code:
>
> @register.simple_tag
> def get_file_version(arg):
>     value = arg
>     if arg in ASSET_LIST:
>         value = ASSET_LIST[arg] + arg;
>     return value
>
> The third option would be a custom context processor which adds
> template variables to each page that are tied to the filename.
>
> Are these approaches reasonable or do they incur too much processing
> for, say, a page that has 10 or 20 static files (images, js, css)? Is
> there a better way I'm overlooking? I'm trying to avoid approaches
> which rename files on disk or do find-and-replace operations on
> template files.
>
> Any feedback appreciated.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Help with mod_python and dynamic vhosts

2008-06-23 Thread phillc

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

On Jun 22, 7:34 pm, "Brian Ritchie" <[EMAIL PROTECTED]> wrote:
> Hello all,
>
> My first post to this mailing list.  I didn't see this in the archive.  It
> this was covered before, sorry about that.
>
> I have a webserver (Ubuntu, Apache2) with dynaminc vhosts setup. I'm
> experimenting with django a bit and I tried to setup the byteflow blog by
> adding a subdomain ofhttp://blog.mysite.com(note: not the real URL :P).  I
> followed the instructions shown here...
>
> http://blog.leschinsky.in.ua/2008/02/05/byteflow-installation/http://blog.leschinsky.in.ua/2008/02/05/byteflow-setup/
>
> Installation went smoothly but the apache2 setup isn't right. Those
> isntructions are meant for a more simple apache2 setup. I'm not the most
> knowledgeable when it comes to setting up Apache2 vhosts (using the
> sites_available and sites_enabled directories), so I can't get it to work. I
> had some fellow programmers help me but they were not familiar with this
> type of apache2 setup either. Here is the basic byteflow config that I
> used...
>
> NameVirtualHost *:80
> 
>    ServerAdmin [EMAIL PROTECTED]
>    ServerName blog.mysite.com
>
>     
>               SetHandler python-program
>               PythonHandler django.core.handlers.modpython
>               SetEnv DJANGO_SETTINGS_MODULE settings
>               PythonDebug On
>               PythonPath "['/home/me/django-src/byteflow' ] + sys.path"
>         
>
>     Alias /static/ /home/me/django-src/byteflow/static/
>     
>               SetHandler None
>     
>
>     Alias /admin-media/
> /home/me/django-src/django_trunk/django/contrib/admin/media/
>         
>                   SetHandler None
>         
>
>         ErrorLog /var/log/apache2/byteflow.log
>         LogLevel warn
>         CustomLog /var/log/apache2/byteflow.log combined
>  
>
> That *almost* works. Under certain variations of this configuration, I can
> see the blog and I know that the blog is functional. The problem is that
> this config causes all of my dynamic vhost domains to display the blog
> (eek!). I've tried variations of this where I placed my full URL
> blog.mysite.com:80 for the NameVirtualHost and VirtualHost lines, including
> removing NameVirtualHost from this config. It seems that I can get either
> one of two results. I can get the blog to appear on all of my sites or I can
> get the blog.mysite.com to point to /www/blog.mysite.com/ (which is blank)
> like the rest of my dynamic vhosts.
>
> My dynamic_vhosts config has this...
>
> 
>         Options Indexes FollowSymLinks MultiViews
>         DirectoryIndex index index.html index.php index.phtml
>
>         AllowOverride All
>         Order allow,deny
>         Allow from all
>
> 
>  #the IP of my server
> # Get servername from Host: header
> UseCanonicalName Off
>
> # this log format can be split per-virtual-host based on the first field
> LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
> LogFormat "%V %h %l %u %t \"%r\" %>s %b \"%{Referer}i\"\"%{User-Agent}i\""
> vcombined
> CustomLog /var/log/apache2/access_vhost_log vcombined
>
> #
> # include the server name in the filenames used to satisfy requests
> VirtualDocumentRoot /www/%0/public_html
> VirtualScriptAlias  /www/%0/cgi-bin
> #
> #   This configuration can be changed into an IP-based virtual hosting
> #   solution by just turning UseCanonicalName Off into UseCanonicalName DNS.
> #   The server name that is inserted into the filename is then derived from
> #   the IP address of the virtual host.
> 
>
> So I'm looking for a mix of dynamic vhosts for all of my domains except one
> select vhost that gets handled by mod_python.
> Any insight would be helpful.  Thanks.
>
> 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
-~--~~~~--~~--~--~---



Re: Multiple fields without manytomanyfield?

2008-06-23 Thread phillc

how about a one to many?


On Jun 22, 8:03 am, Xan <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Suposing you want a model A with several and indetermined number of
> integer fields. Is there any possibility of defining A without
> creating a Integer class and then add ManyToManyField(Integer) in
> class A?
>
> Thanks a lot!
> Xan.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Struggling with Django/legacy data

2008-06-23 Thread skins96

OK. I've seen both those sections --- so Django doesn't expect a
foreign key to be an integer? For some reason, I thought Django would
expect an integer even if you used the to_field argument when you used
foreign key.

On Jun 23, 1:44 pm, "Norman Harman" <[EMAIL PROTECTED]> wrote:
> skins96 wrote:
> > Hi,
>
> > I'm a noob who is struggling with understanding how Django might work
> > with legacy data.
>
> > It seems Django's foreign keys rely on having an integer in both the
> > parent and child table. However, we get a lot of data where what's
> > needed is a join based on characters. For instance, "wht" in the
> > parent table would correspond to "wht" in the child table, which then
> > has a description field that might have, say, "white" in this
> > instance.
>
> > I've looked through tons of documentation, both the Sam's book and the
> > DjangoBook, but can't seem to find anything that addresses this. I've
> > also tried to look through the archives. Can anyone offer advice?
>
> > I guess to be more to the point, I'm trying to figure out how to
> > address it in the model (or if it should even be handled in the
> > view).
>
> http://www.djangoproject.com/documentation/model-api/#automatic-prima...
>
> If you’d like to specify a custom primary key, just specify
> primary_key=True on one of your fields.
>
> http://www.djangoproject.com/documentation/model-api/#relationships
>
> to_field        The field on the related object that the relation is to. By
> default, Django uses the primary key of the related object.
> --
> Norman J. Harman Jr.
> Senior Web Specialist, Austin American-Statesman
> ___
> You've got fun!  Check out Austin360.com for all the entertainment
> info you need to live it up in the big city!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 best to delete one of multiple records?

2008-06-23 Thread Peter Melvyn

On 6/23/08, Emil Styrke <[EMAIL PROTECTED]> wrote:

> Having a GET request delete records is usually a bad idea - see for example
> http://www.w3.org/2001/tag/doc/whenToUseGet.html

Yes, this is a recommendation, not a dogma. IMHO GET method is
suitable for dense tables with dozens of operations.

Peter

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



Re: user profile is not getting saved in admin

2008-06-23 Thread Alessandro Ronchi
2008/6/23, Karen Tracey <[EMAIL PROTECTED]>:

> newforms-admin WILL be merged before Django 1.0, a recent discussion on the
> developer's list showed broad consensus that 1.0 without newforms-admin
> doesn't make any sense.
>
> I encourage anyone having this problem to try the newforms-admin branch and
> see if it solves the problem.  The branch is quite close to being ready for
> merge, and regularly updated with trunk changes.  Quite possibly the problem
> will just not exist over there, but if there is still an issue, you'll get
> more interest in fixing it on that codebase.

Testing in the new admin-newform branch is good before updating it on
1.0, but we're dealing with production applications, so a working
solution is necessary.
I'm happy because mine works with the modification of the core=True.
-- 
Alessandro Ronchi
Skype: aronchi
http://www.alessandroronchi.net

SOASI Soc.Coop. - www.soasi.com
Sviluppo Software e Sistemi Open Source
Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
Tel.: +39 0543 798985 - Fax: +39 0543 579928

Rispetta l'ambiente: se non ti è necessario, non stampare questa mail

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: url views problem

2008-06-23 Thread phillc

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

look at the regular expressions used in the examples, and the section
"named groups"

On Jun 23, 9:22 am, sebastian stephenson <[EMAIL PROTECTED]> wrote:
> ok so I have in my data base a colium of rss feeds and I am parseing  
> them via feedparser and I am having a touble getting one feed to have  
> like "local/show/1" and another feed have "local/show/2" but how do  
> you do this here is the urls.py in its current state:
>
> from django.conf.urls.defaults import *
>
> urlpatterns = patterns('',
>      # Example:
>      # (r'^ubermicro/', include('ubermicro.foo.urls')),
>
>      # Uncomment this for admin:
>      (r'^admin/', include('django.contrib.admin.urls')),
>      #temp only fo dev proposes
>      (r'^shows/','ubermicro.shows.views.show_page') # .* does not work
> )
>
> then views.py:
>
> from django.http import HttpResponse
> import feedparser
> from ubermicro.shows.models import show
> from django.template import Context, loader
>
> def show_page(request):
>      """this is where we take what we need form the rss feeds in the  
> data base"""
>      query = show.objects.filter(show_feed__contains="http://;)
>      for s in query:
>          podcast = feedparser.parse(s.show_feed)
>          if  podcast.entries:
>              elements = {'show_about':  
> podcast.feed.summary,'show_latest_title': podcast.entries
> [0].title,'show_latest': podcast.entries[0].summary}
>      e = elements
>      t = loader.get_template('shows/show_page_base.html')
>      return  HttpResponse(t.render(Context(e)))
>
> just to say new to django and webdev python etc. so baby language  
> please thank you very much in advance
>
> Thanks
> see ya
>
> sebey
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Another question about form validation?

2008-06-23 Thread phillc

class FormFoo(ModelForm):
  def __init__(self, obj1, *args, **kwargs):
super(FormFoo, self).__init__(*args, **kwargs)
self.object1 = obj1
  def clean(self):
# use self.object1 here


On Jun 23, 12:23 pm, Adi <[EMAIL PROTECTED]> wrote:
> do you mean something like this.
>
> class FormFoo(ModelForm):
>
>         def __init__(self,*args,**kwargs):
>                    self.object1 = kwargs.pop('obj1')
>
>         def clean(self):
>                   # use the self.object1 here
>
> 
>
> On Jun 23, 10:48 am, Alex Koshelev <[EMAIL PROTECTED]> wrote:
>
> > Pass it through form custom constructor
>
> > On Jun 23, 7:12 pm, Adi <[EMAIL PROTECTED]> wrote:
>
> > > How do you pass model objects that you may need access to when
> > > implementing the clean() or clean_ methods?
>
> > > In other words, how can a form access model objects that it may need
> > > access to perform its validation?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: CMS application: auto-setting the post author

2008-06-23 Thread Alex Koshelev

Try this http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser

On Jun 17, 6:02 am, saxon75 <[EMAIL PROTECTED]> wrote:
> I'm working on a CMS application and had a question about
> automatically setting certain model fields.
>
> Suppose I have the following model (this is simplified from the actual
> application):
>
> class Item(models.Model):
>     author = models.ForeignKey(User)
>     created = models.DateTimeField()
>     title = models.CharField(max_length=255)
>     body = models.TextField()
>
> Now, when I go to create a new Item, whether via the admin site or a
> custom newforms-based form, it requires that I select an author from a
> list of existing users.  What I'd prefer is to leave out the author
> field entirely from the add form and have that field automatically set
> to the current user.  How can I do that?
>
> 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: retrieving record id after form save

2008-06-23 Thread Richard Dahl
new_obj = form.save()
new_objects_id = new_obj.id
hth,
-richard



On 6/23/08, Calvin Dodge <[EMAIL PROTECTED]> wrote:
>
>
> I need to get the id of a record after saving it with form.save(). I'm
> not seeing this described in the docs, and haven't dredged anything up
> by searching this group.
>
> Is it possible to get the id of the record from a just-saved form?  Or
> do I have to search for the record, and hope I don't get more than 1
> record in return?
>
> Calvin Dodge
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 pass params to a method that is invoked when a signal was send

2008-06-23 Thread mwebs

So,

I found the solution for the problem by myslef.

dispatcher.connect(makeSeoble, signal=signals.post_save,
sender=model)


... my makeSeoble method needs to look like this:

def makeSeoble(sender)

:-)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



retrieving record id after form save

2008-06-23 Thread Calvin Dodge

I need to get the id of a record after saving it with form.save(). I'm
not seeing this described in the docs, and haven't dredged anything up
by searching this group.

Is it possible to get the id of the record from a just-saved form?  Or
do I have to search for the record, and hope I don't get more than 1
record in return?

Calvin Dodge
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 best to delete one of multiple records?

2008-06-23 Thread Emil Styrke
2008/6/23 Peter Melvyn <[EMAIL PROTECTED]>:

>
> >  I have a list of records, and I'd like the user to be able to delete
> >  any given record by pressing a button.
>
> IMHO there are two basic solutions:
>
> 1. each record has column with hyperlink to delete action (ID is part of
> URL)
>   You can use plain text or image mapped links


Having a GET request delete records is usually a bad idea - see for example
http://www.w3.org/2001/tag/doc/whenToUseGet.html

If the request has side effects, a POST should be used, for example the
original form idea.  Another idea is to have a single form with only a
hidden ID input - then a link for each item could use javascript to set the
correct ID and submit the form.  I'm sure there are other javascript
contraptions that could accomplish the same, but any such approach would of
course require javascript in the client.

  /Emil

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 pass params to a method that is invoked when a signal was send

2008-06-23 Thread mwebs

Hello,

I am trying soething like this:

dispatcher.connect(makeSeoble(model), signal=signals.post_save,
sender=model)

but I get an exception: cannot create weak reference to 'NoneType'
object
so it seems that you cannot pass a param to your "callback function"
the classical way.

when I am doing like this everything seems fine, but I cant pass the
model to makeSeoble.
dispatcher.connect(makeSeoble, signal=signals.post_save, sender=model)

Does anyone has an ideas how I can get the model in my
makeSeoble 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: Struggling with Django/legacy data

2008-06-23 Thread Norman Harman

skins96 wrote:
> Hi,
> 
> I'm a noob who is struggling with understanding how Django might work
> with legacy data.
> 
> It seems Django's foreign keys rely on having an integer in both the
> parent and child table. However, we get a lot of data where what's
> needed is a join based on characters. For instance, "wht" in the
> parent table would correspond to "wht" in the child table, which then
> has a description field that might have, say, "white" in this
> instance.
> 
> I've looked through tons of documentation, both the Sam's book and the
> DjangoBook, but can't seem to find anything that addresses this. I've
> also tried to look through the archives. Can anyone offer advice?
> 
> I guess to be more to the point, I'm trying to figure out how to
> address it in the model (or if it should even be handled in the
> view).

http://www.djangoproject.com/documentation/model-api/#automatic-primary-key-fields

If you’d like to specify a custom primary key, just specify 
primary_key=True on one of your fields.


http://www.djangoproject.com/documentation/model-api/#relationships

to_fieldThe field on the related object that the relation is to. By 
default, Django uses the primary key of the related object.
-- 
Norman J. Harman Jr.
Senior Web Specialist, Austin American-Statesman
___
You've got fun!  Check out Austin360.com for all the entertainment
info you need to live it up in the big city!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



sending large downloads

2008-06-23 Thread msoulier

Hello,

I saw some posts on this but not many useful responses. Apologies if
there's already a known solution.

For a web-based backup, I need to send a large file, basically the
output of a tar process, to the browser. We have legacy Perl code
doing this now but I'd like to use Django. Is there a way to stream
this without reading the entire file into memory and writing it into
the HttpResponse object?

Or am I operating under a bad assumption? I see now that the docs show
a flush() method. Could I say, read 1024 bytes at a time, write() them
and flush() them without consuming large amounts of memory?

Thanks,
Mike
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Manipulating URLs

2008-06-23 Thread shravster

Tons of good karma to you both :)

really appreciate it.. Thanks!

On Jun 23, 1:02 am, Tye <[EMAIL PROTECTED]> wrote:
> I knew I'd write a long, pseudo-detailed post, just to turn around and
> find something so very simple.
>
> I knew it!
>
> Thanks Matthias :-)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



contributing admin templates

2008-06-23 Thread José Moreira

Hi,

as soon as i understood django admin funcionalities, i started
searching the web for pre-made templates and couldn't find anything.

It doesn't seem a bad idea, what do you think?


-- 
José Moreira
Vila Nova de Gaia
Portugal

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: CMS application: auto-setting the post author

2008-06-23 Thread Jashugan

On Jun 16, 9:46 pm, "Ronny Haryanto" <[EMAIL PROTECTED]> wrote:
> Another way (which I personally prefer because it's more explicit and
> clear), is to do it in the view. Don't show the author field in the
> form, because we want to automatically add it before saving.
>
> def add_item(request):
>     ...
>     item.author = request.user
>     item.save()
>
> The syntax might not be correct, but you get the idea.

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



Re: Django and Adobe Spry

2008-06-23 Thread José Moreira

Hi

sure i will,

thanks ;)

2008/6/23 Dan <[EMAIL PROTECTED]>:
>
> There's also ExtJS that has great client-side validation:
> http://extjs.com/deploy/dev/examples/form/dynamic.html
>
> Ext has a a few built-in validations (must not be empty, must be a
> valid e-mail, must be in a range, etc.) but if what you need isn't
> there, you just create a function that returns a boolean to indicate
> if it's valid or not. Try leaving the first name blank or using an
> invalid e-mail format to see how Ext interacts with the user.
>
> On Mon, Jun 23, 2008 at 9:22 AM, José Moreira <[EMAIL PROTECTED]> wrote:
>>
>> hello,
>>
>> i understand you point. I don't use Dramweaver, i have used Spry due
>> to the html widgets with client-side form validation and was
>> considering using the xml datasets for ajax.
>> I asked this question because i used it with Smarty templates and has
>> to develop workarounds for the brackets also.
>>
>> I'll look at Mootools.
>>
>> thanks ;)
>>
>>
>> 2008/6/23 joshuajonah <[EMAIL PROTECTED]>:
>>>
>>> I would recommend using another Javascript framework like jQuery or
>>> Mootools.
>>>
>>> SPRY is very invasive and messy. It requires a ton of files that may
>>> be a little tough to get your head around even for simple
>>> applications. These files could prove to be a scary situation when
>>> combined with django templating. I imagine you would like to use SPRY
>>> because of the built in Dreamweaver features, but it could prove
>>> harder than learning another language after dealing with all the
>>> dependencies.
>>>
>>> Mootools is a good option because of the short learning curve. You can
>>> take it one piece at a time while still using a framework that is rich
>>> with user contributed plugins, etc.
>>>
>>> Joshua
>>>
>>>
>>>
>>> On Jun 23, 9:01 am, José Moreira <[EMAIL PROTECTED]> wrote:
 Hello,

 anyone has tried using Adobe Spry on Django templates? Because spry
 uses brackets in the widgets and ajax html templating...

 thank you
>>> >
>>>
>>
>>
>>
>> --
>> José Moreira
>> Vila Nova de Gaia
>> Portugal
>>
>> >
>>
>
> >
>



-- 
José Moreira
Vila Nova de Gaia
Portugal

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Struggling with Django/legacy data

2008-06-23 Thread skins96

Hi,

I'm a noob who is struggling with understanding how Django might work
with legacy data.

It seems Django's foreign keys rely on having an integer in both the
parent and child table. However, we get a lot of data where what's
needed is a join based on characters. For instance, "wht" in the
parent table would correspond to "wht" in the child table, which then
has a description field that might have, say, "white" in this
instance.

I've looked through tons of documentation, both the Sam's book and the
DjangoBook, but can't seem to find anything that addresses this. I've
also tried to look through the archives. Can anyone offer advice?

I guess to be more to the point, I'm trying to figure out how to
address it in the model (or if it should even be handled in the
view).

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: Django and Adobe Spry

2008-06-23 Thread Dan

There's also ExtJS that has great client-side validation:
http://extjs.com/deploy/dev/examples/form/dynamic.html

Ext has a a few built-in validations (must not be empty, must be a
valid e-mail, must be in a range, etc.) but if what you need isn't
there, you just create a function that returns a boolean to indicate
if it's valid or not. Try leaving the first name blank or using an
invalid e-mail format to see how Ext interacts with the user.

On Mon, Jun 23, 2008 at 9:22 AM, José Moreira <[EMAIL PROTECTED]> wrote:
>
> hello,
>
> i understand you point. I don't use Dramweaver, i have used Spry due
> to the html widgets with client-side form validation and was
> considering using the xml datasets for ajax.
> I asked this question because i used it with Smarty templates and has
> to develop workarounds for the brackets also.
>
> I'll look at Mootools.
>
> thanks ;)
>
>
> 2008/6/23 joshuajonah <[EMAIL PROTECTED]>:
>>
>> I would recommend using another Javascript framework like jQuery or
>> Mootools.
>>
>> SPRY is very invasive and messy. It requires a ton of files that may
>> be a little tough to get your head around even for simple
>> applications. These files could prove to be a scary situation when
>> combined with django templating. I imagine you would like to use SPRY
>> because of the built in Dreamweaver features, but it could prove
>> harder than learning another language after dealing with all the
>> dependencies.
>>
>> Mootools is a good option because of the short learning curve. You can
>> take it one piece at a time while still using a framework that is rich
>> with user contributed plugins, etc.
>>
>> Joshua
>>
>>
>>
>> On Jun 23, 9:01 am, José Moreira <[EMAIL PROTECTED]> wrote:
>>> Hello,
>>>
>>> anyone has tried using Adobe Spry on Django templates? Because spry
>>> uses brackets in the widgets and ajax html templating...
>>>
>>> thank you
>> >
>>
>
>
>
> --
> José Moreira
> Vila Nova de Gaia
> Portugal
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 best to delete one of multiple records?

2008-06-23 Thread Peter Melvyn

>  I have a list of records, and I'd like the user to be able to delete
>  any given record by pressing a button.

IMHO there are two basic solutions:

1. each record has column with hyperlink to delete action (ID is part of URL)
   You can use plain text or image mapped links
2. each record has checkbox and there is a single DELETE button

Peter

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



Re: Another question about form validation?

2008-06-23 Thread Adi

do you mean something like this.

class FormFoo(ModelForm):

def __init__(self,*args,**kwargs):
   self.object1 = kwargs.pop('obj1')


def clean(self):
  # use the self.object1 here





On Jun 23, 10:48 am, Alex Koshelev <[EMAIL PROTECTED]> wrote:
> Pass it through form custom constructor
>
> On Jun 23, 7:12 pm, Adi <[EMAIL PROTECTED]> wrote:
>
> > How do you pass model objects that you may need access to when
> > implementing the clean() or clean_ methods?
>
> > In other words, how can a form access model objects that it may need
> > access to perform its validation?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: site searching

2008-06-23 Thread José Moreira

Hi,

yes while seaching the mailing list i found django-search. More bellow.

2008/6/23 bruno desthuilliers <[EMAIL PROTECTED]>:
>
> On 23 juin, 17:26, "José Moreira" <[EMAIL PROTECTED]> wrote:
>> Hello,
>>
>> what solutions are you using to provide site search by keywords?
>
> depends on your definition of "search by keywords"...
>

plain old site wide search on the pages. the visitor types a keyword
and the search results are composed from results of links to pages
from each module

the website is split in apps (obviosly).
there's an app to allow dynamic html content (tinymce), an app for
news, an app for a FAQ, et cetera.

>> as i can see thee are 2 methods
>>
>> a) periodic website index through custom bot and a lucene like tool
>
> ie, django-search (http://code.google.com/p/django-search/)
>
>> b) implement a search in every 'module' of the website and gather the
>> results of each
>>
>> any thoughts?
>
> c) generic configurable indexer/searcher module using signals to
> reindex created or modified items
>
> I'm currently working on such a beast (loosely based on django-
> search's 'simple' backend, but using zope's textindexng3 package for
> full-text indexing).
>

its very interesting

>
> >
>



-- 
José Moreira
Vila Nova de Gaia
Portugal

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Another question about form validation?

2008-06-23 Thread Alex Koshelev

Pass it through form custom constructor

On Jun 23, 7:12 pm, Adi <[EMAIL PROTECTED]> wrote:
> How do you pass model objects that you may need access to when
> implementing the clean() or clean_ methods?
>
> In other words, how can a form access model objects that it may need
> access to perform its validation?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 best to delete one of multiple records?

2008-06-23 Thread Norman Harman

Kenneth McDonald wrote:
> I have a list of records, and I'd like the user to be able to delete  
> any given record by pressing a button. My current strategy is to have  
> each record in its own form (so that pressing the submit button for  
> that form would delete the record), and have each form contain a  
> hidden field identifying the corresponding record via a unique key so  
> that I know which record to delete. However, this is very crude, and  
> no doubt indicative of the fact that I'm still just starting to learn  
> Django. What would people suggest as better alternatives? Feel free to  
> point me to documentation--I don't mind doing the reading, it's just  
> finding the relevant material that's a problem (there's so much of  
> it :-) ).

I don't think that's bad, all depends on how you want UI to work.

Other options would be putting them in a ChoiceField and using Select 
(dropdown) RadioSelect (radio buttons) or some custom widget.

The choice field options will have only one delete button but require 
user to select which record to delete.  That may or may not be a better 
ui than multiple delete buttons.

-- 
Norman J. Harman Jr.
Senior Web Specialist, Austin American-Statesman
___
You've got fun!  Check out Austin360.com for all the entertainment
info you need to live it up in the big city!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Where to install additional libraries?

2008-06-23 Thread Norman Harman

Jamie Pittock wrote:
> Thank you Gordon (and Joshua) that's really useful.
> 
> I think I'll use the site-packages folder then.  After doing what you
> said I've noticed I seem to have multiple installs of Python on my
> machine (OSX).
> 
> /usr/lib/python2.5/
> /Library/Python/2.5/
> /opt/local/lib/python2.5/
> /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/
> (currently being used)
> 
> This is probably due in part to upgrading to Leopard and it changing
> the location, maybe?
> 
> I presume again it doesn't matter which of these I use aslong as I'm
> consistent?

It does matter, each Python installation is an 'Island'.

Figure out which Python is default.
   # this gives you the version
   python -V
   # this tells you were it is (and around where setup.py install will 
put its files)
   which python

If the default is 
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/bin/python 
but you want to use /usr/local/python2.5/bin/python instead then you 
must make sure you run the correct python when doing installs and when 
running manage.py.

you can use the full path every time
   /usr/local/python2.5/bin/python setup.py install

or you can use an alias (I suggest adding to your .bashrc or similar file)
   alias python=/usr/local/python2.5/bin/python



-- 
Norman J. Harman Jr.
Senior Web Specialist, Austin American-Statesman
___
You've got fun!  Check out Austin360.com for all the entertainment
info you need to live it up in the big city!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Where to install additional libraries?

2008-06-23 Thread Jamie Pittock

No, that does help.  This is all making sense now.  Looking around in
the different site-packages folders I can start seeing where things
have gone wrong.   I was running 'sudo python setup.py install' but it
didn't appear to be doing anything.  It turns out they were just being
installed in a different location.

Based on what I've gleaned from this thread I've changed my PYTHONPATH
to use /Library/Python/2.5/site-packages and my PATH now uses /System/
Library/.../2.5/

Anyway, thanks very much everyone.


On Jun 23, 3:23 pm, Eric Abrahamsen <[EMAIL PROTECTED]> wrote:
> It may very well make a difference if you're using python2.4 and you  
> install packages in a python2.5 site-packages directory! I remember  
> reading somewhere that that was one of the issues of doing a Leopard  
> upgrade, versus wiping the drive and doing a full install. I did the  
> latter, and I don't have python2.4 anymore, and all my packages go in  
> a single convenience directory: /Library/Python/2.5/site-packages,  
> though the python installation itself is still under /Library/
> Frameworks.
>
> Sorry I can't be more helpful with the specifics, but I do remember  
> reading a lot of complaints on this issue so... be careful!
>
> Eric
>
> On Jun 23, 2008, at 10:10 PM, Jamie Pittock wrote:
>
>
>
> > Thank you Gordon (and Joshua) that's really useful.
>
> > I think I'll use the site-packages folder then.  After doing what you
> > said I've noticed I seem to have multiple installs of Python on my
> > machine (OSX).
>
> > /usr/lib/python2.5/
> > /Library/Python/2.5/
> > /opt/local/lib/python2.5/
> > /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/
> > (currently being used)
>
> > This is probably due in part to upgrading to Leopard and it changing
> > the location, maybe?
>
> > I presume again it doesn't matter which of these I use aslong as I'm
> > consistent?
>
> > On Jun 23, 2:23 pm, gordyt <[EMAIL PROTECTED]> wrote:
> >> Jamie the command you quoted "python setup.py install" -- on my  
> >> system
> >> I have to run it as root or else do "sudo python setup.py install" --
> >> will copy the files for that module to the appropriate location.
>
> >> If the module you are interested in is in pure Python, with no c-
> >> code,
> >> you can often just make it available anywhere on your PYTHONPATH.
>
> >> In any event, the most common place that extra stuff gets installed  
> >> is
> >> in your "site-packages" folder.  On my Ubuntu machine that is located
> >> in two places:
>
> >> /usr/lib/python2.5/site-packages
> >> /usr/local/lib/python2.5/site-packages
>
> >> You can always find the location on your system by asking Python
> >> itself:
>
> > import sys
> > for p in sys.path:
>
> >> ...  print p
> >> ...
>
> >> /usr/lib/python2.5/site-packages
> >> /usr/lib/python2.5/site-packages/lxml-2.1beta2-py2.5-linux-x86_64.egg
> >> /usr/lib/python25.zip
> >> /usr/lib/python2.5
> >> /usr/lib/python2.5/plat-linux2
> >> /usr/lib/python2.5/lib-tk
> >> /usr/lib/python2.5/lib-dynload
> >> /usr/local/lib/python2.5/site-packages
> >> /usr/lib/python2.5/site-packages
> >> /usr/lib/python2.5/site-packages/Numeric
> >> /usr/lib/python2.5/site-packages/PIL
> >> /usr/lib/python2.5/site-packages/gst-0.10
> >> /var/lib/python-support/python2.5
> >> /usr/lib/python2.5/site-packages/gtk-2.0
> >> /var/lib/python-support/python2.5/gtk-2.0
>
> >> Here is an example of what I mentioned earlier about installing pure
> >> Python modules... I have both django and report lab checked out of  
> >> the
> >> repository and just put symbolic links to them in the /usr/local/lib/
> >> python2.5/site-packages folder:
>
> >> [EMAIL PROTECTED]:/usr/local/lib/python2.5/site-packages$ pwd
> >> /usr/local/lib/python2.5/site-packages
> >> [EMAIL PROTECTED]:/usr/local/lib/python2.5/site-packages$ ls -l
> >> total 12
> >> lrwxrwxrwx  1 root staff   34 2007-12-28 10:29 django -> /home/gordy/
> >> projects/python/django
> >> -rw-r--r--  1 root staff  548 2008-02-05 14:14 moin-1.6.1.egg-info
> >> -rw-r--r--  1 root staff  548 2008-02-05 13:38 moin-1.6.1-py2.5.egg-
> >> info
> >> drwxr-sr-x 25 root staff 4096 2008-02-05 13:38 MoinMoin
> >> lrwxrwxrwx  1 root staff   37 2008-01-15 10:41 reportlab -> /home/
> >> gordy/projects/python/reportlab
>
> >> Works great.
>
> >> --gordon
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: site searching

2008-06-23 Thread bruno desthuilliers

On 23 juin, 17:26, "José Moreira" <[EMAIL PROTECTED]> wrote:
> Hello,
>
> what solutions are you using to provide site search by keywords?

depends on your definition of "search by keywords"...

> as i can see thee are 2 methods
>
> a) periodic website index through custom bot and a lucene like tool

ie, django-search (http://code.google.com/p/django-search/)

> b) implement a search in every 'module' of the website and gather the
> results of each
>
> any thoughts?

c) generic configurable indexer/searcher module using signals to
reindex created or modified items

I'm currently working on such a beast (loosely based on django-
search's 'simple' backend, but using zope's textindexng3 package for
full-text indexing).


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



Re: custom form with admin look and feel

2008-06-23 Thread Norman Harman

chefsmart wrote:
> I'm using django svn trunk. I have created several custom forms that
> show up in the admin section of the website. However, these forms look
> nothing like the admin forms. I tried extending change_form.html
> template - unsuccessfully.
> 
> Does anyone know what my template should contain to achieve admin look
> and feel.

look in django/contrib/admin/templates

extending admin/base_site.html is what I believe you want.

-- 
Norman J. Harman Jr.
Senior Web Specialist, Austin American-Statesman
___
You've got fun!  Check out Austin360.com for all the entertainment
info you need to live it up in the big city!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



site searching

2008-06-23 Thread José Moreira

Hello,

what solutions are you using to provide site search by keywords?

as i can see thee are 2 methods

a) periodic website index through custom bot and a lucene like tool

b) implement a search in every 'module' of the website and gather the
results of each

any thoughts?

thanks,



-- 
José Moreira
Vila Nova de Gaia
Portugal

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Another question about form validation?

2008-06-23 Thread Adi

How do you pass model objects that you may need access to when
implementing the clean() or clean_ methods?

In other words, how can a form access model objects that it may need
access to perform its validation?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



dynamically add memcache server

2008-06-23 Thread Frédéric Sidler
to use memcache, you need to set the IP:port of the machine used in
settings.py
now I use two memcache servers IP1:12000, IP2:12000 and would like to know
if there is a way to add another memcache server without restarting django

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Url tag issues

2008-06-23 Thread Rajesh Dhawan

Hi Emily,

>
> > Since you need that kind of flexibility in which parameters
> > and combinations you can have, consider using query string
> > parameters instead of url path parameters.
>
> This is what I would normally have done, but I got the impression that
> this kinda went again what django is about, so I was trying to do it in
> a more djangoesque way!!

Actually, both ways are djangoesque enough.

Normally, you would use the "path style" when your URL's path
components are well-defined(/articles/detail/123/, /news/sports/
soccer/, etc.) On the other hand, when you have to drive the main view
with a flexible number of parameters some of which may not always be
present *and* you need them to appear in many different combinations,
the querystring-based pattern fits in better.

> Perhaps I will just do it how I would have
> before!!
>
> Thanks for pointing out the obvious (that I had been stupidly
> disregarding) to me :)

Yeah, sometimes the most obvious solution is also the right one ;)

-RD
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: user profile is not getting saved in admin

2008-06-23 Thread Karen Tracey
On Mon, Jun 23, 2008 at 6:40 AM, Deniz Dogan <[EMAIL PROTECTED]> wrote:

> From what I've heard it will be easier to do what we all seem to want
> in the newforms-admin branch, which should be merged by the time of
> the release of Django 1.0.
>

newforms-admin WILL be merged before Django 1.0, a recent discussion on the
developer's list showed broad consensus that 1.0 without newforms-admin
doesn't make any sense.

I encourage anyone having this problem to try the newforms-admin branch and
see if it solves the problem.  The branch is quite close to being ready for
merge, and regularly updated with trunk changes.  Quite possibly the problem
will just not exist over there, but if there is still an issue, you'll get
more interest in fixing it on that codebase.

Karen

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



Re: Where to install additional libraries?

2008-06-23 Thread Eric Abrahamsen

It may very well make a difference if you're using python2.4 and you  
install packages in a python2.5 site-packages directory! I remember  
reading somewhere that that was one of the issues of doing a Leopard  
upgrade, versus wiping the drive and doing a full install. I did the  
latter, and I don't have python2.4 anymore, and all my packages go in  
a single convenience directory: /Library/Python/2.5/site-packages,  
though the python installation itself is still under /Library/ 
Frameworks.

Sorry I can't be more helpful with the specifics, but I do remember  
reading a lot of complaints on this issue so... be careful!

Eric


On Jun 23, 2008, at 10:10 PM, Jamie Pittock wrote:

>
> Thank you Gordon (and Joshua) that's really useful.
>
> I think I'll use the site-packages folder then.  After doing what you
> said I've noticed I seem to have multiple installs of Python on my
> machine (OSX).
>
> /usr/lib/python2.5/
> /Library/Python/2.5/
> /opt/local/lib/python2.5/
> /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/
> (currently being used)
>
> This is probably due in part to upgrading to Leopard and it changing
> the location, maybe?
>
> I presume again it doesn't matter which of these I use aslong as I'm
> consistent?
>
>
> On Jun 23, 2:23 pm, gordyt <[EMAIL PROTECTED]> wrote:
>> Jamie the command you quoted "python setup.py install" -- on my  
>> system
>> I have to run it as root or else do "sudo python setup.py install" --
>> will copy the files for that module to the appropriate location.
>>
>> If the module you are interested in is in pure Python, with no c- 
>> code,
>> you can often just make it available anywhere on your PYTHONPATH.
>>
>> In any event, the most common place that extra stuff gets installed  
>> is
>> in your "site-packages" folder.  On my Ubuntu machine that is located
>> in two places:
>>
>> /usr/lib/python2.5/site-packages
>> /usr/local/lib/python2.5/site-packages
>>
>> You can always find the location on your system by asking Python
>> itself:
>>
> import sys
> for p in sys.path:
>>
>> ...  print p
>> ...
>>
>> /usr/lib/python2.5/site-packages
>> /usr/lib/python2.5/site-packages/lxml-2.1beta2-py2.5-linux-x86_64.egg
>> /usr/lib/python25.zip
>> /usr/lib/python2.5
>> /usr/lib/python2.5/plat-linux2
>> /usr/lib/python2.5/lib-tk
>> /usr/lib/python2.5/lib-dynload
>> /usr/local/lib/python2.5/site-packages
>> /usr/lib/python2.5/site-packages
>> /usr/lib/python2.5/site-packages/Numeric
>> /usr/lib/python2.5/site-packages/PIL
>> /usr/lib/python2.5/site-packages/gst-0.10
>> /var/lib/python-support/python2.5
>> /usr/lib/python2.5/site-packages/gtk-2.0
>> /var/lib/python-support/python2.5/gtk-2.0
>>
>> Here is an example of what I mentioned earlier about installing pure
>> Python modules... I have both django and report lab checked out of  
>> the
>> repository and just put symbolic links to them in the /usr/local/lib/
>> python2.5/site-packages folder:
>>
>> [EMAIL PROTECTED]:/usr/local/lib/python2.5/site-packages$ pwd
>> /usr/local/lib/python2.5/site-packages
>> [EMAIL PROTECTED]:/usr/local/lib/python2.5/site-packages$ ls -l
>> total 12
>> lrwxrwxrwx  1 root staff   34 2007-12-28 10:29 django -> /home/gordy/
>> projects/python/django
>> -rw-r--r--  1 root staff  548 2008-02-05 14:14 moin-1.6.1.egg-info
>> -rw-r--r--  1 root staff  548 2008-02-05 13:38 moin-1.6.1-py2.5.egg-
>> info
>> drwxr-sr-x 25 root staff 4096 2008-02-05 13:38 MoinMoin
>> lrwxrwxrwx  1 root staff   37 2008-01-15 10:41 reportlab -> /home/
>> gordy/projects/python/reportlab
>>
>> Works great.
>>
>> --gordon
> >


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Where to install additional libraries?

2008-06-23 Thread Jamie Pittock

Thank you Gordon (and Joshua) that's really useful.

I think I'll use the site-packages folder then.  After doing what you
said I've noticed I seem to have multiple installs of Python on my
machine (OSX).

/usr/lib/python2.5/
/Library/Python/2.5/
/opt/local/lib/python2.5/
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/
(currently being used)

This is probably due in part to upgrading to Leopard and it changing
the location, maybe?

I presume again it doesn't matter which of these I use aslong as I'm
consistent?


On Jun 23, 2:23 pm, gordyt <[EMAIL PROTECTED]> wrote:
> Jamie the command you quoted "python setup.py install" -- on my system
> I have to run it as root or else do "sudo python setup.py install" --
> will copy the files for that module to the appropriate location.
>
> If the module you are interested in is in pure Python, with no c-code,
> you can often just make it available anywhere on your PYTHONPATH.
>
> In any event, the most common place that extra stuff gets installed is
> in your "site-packages" folder.  On my Ubuntu machine that is located
> in two places:
>
> /usr/lib/python2.5/site-packages
> /usr/local/lib/python2.5/site-packages
>
> You can always find the location on your system by asking Python
> itself:
>
> >>> import sys
> >>> for p in sys.path:
>
> ...  print p
> ...
>
> /usr/lib/python2.5/site-packages
> /usr/lib/python2.5/site-packages/lxml-2.1beta2-py2.5-linux-x86_64.egg
> /usr/lib/python25.zip
> /usr/lib/python2.5
> /usr/lib/python2.5/plat-linux2
> /usr/lib/python2.5/lib-tk
> /usr/lib/python2.5/lib-dynload
> /usr/local/lib/python2.5/site-packages
> /usr/lib/python2.5/site-packages
> /usr/lib/python2.5/site-packages/Numeric
> /usr/lib/python2.5/site-packages/PIL
> /usr/lib/python2.5/site-packages/gst-0.10
> /var/lib/python-support/python2.5
> /usr/lib/python2.5/site-packages/gtk-2.0
> /var/lib/python-support/python2.5/gtk-2.0
>
> Here is an example of what I mentioned earlier about installing pure
> Python modules... I have both django and report lab checked out of the
> repository and just put symbolic links to them in the /usr/local/lib/
> python2.5/site-packages folder:
>
> [EMAIL PROTECTED]:/usr/local/lib/python2.5/site-packages$ pwd
> /usr/local/lib/python2.5/site-packages
> [EMAIL PROTECTED]:/usr/local/lib/python2.5/site-packages$ ls -l
> total 12
> lrwxrwxrwx  1 root staff   34 2007-12-28 10:29 django -> /home/gordy/
> projects/python/django
> -rw-r--r--  1 root staff  548 2008-02-05 14:14 moin-1.6.1.egg-info
> -rw-r--r--  1 root staff  548 2008-02-05 13:38 moin-1.6.1-py2.5.egg-
> info
> drwxr-sr-x 25 root staff 4096 2008-02-05 13:38 MoinMoin
> lrwxrwxrwx  1 root staff   37 2008-01-15 10:41 reportlab -> /home/
> gordy/projects/python/reportlab
>
> Works great.
>
> --gordon
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Where to install additional libraries?

2008-06-23 Thread gordyt

Jamie the command you quoted "python setup.py install" -- on my system
I have to run it as root or else do "sudo python setup.py install" --
will copy the files for that module to the appropriate location.

If the module you are interested in is in pure Python, with no c-code,
you can often just make it available anywhere on your PYTHONPATH.

In any event, the most common place that extra stuff gets installed is
in your "site-packages" folder.  On my Ubuntu machine that is located
in two places:


/usr/lib/python2.5/site-packages
/usr/local/lib/python2.5/site-packages

You can always find the location on your system by asking Python
itself:


>>> import sys
>>> for p in sys.path:
...  print p
...

/usr/lib/python2.5/site-packages
/usr/lib/python2.5/site-packages/lxml-2.1beta2-py2.5-linux-x86_64.egg
/usr/lib/python25.zip
/usr/lib/python2.5
/usr/lib/python2.5/plat-linux2
/usr/lib/python2.5/lib-tk
/usr/lib/python2.5/lib-dynload
/usr/local/lib/python2.5/site-packages
/usr/lib/python2.5/site-packages
/usr/lib/python2.5/site-packages/Numeric
/usr/lib/python2.5/site-packages/PIL
/usr/lib/python2.5/site-packages/gst-0.10
/var/lib/python-support/python2.5
/usr/lib/python2.5/site-packages/gtk-2.0
/var/lib/python-support/python2.5/gtk-2.0

Here is an example of what I mentioned earlier about installing pure
Python modules... I have both django and report lab checked out of the
repository and just put symbolic links to them in the /usr/local/lib/
python2.5/site-packages folder:

[EMAIL PROTECTED]:/usr/local/lib/python2.5/site-packages$ pwd
/usr/local/lib/python2.5/site-packages
[EMAIL PROTECTED]:/usr/local/lib/python2.5/site-packages$ ls -l
total 12
lrwxrwxrwx  1 root staff   34 2007-12-28 10:29 django -> /home/gordy/
projects/python/django
-rw-r--r--  1 root staff  548 2008-02-05 14:14 moin-1.6.1.egg-info
-rw-r--r--  1 root staff  548 2008-02-05 13:38 moin-1.6.1-py2.5.egg-
info
drwxr-sr-x 25 root staff 4096 2008-02-05 13:38 MoinMoin
lrwxrwxrwx  1 root staff   37 2008-01-15 10:41 reportlab -> /home/
gordy/projects/python/reportlab

Works great.

--gordon

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



url views problem

2008-06-23 Thread sebastian stephenson

ok so I have in my data base a colium of rss feeds and I am parseing  
them via feedparser and I am having a touble getting one feed to have  
like "local/show/1" and another feed have "local/show/2" but how do  
you do this here is the urls.py in its current state:

from django.conf.urls.defaults import *

urlpatterns = patterns('',
 # Example:
 # (r'^ubermicro/', include('ubermicro.foo.urls')),

 # Uncomment this for admin:
 (r'^admin/', include('django.contrib.admin.urls')),
 #temp only fo dev proposes
 (r'^shows/','ubermicro.shows.views.show_page') # .* does not work
)


then views.py:

from django.http import HttpResponse
import feedparser
from ubermicro.shows.models import show
from django.template import Context, loader




def show_page(request):
 """this is where we take what we need form the rss feeds in the  
data base"""
 query = show.objects.filter(show_feed__contains="http://;)
 for s in query:
 podcast = feedparser.parse(s.show_feed)
 if  podcast.entries:
 elements = {'show_about':  
podcast.feed.summary,'show_latest_title': podcast.entries 
[0].title,'show_latest': podcast.entries[0].summary}
 e = elements
 t = loader.get_template('shows/show_page_base.html')
 return  HttpResponse(t.render(Context(e)))


just to say new to django and webdev python etc. so baby language  
please thank you very much in advance


Thanks
see ya

sebey




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



Re: Django and Adobe Spry

2008-06-23 Thread José Moreira

hello,

i understand you point. I don't use Dramweaver, i have used Spry due
to the html widgets with client-side form validation and was
considering using the xml datasets for ajax.
I asked this question because i used it with Smarty templates and has
to develop workarounds for the brackets also.

I'll look at Mootools.

thanks ;)


2008/6/23 joshuajonah <[EMAIL PROTECTED]>:
>
> I would recommend using another Javascript framework like jQuery or
> Mootools.
>
> SPRY is very invasive and messy. It requires a ton of files that may
> be a little tough to get your head around even for simple
> applications. These files could prove to be a scary situation when
> combined with django templating. I imagine you would like to use SPRY
> because of the built in Dreamweaver features, but it could prove
> harder than learning another language after dealing with all the
> dependencies.
>
> Mootools is a good option because of the short learning curve. You can
> take it one piece at a time while still using a framework that is rich
> with user contributed plugins, etc.
>
> Joshua
>
>
>
> On Jun 23, 9:01 am, José Moreira <[EMAIL PROTECTED]> wrote:
>> Hello,
>>
>> anyone has tried using Adobe Spry on Django templates? Because spry
>> uses brackets in the widgets and ajax html templating...
>>
>> thank you
> >
>



-- 
José Moreira
Vila Nova de Gaia
Portugal

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Where to install additional libraries?

2008-06-23 Thread joshuajonah

Depends on your setup, I store my extras (MySQLdb, Django, mod_python/
wsgi installers, Imaging, etc.) in /opt/. It's usually empty on most
machines. Some like to use a folder within their user folder,
especially for multi user computers.

It's really up to you.

On Jun 23, 9:08 am, Jamie Pittock <[EMAIL PROTECTED]> wrote:
> Hi all - this may well be a very basic question but I'm gonna ask it
> anyway as, everyone needs to learn, and I can't find the answer
> anywhere else.  It's probably more related to Python than Django
> but...
>
> If you're installing additional Python libraries such as Imaging or
> Markdown, where are they supposed to go?  Installation instructions
> always say download the the files and run 'python setup.py install'
> but they never state where to put the files.
>
> Is there a specific place they need to go...or if not specific, is
> there a conventional place?
>
> Thanks in advance.
> Jamie
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django and Adobe Spry

2008-06-23 Thread joshuajonah

I would recommend using another Javascript framework like jQuery or
Mootools.

SPRY is very invasive and messy. It requires a ton of files that may
be a little tough to get your head around even for simple
applications. These files could prove to be a scary situation when
combined with django templating. I imagine you would like to use SPRY
because of the built in Dreamweaver features, but it could prove
harder than learning another language after dealing with all the
dependencies.

Mootools is a good option because of the short learning curve. You can
take it one piece at a time while still using a framework that is rich
with user contributed plugins, etc.

Joshua



On Jun 23, 9:01 am, José Moreira <[EMAIL PROTECTED]> wrote:
> Hello,
>
> anyone has tried using Adobe Spry on Django templates? Because spry
> uses brackets in the widgets and ajax html templating...
>
> 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
-~--~~~~--~~--~--~---



Where to install additional libraries?

2008-06-23 Thread Jamie Pittock

Hi all - this may well be a very basic question but I'm gonna ask it
anyway as, everyone needs to learn, and I can't find the answer
anywhere else.  It's probably more related to Python than Django
but...

If you're installing additional Python libraries such as Imaging or
Markdown, where are they supposed to go?  Installation instructions
always say download the the files and run 'python setup.py install'
but they never state where to put the files.

Is there a specific place they need to go...or if not specific, is
there a conventional place?

Thanks in advance.
Jamie
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Django and Adobe Spry

2008-06-23 Thread José Moreira

Hello,

anyone has tried using Adobe Spry on Django templates? Because spry
uses brackets in the widgets and ajax html templating...

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: CSS not working in exe

2008-06-23 Thread Molly

Thanks Johan, I will check that out :)

On Jun 21, 8:06 am, johan de taeye <[EMAIL PROTECTED]> wrote:
> For my frePPle project, I have been using py2exe to package a
> standalone django application.
>
> See here for my manage.py 
> script:http://frepple.svn.sourceforge.net/viewvc/frepple/trunk/contrib/insta...
>
> Here's a patch for the django code to make also the django commands
> work with the zip-file created by 
> py2exe:http://code.djangoproject.com/ticket/5825 unfortunately
> not marked for the 1.0 release :-(
>
> Johan
>
> On 20 jun, 19:10, Molly <[EMAIL PROTECTED]> wrote:
>
> > Thanks for that tip, Chris! I have been wondering about that actually.
>
> > I think I am going to switch to Apache, because I have been having a
> > lot of trouble with the exe.
>
> > Thanks for the help, I aprreciate it :)
>
> > Molly
>
> > On Jun 20, 10:56 am, chris vigelius <[EMAIL PROTECTED]>
> > wrote:
>
> > > Hi Molly,
>
> > > please consider using dpaste.com or similar for posting long code 
> > > examples.
> > > Not only does this reduce list traffic, but you'll get syntax coloring and
> > > readable formatting, too...
>
> > > On to your question:
> > > I must admit I never used py2exe, so my advice may be misguided, but 
> > > shouldn't
> > > this list
>
> > > >data_files = [(".", 
> > > > [r"C:\dev\incidents\db.sqlite3"]),
> > > >(r".\templates\admin", 
> > > > glob.glob(r"C:\Python25\Lib\site-packages
> > > > \django\contrib\admin\templates\admin\*.*")),
> > > >(r".\templates\admin\auth\user", 
> > > > glob.glob(r"C:\Python25\Libsite-
> > > > packages\django\contrib\admin\templates\admin\auth\user\*.*")),
> > > > -~--~~~~--~~--~--~---
>
> > > somehow refer to C:\dev\incidents\media\, where you seem to store your 
> > > actual
> > > media files? If this "data_files" property does what I think it does, then
> > > you import admin media from site-packages, but not your own media files. 
> > > And
> > > btw, there's a backslash missing in the third line, too.
>
> > > hth,
> > >  chris- Tekst uit oorspronkelijk bericht niet weergeven -
>
> > - Tekst uit oorspronkelijk bericht weergeven -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Complex filtering

2008-06-23 Thread Deniz Dogan

Disregard this thread. Fixed it. Basically at first I was thinking
"check so that X = True for all X", but instead I now check "check so
that no X = False for all X".

On Jun 23, 12:50 pm, Deniz Dogan <[EMAIL PROTECTED]> wrote:
> Hello.
>
> I have a model Students and another one called Course. The basic
> structure is as follows:
>
> class Student(models.Model):
>   name = models.CharField()
>   courses = models.ManyToManyField(Course)
>
> class Course(models.Model):
>   name = models.CharField()
>
> Now I want to have a query set of all the courses in which all
> students are named "John". How would I go about doing that?
>
> Deniz
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Complex URLs and numerous GET variables

2008-06-23 Thread AndyB

I've wondered about this myself.

You could use an 'all' placeholder so that there was always three
levels in the url:

example.com/shop/all/all/Acme
example.com/shop/all/250-500/all
example.com/shop/widgets/all/all

or your own separator and a flatter directory structure:

example.com/shop/,,Acme
example.com/shop/,250-500,
example.com/shop/widgets,,


What are your main justifications for avoiding query strings in the
url? Apart from pure aesthetics I can see two main ones:
1. SEO
2. 'hackable URLs' that users can edit themselves.

Andy

On Jun 22, 7:56 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Hi
>
> I've got a bit of a problem as I'm now wishing to use more complex
> urls on my app and I'm not sure how to go about doing it the Django
> way.
>
> I've got an online store that can have filters placed on it like
> Price, Make, Category.
>
> Thing is when I wanted to use one of those it was simple:
>
> example.com/shop/cat/widgets
>
> However, I now want to use all of them.  I did think I could do:
>
> example.com/shop/widgets/250-500/FoobarCompany
>
> But it seems dodgy.
>
> Can anyone point me in the right direction on this?  I'm a bit lost.
>
> Really appreciate your input. :)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Unable to upload PNG's

2008-06-23 Thread Will Larson
Julian,

This is a PIL issue that appears to be biting a lot of people.  
Googling for "PIL PNG problem" will  help, but this link might be a  
good starting point.

Best,
Will

On Jun 23, 2008, at 6:02 PM, jurian wrote:

>
> I am currently getting an error when I attempt to upload a PNG image
> from the admin side.
>
> Error: Upload a valid image. The file you uploaded was either not an
> image or a corrupted image.
>
> There is nothing wrong with the image, and I've made sure that my PIL
> is setup correctly.
>
> 
> PIL 1.1.6 BUILD SUMMARY
> 
> version   1.1.6
> platform  linux2 2.5.2 (r252:60911, Mar 27 2008, 15:17:32)
>   [GCC 4.1.3 20070929 (prerelease) (Ubuntu
> 4.1.2-16ubuntu2)]
> 
> *** TKINTER support not available
> --- JPEG support ok
> --- ZLIB (PNG/ZIP) support ok
> --- FREETYPE2 support ok
> 
>
> Any clues will be appreciated, 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
-~--~~~~--~~--~--~---



Complex filtering

2008-06-23 Thread Deniz Dogan

Hello.

I have a model Students and another one called Course. The basic
structure is as follows:


class Student(models.Model):
  name = models.CharField()
  courses = models.ManyToManyField(Course)

class Course(models.Model):
  name = models.CharField()


Now I want to have a query set of all the courses in which all
students are named "John". How would I go about doing that?

Deniz
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: user profile is not getting saved in admin

2008-06-23 Thread Deniz Dogan

>From what I've heard it will be easier to do what we all seem to want
in the newforms-admin branch, which should be merged by the time of
the release of Django 1.0.

On Jun 21, 2:49 am, ristretto <[EMAIL PROTECTED]> wrote:
> You'd think, indeed.  I'm wondering if there's a work around or best
> practice way to handle it.  I noticed in the docs stating to wrap
> access to the user.get_profile() call around a try: except: and create
> it if you get an error.  But, I don't see how to do that simply in the
> Admin system.
>
> On Jun 21, 3:03 am, Deniz Dogan <[EMAIL PROTECTED]> wrote:
>
> > On 20 Juni, 05:26, <[EMAIL PROTECTED]> wrote:
>
> > > I have looked through the docs and search the group and web.  Seems 
> > > other's
> > > are asking the question, but I haven't seen an answer yet.
>
> > > class UserProfile(models.Model):
> > > country = models.ForeignKey(Country, core=True)
> > > user = models.ForeignKey(User, unique=True, 
> > > edit_inline=models.TABULAR,
> > > core=True)
>
> > > When Isavea User in theAdminpage, the country (from this UserProfile) is
> > > not getting saved.
>
> > > The list of Countries are shown in the menu, there are no errors, but the 
> > > DB
> > > table userprofile is empty, and when I come back to the Useradminpage, no
> > > country is selected.
>
> > > Seems that thesaveis getting dropped on the floor.
>
> > > I have
>
> > >   AUTH_PROFILE_MODULE = 'app.userprofile'
>
> > > set.  The system doesn't throw any errors.  Just doesn'tsave.
>
> > > I saw a post suggesting subclassing User and overriding saving tosavemy
> > >profile But, I can't find this recommended in the docs.  The documented way
> > > to  do this is has nothing to do with subclassing
>
> > > Please clarify.
>
> > I have the exact same problem. You'd think Django would have a neat
> > way of handling this, but it seems to me that it doesn't.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Url tag issues

2008-06-23 Thread Emily Rodgers

 

> -Original Message-
> From: django-users@googlegroups.com 
> [mailto:[EMAIL PROTECTED] On Behalf Of Rajesh Dhawan
> Sent: 20 June 2008 19:06
> To: Django users
> Subject: Re: Url tag issues
> 
> 
> Hi Emily,
> 
> 
> 
> > > >
> > > > The problems I am hitting are mainly to do with the {% url 
> > > > app.views.function keyword=optval %} tags to generate urls
> > > for my link bar.
> 
> 
> Firstly, as phillc suggests, it's a good idea to first name 
> your index page so it's easier to reference it in your url tags.
> 
> > > >
> > > > The combinations or parameters I want to use are:
> > > >
> > > > id
> > > > id + filter
> > > > filter
> > > > and sort_by (alone, or with any of the above combinations)
> 
> Since you need that kind of flexibility in which parameters 
> and combinations you can have, consider using query string 
> parameters instead of url path parameters.

This is what I would normally have done, but I got the impression that
this kinda went again what django is about, so I was trying to do it in
a more djangoesque way!! Perhaps I will just do it how I would have
before!!

Thanks for pointing out the obvious (that I had been stupidly
disregarding) to me :)

Em

-- 
IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium.  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: Problem logging in to admin using Safari

2008-06-23 Thread Pieter Claerhout

Absolutely, that was the first thing I checked ;-)

pieter

2008/6/23 TiNo <[EMAIL PROTECTED]>:
>
>
>> Looks like your browser isn't configured to accept cookies. Please
>> enable cookies, reload this page, and try again.
>>
>
> Well, are cookies enabled in Safari? (Prefs > Security > accept
> cookies)...
> >
>
>



-- 
pieter claerhout . [EMAIL PROTECTED] . http://www.yellowduck.be/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Unable to upload PNG's

2008-06-23 Thread jurian

I am currently getting an error when I attempt to upload a PNG image
from the admin side.

Error: Upload a valid image. The file you uploaded was either not an
image or a corrupted image.

There is nothing wrong with the image, and I've made sure that my PIL
is setup correctly.


PIL 1.1.6 BUILD SUMMARY

version   1.1.6
platform  linux2 2.5.2 (r252:60911, Mar 27 2008, 15:17:32)
  [GCC 4.1.3 20070929 (prerelease) (Ubuntu
4.1.2-16ubuntu2)]

*** TKINTER support not available
--- JPEG support ok
--- ZLIB (PNG/ZIP) support ok
--- FREETYPE2 support ok


Any clues will be appreciated, 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: Any suggestions on encryption methodology?

2008-06-23 Thread Peter Melvyn

On 6/23/08, Tye <[EMAIL PROTECTED]> wrote:

>  When the user hits submit, I want the SSN to be encrypted, stored in a
>  database (encrypted), read from a database (encrypted) by a secure,
>  authorized & authenticated connection, and decrypted somewhere along
>  the end of the line for appropriate viewing discretion.

This is exactly what Thales's solutions could do for you...

###

Time-to-time we had to implemented some encryption/decryption by
ourself, but each solution has at least one crucial point and it is
key management.

Typically, we use key compound of two independand keys generated from
passwords hold by two senior managers, which have to change their
password regularly (e.g. 4 weeks) and simultaneously -> data has to be
reencrypted once both password has been changed.

And to reencrypt huge amount of data under single transaction - it is
not an easy task - e.g. we fought with transaction log overflow etc...

And another potential problem are SQL expressions referring encrypted
data - to avoid full scan, you need encrypt a querying value before
SQL command is executed to be able use indeces.


Peter

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



Re: Problem logging in to admin using Safari

2008-06-23 Thread TiNo


> Looks like your browser isn't configured to accept cookies. Please
> enable cookies, reload this page, and try again.
>

Well, are cookies enabled in Safari? (Prefs > Security > accept
cookies)...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Where does Python store library reference settings?

2008-06-23 Thread bruno desthuilliers

On 23 juin, 08:50, MongooseNX <[EMAIL PROTECTED]> wrote:



> I'm very new to python and have what I hope is a simple question for
> regular users of python.
>
> scenario:
>
> I use python scripting with ESRI software (ArcMap).  Python 2.4 is
> installed when ArcMap is installed and using PythonWin I can access
> the ArcMap Geoprocessing libraries from ESRI.  For me it simply works
> out of the box and I don't have to think about it, but I've installed
> Eric4 (Python IDE) and it is for python 2.5 which when I use and try
> to import the ESRI libraries they are not recognized like in 2.4.
>
> Question:
> Where would I look to see what settings Python 2.4 uses to 'see' these
> libraries

http://docs.python.org/tut/node8.html#SECTION00812

> so I can hopefully duplicate the settings in 2.5?

If these libs use binary modules (Python extension modules coded in C
or C++...), this just won't work. In this case, you may have to either
get a python 2.5 compatible version of ArcMap (if such a thing exists)
or a python 2.4 compatible version of Eric.



> Thanks for any help or info.  Sorry this isn't a Django question per
> se, but this is the most active python group on Google groups,

Err... I'm not sure Django-users is much more active than
comp.lang.py, but even if that was the case, your question would still
belong there (http://groups.google.com/group/comp.lang.python).


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: dynamically filling ChoiceField

2008-06-23 Thread Thomas Guettler

Here is how you can modify the form at runtime. You can write
a constructor. In this example, I need the request for validation.

{{{
class TestForm(forms.ModelForm):
class Meta:
model=Filter_Test
def __init__(self, request, *args, **kwargs):
super(TestForm, self).__init__(*args, **kwargs)
self.request=request
...
}}}

You can set choices for fields after the super call. Example:

self.fields['myfield'].choices=choices

Calvin Dodge schrieb:
> I've been tearing out what little hair I have left trying to figure
> this out.
>
> How do I dynamically fill a ChoiceField by filtering on a value known
> to the URLView? Every "dynamic fill" example I've found assumes the
> form knows it all - I haven't seen anything which shows me how to pass
> that value from the view to the form.
>
>   

-- 
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Manipulating URLs

2008-06-23 Thread Tye

I knew I'd write a long, pseudo-detailed post, just to turn around and
find something so very simple.

I knew it!

Thanks Matthias :-)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Manipulating URLs

2008-06-23 Thread Matthias Kestenholz

On Mon, 2008-06-23 at 00:45 -0700, Tye wrote:
> [...]
>
> def message_send(request)
> # primary message_send logic goes here
> # . . .
> 
> if success:
> return HttpResponseRedirect('/message/success/')
> else:
> if failed_this_way:
> return HttpResponseRedirect(
> '/message/failed/this_way')
> if failed_that_way:
> return HttpResponseRedirect(
> '/message/failed/that_way')
> else failed_spectacularly:
> return HttpResponseRedirect(
> '/message/failed/spectacularly')
> 

Or use the messages system from django.contrib.auth:
http://www.djangoproject.com/documentation/authentication/#messages



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Any suggestions on encryption methodology?

2008-06-23 Thread Tye

Peter said:
"""
I don't know what kind of application you implement and how sensitive
data actually are
"""
Let sensitive data = social security number, credit card info

When the user hits submit, I want the SSN to be encrypted, stored in a
database (encrypted), read from a database (encrypted) by a secure,
authorized & authenticated connection, and decrypted somewhere along
the end of the line for appropriate viewing discretion.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Any suggestions on encryption methodology?

2008-06-23 Thread Peter Melvyn

On 6/23/08, Tye <[EMAIL PROTECTED]> wrote:

>  Say - for the sake of example - I'm accepting highly sensitive
>  financial data through a form over SSL.
>
>  Staff members need to retrieve that information at a later time.
>
>  Meanwhile, I want that data to be encrypted while it's sitting in the
>  database. What do you suggest?

I don't know what kind of application you implement and how sensitive
data actually are, but FYI, there are countries having strict enacts
of point-to-point encryption e.g. in banking e.g. between SIM in your
mobile phone as a client and AS400 as a banking host. No
decryption/reencryption in the middle.

AFAIK, *reliable* solution is *always* built on specialized HW, e.g.
http://www.thales-esecurity.com/solutions/Database_protection.shtml

HTH, Peter

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



Re: Manipulating URLs

2008-06-23 Thread Tye

@shravster –
In urls.py, have something like this:

# urls.py
from django.conf.urls.defaults import *
from mysite import views as root

urlpatterns = patterns('',
(r'^message/send/$',
root.message_send),
(r'^message/failed/(?P)/$',
root.message_failed),
(r'^message/succeeded/$',
root.message_succeeded),
)


And your view functions would look like this:

# views.py
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response

def message_send(request)
# primary message_send logic goes here
# . . .

if success:
return HttpResponseRedirect('/message/success/')
else:
if failed_this_way:
return HttpResponseRedirect(
'/message/failed/this_way')
if failed_that_way:
return HttpResponseRedirect(
'/message/failed/that_way')
else failed_spectacularly:
return HttpResponseRedirect(
'/message/failed/spectacularly')

def message_failed(request, error_message):
template = "%s.html" % error_message
render_to_response(template)

def message_success(request):
# balloons and confetti


Here's an idea: message_failed's template could
{% include "message_send.html" %}
or something more effective, to allow the user to see the error and
then – while in the same page – re-send a message.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Where does Python store library reference settings?

2008-06-23 Thread W·Tye·Rogers

You're trying to import a library, and it's coming up with an error,
right?

I'm thinking it's just not listed in your Python path (for ver 2.5),
so that version of Python has no idea where to find it unless you do
an include('/absolute/path').

So – here's my suggested solution:
Append the absolute directory of the library to your Python path.

1st: Find the path of the library in question
do this in Python 2.4:
>>> import sys
>>> print sys.path
and look for a directory that doesn't include "Python24"

2nd: Append the directory to your other Python version's path
do this in Python 2.5:
>>> import sys
>>> sys.path.append("c:/absolute/path/to/ESRI/library/")

Please reply with results.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Passing a Custom Form to a Generic View

2008-06-23 Thread [EMAIL PROTECTED]

Sometimes I want to leverage a Generic List or Detail view (as well as
their update/create counterparts) but have a small customization like
a special widget I'd like used in the display. This leads me to a few
questions:

1. Do the generic views utilize the new forms module?
2. Is there any way I can pass my own form instance into a generic
view?

I guess without this I basically have to abandon generic views for
much of my work...

thanx,

-- Ben Scherrey
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Where does Python store library reference settings?

2008-06-23 Thread MongooseNX

I'm very new to python and have what I hope is a simple question for
regular users of python.

scenario:

I use python scripting with ESRI software (ArcMap).  Python 2.4 is
installed when ArcMap is installed and using PythonWin I can access
the ArcMap Geoprocessing libraries from ESRI.  For me it simply works
out of the box and I don't have to think about it, but I've installed
Eric4 (Python IDE) and it is for python 2.5 which when I use and try
to import the ESRI libraries they are not recognized like in 2.4.


Question:
Where would I look to see what settings Python 2.4 uses to 'see' these
libraries so I can hopefully duplicate the settings in 2.5??


Thanks for any help or info.  Sorry this isn't a Django question per
se, but this is the most active python group on Google groups, and I
think it would be a simple question for most active python users.

Robert
http://www.smartmap.org


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



Manipulating URLs

2008-06-23 Thread shravster

Hi

I am creating my first serious project with Django and looking for
ways to play around with the urls. For instance lets say a user was
sending a message to another user from (current url on the browser) "/
send_message/"  and I want to redirect the user on posting the message
to /sent_messages/ or /failed_messages/ based on the success/failure
of the send_message operation, the 2 ways I can think of are:

1) HttpResponseRedirect("/failed_messages/?status=fail=Max+message
+count+reached) #or some such thing with messy urls

2) return show_failed_messages( request, message="Fail. Max message
count reached" ) #this would still show "/send_message/" for the URL
but the template rendered would be my_messages.html

Ideal case for me would be to call the show_failed_messages (or
show_sent_messages) view function with the HttpRequest object and
extra parameters for status messages etc, but somehow show the URL on
the browser as "/my_messages/" without all the get variables.

Hope I have worded my problem right. Any help is greatly appreciated!

Thanks in Advance,
S
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---