Re: how to open a new page when clicking a url

2009-09-22 Thread li kai
Jani Tiainen, Thanks. It works. On Wed, Sep 23, 2009 at 1:40 PM, Jani Tiainen wrote: > > That is something that is not Django specific but can be found in HTML > specification. > > HINT: "target" attribute in ""-tag. > > Depending on browser (and/or plugins in browser)

Re: how to open a new page when clicking a url

2009-09-22 Thread Jani Tiainen
That is something that is not Django specific but can be found in HTML specification. HINT: "target" attribute in ""-tag. Depending on browser (and/or plugins in browser) results may vary. li kai kirjoitti: > Suppose I have these items in my homepage's header. > > * E-shop

Re: how to open a new page when clicking a url

2009-09-22 Thread li kai
Suppose I have these items in my homepage's header. - E-shop - E-coupon source code : E-shop E-coupon Now, I click the "E-shop" item, it will jump to the E-shop address in my current web

Re: how to open a new page when clicking a url

2009-09-22 Thread Jani Tiainen
li kai kirjoitti: > Hi, > > How to implement this in my template html file? > > When an user clicks an url address, a new webpage will pop up. That is standard behaviour of any browser that I know of. Or did you meant something else? -- Jani Tiainen

how to open a new page when clicking a url

2009-09-22 Thread li kai
Hi, How to implement this in my template html file? When an user clicks an url address, a new webpage will pop up. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send

Re: Multi table inheritance and reverse lookup

2009-09-22 Thread Jani Tiainen
Jani Tiainen kirjoitti: > model.py: > > from django.db import models > > class Order(models.Model): > name = models.CharField(max_length=64) > > def __unicode__(self): > return self.name > > class Product(models.Model): > name = models.CharField(max_length=64) > >

Re: django forum

2009-09-22 Thread Wiiboy
Looking at the demo, I think that is the best Python forum I've ever seen. Congrats. This would be my site's saving grace. However, I installed all the necessary programs, and I get "Cannot import name utils" from djapian. If you ever read this again, perhaps you could help with that?

Re: Efficiently searching a tree of FKs

2009-09-22 Thread Rama Vadakattu
Below are some thoughts on how to do the above efficiently: 1) Create a temporary table (or Model) with two fields Class Temp(...): personid = FK(Person) searchstring = TextField() 2) When every a

Re: wierd apache and mod_python problem with templates

2009-09-22 Thread Graham Dumpleton
On Sep 22, 11:41 pm, andreas schmid wrote: > hi, > > im expierencing a strange problem on my server with mod_pyton. > > while testing my project on the server launching it with runserver > everything looks fine. > > using apache and mod_python the templates at the root of

Python 2.6.2 + Django 1.1 fails to install..

2009-09-22 Thread Jon Cage
I have Python installed and working but when I try and install Django using: python setup.py install ..it chunters through a load of stuff and then fails: creating C:\Python26\Lib\site-packages\django\contrib\localflavor\sk copying build\lib\django\contrib\localflavor\sk\forms.py -> C:

Trouble implementing "Password Reset"

2009-09-22 Thread Matt H.
I'm trying to implement Django 1.0.2's "Forgot Password" feature. I've got far enough that http://127.0.0.1:8000/password_reset/ displays a form asking for my email address. So far, so good. However, once I submit the email address for my (django) account I get a TemplateSyntaxError: Here is the

Re: limit_choices_to & get_sql()

2009-09-22 Thread Daniel Roseman
On Sep 22, 10:16 pm, Nicolas Steinmetz wrote: > Hello, > > I would like to present only a subset of a given models. But so far, > in the admin, I have no value whereas there should be some. > > I tried several syntax but did not find the right one. > > Here are my

Slugify doesn't match pre-populated slug field.

2009-09-22 Thread Amos
I have an Admin form with a slugfield prepopulated from the name of the news item I'm creating. In one of my templates I have a link created using the slugify filter applied to the name of the news item. When I create an object with a name such as "A New Story" the prepoulated field contains

limit_choices_to & get_sql()

2009-09-22 Thread Nicolas Steinmetz
Hello, I would like to present only a subset of a given models. But so far, in the admin, I have no value whereas there should be some. I tried several syntax but did not find the right one. Here are my implicated (and simplified) models : class Dns(models.Model): """ DNS description

Re: dJango updating fields which are not being set

2009-09-22 Thread Daniel Roseman
On Sep 22, 8:59 pm, PlanetUnknown wrote: > Thanks Tom. > > But with this approach - > > > foo = Foo.objects.get(pk=foo_id) > > foo.field = new_value > > foo.save() > > There is an extra DB call, first the the data, and then another one to > save it. > If you have the

Re: passing information from a form instance to a field in that form

2009-09-22 Thread Daniel Roseman
On Sep 22, 8:59 pm, Jim wrote: > Hello, > > I have a widget that makes suckerfish menus (the kind of menu that is > written in css and where if you hover your mouse over a menu item any > subitems appear). > > I have some data that can be displayed according to three

ConFoo.ca call for speakers

2009-09-22 Thread Yannick Gingras
Greetings Djangoers, I'm coordinator for the Python track at the ConFoo.ca conference and I have an announcement to make that will certainly be of interest to many of you. PHP-Québec, Montréal-Python, Ruby Montréal, W3Qc, and OWASP Montréal are organizing the first edition of the ConFoo.ca

Re: URL Parameter is not found, 404 error

2009-09-22 Thread Malcolm MacKinnon
Thanks for your help, Daniel. I made the change. On Mon, Sep 21, 2009 at 11:47 PM, Daniel Roseman wrote: > > On Sep 22, 2:31 am, Malcolm MacKinnon wrote: > > Thanks, Karen. With your help, I manged to fix it. > > Note that - quite apart from your

Re: Finding unique ForeignKey enties.

2009-09-22 Thread Joshua Russo
On Tue, Sep 22, 2009 at 7:23 PM, MV wrote: > > I have a Movie model > and I have a Image model > the Image model has a ForeignKey(Movie) > > Each Movie has an arbitrary amount of Images. > > I have a view where I list all the Movies. > For each Movie entry, I want one

Finding unique ForeignKey enties.

2009-09-22 Thread MV
I have a Movie model and I have a Image model the Image model has a ForeignKey(Movie) Each Movie has an arbitrary amount of Images. I have a view where I list all the Movies. For each Movie entry, I want one Image. How do I do that? I can do a "movies = Movies.objects.all()" and pass "movies"

Re: dJango updating fields which are not being set

2009-09-22 Thread PlanetUnknown
Thanks Tom. But with this approach - > foo = Foo.objects.get(pk=foo_id) > foo.field = new_value > foo.save() There is an extra DB call, first the the data, and then another one to save it. If you have the primary_key with you, only one should suffice. I mean, when we step back and look at the

passing information from a form instance to a field in that form

2009-09-22 Thread Jim
Hello, I have a widget that makes suckerfish menus (the kind of menu that is written in css and where if you hover your mouse over a menu item any subitems appear). I have some data that can be displayed according to three dimensions. (For instance, I could characterize contributers by gender,

Re: download file

2009-09-22 Thread J. Cliff Dyer
That should do what you are trying to do, though I would say it was better before. You essentially broke the web. Let your users know that it is a PDF, and let them decide whether to download or open the file themselves. That should be a browser-side decision. If your users want to save it,

Merge models?

2009-09-22 Thread Almost George
Wondering if there is already work being/been done on making it easy to merge models. It may be much easier than I think, but I thought I would ask anyway. Here's my specific scenario: On a site where users contribute a good deal of content, someone might come across a piece of content that

Re: msgfmt error while attempting to compile po files

2009-09-22 Thread DjangoDragon
That did it. Thanks :D On Sep 21, 5:14 pm, Ramiro Morales wrote: > On Mon, Sep 21, 2009 at 4:51 PM, DjangoDragon wrote: > > > Whenever I try to compile the po files to mo files using 'python > > django-admin.py compilemessages' command i get the error: >

Re: Saving ModelForm with commit=False seems to be generating an INSERT in the database

2009-09-22 Thread Parag Shah
Thanks, you both are right. user_form.save() is causing the INSERT of the related UserProfile object. The User object in question here is django.contrib.auth's User object. It knows about the UserProfile model object from the following line in settings.py AUTH_PROFILE_MODULE =

Multi table inheritance and reverse lookup

2009-09-22 Thread Jani Tiainen
model.py: from django.db import models class Order(models.Model): name = models.CharField(max_length=64) def __unicode__(self): return self.name class Product(models.Model): name = models.CharField(max_length=64) def __unicode__(self): return self.name

Re: dJango updating fields which are not being set

2009-09-22 Thread Tom Evans
On Tue, 2009-09-22 at 08:13 -0700, PlanetUnknown wrote: > I'm sure I'm missing something simple here, since its a common flow - > > 1.) e.g. model Person - has 4 fields - > person_id = models.AutoField(primary_key=True) > person_name = models.CharField(max_length=50) > comments =

Re: File storage: Filesystem vs Database

2009-09-22 Thread Tom Evans
On Tue, 2009-09-22 at 08:12 -0700, Charles Wang wrote: > I have a question for "make apache deliver it". How to control the > access right? Integrate apache access auth model with Django? > > On Sep 22, 10:37 pm, Javier Guerra wrote: > > On Tue, Sep 22, 2009 at 8:09 AM,

extending comments views

2009-09-22 Thread anentropic
Hi, I am trying to extend the comments app so that I can use an alternate view for post_comment in some situations (i.e. posting via ajax...) This question is probably largely down to relative python ignorance on my part, but 1) I have made a new app in my project and set COMMENTS_APP in

Re: Using 'django-filter' on a field with choices

2009-09-22 Thread Godshall
I ran into the same problem a few weeks ago. I solved it by manually entering a blank field into my filter choices. Yours could look like this: TICKET_STATUS_CHOICES = ( ('new', 'New'), ('accepted', 'Accepted'), ('assigned', 'Assigned'), ('reopened', 'Reopened'), ('closed',

Re: File storage: Filesystem vs Database

2009-09-22 Thread Javier Guerra
On Tue, Sep 22, 2009 at 10:12 AM, Charles Wang wrote: > I have a question for "make apache deliver it". How to control the > access right? Integrate apache access auth model with Django? not exactly, the idea is that the file isn't under apache's DocumentRoot, so it won't

Re: File storage: Filesystem vs Database

2009-09-22 Thread Jonas Obrist
Thanks to both Javiers! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to

Re: File storage: Filesystem vs Database

2009-09-22 Thread Javier Rivera
Charles Wang escribiu: > I have a question for "make apache deliver it". How to control the > access right? Integrate apache access auth model with Django? X-Send-File could send any file that apache can access not only files on the "www path". It can send a file that is not accessible by url

Re: File storage: Filesystem vs Database

2009-09-22 Thread Charles Wang
I have a question for "make apache deliver it". How to control the access right? Integrate apache access auth model with Django? On Sep 22, 10:37 pm, Javier Guerra wrote: > On Tue, Sep 22, 2009 at 8:09 AM, Jonas Obrist wrote: > > I wanna store files

dJango updating fields which are not being set

2009-09-22 Thread PlanetUnknown
I'm sure I'm missing something simple here, since its a common flow - 1.) e.g. model Person - has 4 fields - person_id = models.AutoField(primary_key=True) person_name = models.CharField(max_length=50) comments = models.TextField(blank=True) create_dt =

success story - thanks to all

2009-09-22 Thread mettwoch
Hi, I'd just like to share with you all a great moment. We switched today from our old inventory/invoicing app to a new Django/PostGreSQL based solution. Thank you so much for all the kind hints and help that I got over the last 3 month and that helped getting to this point. Some facts: - Up to

opener.dismissAddAnotherPopup error tinymce

2009-09-22 Thread Ali Rıza Keleş
Hi all, There is something strange with popups on admin page while this page includes tinymce editor. When i click to add a relating object, a popup is being opened and i enter values and try to save. It is saved but popup is not closed and give this error on firefox: """

Re: ImportError: Could not import settings 'WWlove.settings'

2009-09-22 Thread Jose Sibande
File permissions "seems" to have been the problem. Website is now up and running after trying almost everything (I felt like the day I lost my phone security number). Thank you for the responses. On Sep 22, 1:48 am, Graham Dumpleton wrote: > On Sep 21, 7:50 am, Jose

Re: File storage: Filesystem vs Database

2009-09-22 Thread Javier Guerra
On Tue, Sep 22, 2009 at 8:09 AM, Jonas Obrist wrote: > I wanna store files (attachments to forum posts) outside the MEDIA_ROOT > to restrict file downloads to registered users. So I'd have to server > them through django instead of apache. What would be the better way to >

Efficiently searching a tree of FKs

2009-09-22 Thread Jeff Gentry
Hello ... I have a tree like structure created out of models using ForeignKey linkages. As an example: Model Person: name = CharField Model Book: name = CharField author = FK(Person) Model Movie: name = CharField director = FK(Person) Model Album: name = CharField

Re: Django, MySQL, unicode

2009-09-22 Thread mechanix
I have recently faced the same thing while developing a Django app that processes emails too. But I found a quick fix, unicode() accepts argument, that tells it what to do when it stumbles upon non-valid character: email.mail_from = unicode(email['From'], errors = 'ignore') Possible values for

Re: Form Select Selected Choice

2009-09-22 Thread Leonel Nunez
>>> Can you give a more detailed example of your code? >>> >> >> This is what basically I'm doing: >> >> >> class MyForm(forms.Form): >> myfield = forms.CharField(widget=forms.Select) >> >> >> C =[] >> u = User.objects.all() >> for r in u: >> l1 = [] >> l1.append(r.id) >>

Re: Form Select Selected Choice

2009-09-22 Thread Leonel Nunez
>> Can you give a more detailed example of your code? >> > > This is what basically I'm doing: > > > class MyForm(forms.Form): > myfield = forms.CharField(widget=forms.Select) > > > C =[] > u = User.objects.all() > for r in u: > l1 = [] > l1.append(r.id) >

Re: How can I refresh iframe use the django?

2009-09-22 Thread Tom Evans
On Tue, 2009-09-22 at 21:41 +0800, List Mail wrote: > When something changed, I want refresh iframe page and pass some > values to the iframe > > such as when addMethod(a, b) is invoked, the iframe will be refreshed > and use the parameter a and b > > def addMethod(a, b) > //need refresh

How can I refresh iframe use the django?

2009-09-22 Thread List Mail
When something changed, I want refresh iframe page and pass some values to the iframe such as when addMethod(a, b) is invoked, the iframe will be refreshed and use the parameter a and b def addMethod(a, b) //need refresh the iframe and pass the value a and b to the iframe I know I

wierd apache and mod_python problem with templates

2009-09-22 Thread andreas schmid
hi, im expierencing a strange problem on my server with mod_pyton. while testing my project on the server launching it with runserver everything looks fine. using apache and mod_python the templates at the root of the templates dir in my project are loaded but all the others

{{ change }} and {{ add }} in admin

2009-09-22 Thread Peter2108
When the admin renders a change-form it supplies two boolean variables change and add. 'change' is True when changing an existing instance and 'add' when adding a new one. Is this behaviour documented because I find the variables are quite useful? -- Peter

Re: Comments and objects

2009-09-22 Thread Daniel Roseman
On Sep 22, 2:07 pm, Rodney Topor wrote: > Suppose a user posts a comment about a particular object, using > django.contrib.comments, as described in Practical Django Projects. > How can one get access to this object in a template such as > posted.html, so that one can include

File storage: Filesystem vs Database

2009-09-22 Thread Jonas Obrist
Hi django-users I wanna store files (attachments to forum posts) outside the MEDIA_ROOT to restrict file downloads to registered users. So I'd have to server them through django instead of apache. What would be the better way to do this: Store them in a the database or store them in the

Comments and objects

2009-09-22 Thread Rodney Topor
Suppose a user posts a comment about a particular object, using django.contrib.comments, as described in Practical Django Projects. How can one get access to this object in a template such as posted.html, so that one can include a link directly back to the object?

IN query problem with 2 for loops on a template

2009-09-22 Thread hinnack
I have 2 querysets: events = event_dates.objects.select_related('evid', 'evid__type', 'evid__category').all() inner_qs = event_dates.objects.all().values('pk').query loc = locations.objects.filter(locid__in=inner_qs).all() render_to_response('backup.xml', {'events': events, 'locations': loc,

Re: Pseudo random order for Paginator

2009-09-22 Thread Tim Chase
> I need ordering units in random order, but keep the order for browsing > per pages and also keep the order for changeable filtering options, > like startswith and contains. What are the best solutions? There is > huge amount of units and I read the order by RANDOM() or especialy > MySQL RAND()

Re: Django templated: iterating through fields in a database record

2009-09-22 Thread Gonzalo Delgado
El Mon, 21 Sep 2009 08:43:57 -0700 (PDT) Paul Lundberg escribió: > Hi: > I have several Django applications running and I am trying to tidu up > some code. > > I am trying to make a generic way of viewing a database table on a web > page using a YUI control. > > I am

Re: About using django-tinymce

2009-09-22 Thread Joost Cassee
On 22 sep, 08:17, taijirobot wrote: > well, guys, I've solved this problem, but in a bad way. > > Since I'm running the site locally with the default django server, the > MEDIA_URL became a confusing thing to me. Luckily I have an Apache > server running on my machine,

specifying test-only dependencies with djangorecipe

2009-09-22 Thread Chris Withers
Hi Jeroen, I use two libraries a lot of the time when I'm testing: http://pypi.python.org/pypi/testfixtures http://pypi.python.org/pypi/mock However, I only use these in testing and don't really want them deployed for bin/django, only for bin/test. How would I go about doing this? cheers,

Re: Prefix primary key

2009-09-22 Thread Tim Bowden
2009/9/22 Michael Anckaert : > > Hello everyone, > > I'm sure this is something that has been done before, I just can't > figure out (or google) how to do it. > > I want to create PK's on a model that are in the form of 2009001, > 2009002, 2009003, etc. Simple creating

Prefix primary key

2009-09-22 Thread Michael Anckaert
Hello everyone, I'm sure this is something that has been done before, I just can't figure out (or google) how to do it. I want to create PK's on a model that are in the form of 2009001, 2009002, 2009003, etc. Simple creating a model method that appends the year is not an option because I need

Re: Records doesn't sometimes get upated

2009-09-22 Thread Daniel Roseman
On Sep 22, 9:48 am, Szymon wrote: > On 21 Wrz, 22:47, Javier Guerra wrote: > > > only if you include it in the parameter list: > > Oh, yes. I forget about self in my example, but in function that makes > problem there is of course self in parameter list. I

Re: Using shell to add images

2009-09-22 Thread Richard
No sorry it's late was just typing up the scenario to be more ledgible (i'm doing a lot with random) meant while x < 20. Basically looks like this to add a single image model: from django.core.files import File from job.models import Job, JobPhoto job = Job.objects.get(pk=1544) lp = JobPhoto()

Re: multi-db vs. data warehouse

2009-09-22 Thread nausikaa
Hi snfctech With warehouse I assume you mean keeping the datasources and periodic transfer into a central db (the warehouse). Why not migrate all your datasources into e.g. a PostgreDQL db? It is easy to write forms and implement logins/access rights in django so that your non-technical users

Re: Using shell to add images

2009-09-22 Thread nausikaa
Hi Timboy Sorry but I've never seen: for x in 20: # do sth. 20 is an int object and not an iterable. Is this snippet your code? Nausikaa On Sep 22, 10:15 am, Timboy wrote: > Having issues saving model from within the shell. > > Using File from from

Re: Records doesn't sometimes get upated

2009-09-22 Thread Szymon
On 21 Wrz, 22:47, Javier Guerra wrote: > only if you include it in the parameter list: Oh, yes. I forget about self in my example, but in function that makes problem there is of course self in parameter list. --~--~-~--~~~---~--~~ You received

Re: composite primary keys?

2009-09-22 Thread nausikaa
Hi Chris I hope this helps: http://code.djangoproject.com/ticket/373 So there is a "patch" but I didn't try it. The way I worked around it was by adapting my db model. Assuming you have an existing db you might want to try the patch. Nausikaa On Sep 22, 10:17 am, Chris Withers

Re: download file

2009-09-22 Thread luca72
i Have solved using this: luca = HttpResponse(open('/home/luca72/webapps/django/myproject/ disegni/'+nome, 'rb').read(), mimetype='application/octet-stream') luca['Content-Disposition'] = 'attachment; filename='+nome return luca Is it ok or i can make it better Thanks Luca On 22 Set, 10:05,

composite primary keys?

2009-09-22 Thread Chris Withers
Hi All, Is it really the case that the Django ORM doesn't support composite primary keys? I'm looking to do the equivalent of the following sqlalchemy model: Base = declarative_base(...) class Month(Base): __tablename__ = 'months' username = Column(

Using shell to add images

2009-09-22 Thread Timboy
Having issues saving model from within the shell. Using File from from django.core.files import File http://pastebin.com/f3030ca1e Tried this several different ways... TIA --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: download file

2009-09-22 Thread luca72
So i have try this: file_da_scar = F_d.objects.get(pk=id) nom = file_da_scar.nome_fil return HttpResponse(open('/home/luca72/webapps/django/myproject/ disegni/'+nom+'.pdf', 'r').read(), mimetype='application/pdf') And it open the pdf file, but if i need only to download without open it

Re: download file

2009-09-22 Thread luca72
So i have try this: file_da_scar = F_d.objects.get(pk=id) nom = file_da_scar.nome_fil return HttpResponse(open('/home/luca72/webapps/django/myproject/ disegni/'+nom+'.pdf', 'r').read(), mimetype='application/pdf') And it open the pdf file, but if i need only to without open it how i can

Confirming GeoDjango OSMAdmin Bug

2009-09-22 Thread Kevin Systrom
Hey all, I've been having an issue using the filter on a GeoQuerySet with Django 1.1. I have a "Locations" table that looks more or less like this: class Location(models.Model): pnt = models.PointField() name = models.CharField(max_length=255) To query, I look for an object like this:

Re: About using django-tinymce

2009-09-22 Thread Daniel Roseman
On Sep 22, 7:17 am, taijirobot wrote: > well, guys, I've solved this problem, but in a bad way. > > Since I'm running the site locally with the default django server, the > MEDIA_URL became a confusing thing to me. Luckily I have an Apache > server running on my

Re: About using django-tinymce

2009-09-22 Thread Daniel Roseman
On 2009/9/22, taijirobot wrote: > Thank you very much. The problem was solved after I changed the > MEDIA_URL setting. > > But now I have a new question, it is about the display of the rich > text. > > I used code like this to display it: > > {{ post.title }} > {{

Re: download file

2009-09-22 Thread luca72
Thanks I use cherry py because i don't know how to download file with django, can you tell me how to do it with django regards Luca On 14 Set, 12:46, "J. Cliff Dyer" wrote: > On Mon, 2009-09-14 at 07:57 -0700, luca72 wrote: > > Hello i have try with cherrypy but i get

Re: URL Parameter is not found, 404 error

2009-09-22 Thread Daniel Roseman
On Sep 22, 2:31 am, Malcolm MacKinnon wrote: > Thanks, Karen. With your help, I manged to fix it. Note that - quite apart from your original problem - you've got a serious inefficiency in this view. You iterate through every customer to find a matching customer number

Pseudo random order for Paginator

2009-09-22 Thread gentlestone
Hello, I need ordering units in random order, but keep the order for browsing per pages and also keep the order for changeable filtering options, like startswith and contains. What are the best solutions? There is huge amount of units and I read the order by RANDOM() or especialy MySQL RAND() is

Re: About using django-tinymce

2009-09-22 Thread taijirobot
well, guys, I've solved this problem, but in a bad way. Since I'm running the site locally with the default django server, the MEDIA_URL became a confusing thing to me. Luckily I have an Apache server running on my machine, so I just set the MEDIA_URL to 'http:// localhost/media/' and copied the