Re: Newbie: how to tell a URL for a page?

2010-07-28 Thread BobAalsma
This question has been in the forum for about almost a week & no response. So please help a newbie out: is it too easy or too difficult to answer? On Jul 24, 7:29 pm, BobAalsma wrote: > I'm working on a programme where I want the user to register comments > on a third

User Registration: Looking for tips

2010-07-28 Thread strayhand
I'm using the auth module for my project and I've got a registration form that's based on the "UserCreationForm" provided by "django.contrib.auth.forms" but it's only showing the username and password fields. I want a registration process that requires users to fill out ALL of the "User" fields

Re: Python/Django hosting

2010-07-28 Thread Horst Gutmann
Have you already looked through this list? http://djangofriendly.com/hosts/ -- Horst On Wed, Jul 28, 2010 at 9:41 PM, kostia wrote: > Our startup http://github.com/vaxXxa/projector has to be hosted > somewhere. > > I'm looking for someone who can help. > > Be happy, >

Re: File sharing service on Django?

2010-07-28 Thread Artem
Well, that's what I intended to do - a least I would know a file is started to download. Problem is - way of file transfer. I got something like: response = HttpResponse(open('/way/to/file/test.rar'), mimetype='application/x-rar-compressed') response['Content-Disposition'] = 'attachment;

Re: Newbie: how to tell a URL for a page?

2010-07-28 Thread BobAalsma
This question has been in the forum for about almost a week & no response. So please help a newbie out: is it too easy or too difficult to answer? On Jul 24, 7:29 pm, BobAalsma wrote: > I'm working on a programme where I want the user to register comments > on a third

Re: Newbie: how to tell a URL for a page?

2010-07-28 Thread BobAalsma
This question has been in the forum for about almost a week & no response. So please help a newbie out: is it too easy or too difficult to answer? On Jul 24, 7:29 pm, BobAalsma wrote: > I'm working on a programme where I want the user to register comments > on a third

Re: Newbie: how to tell a URL for a page?

2010-07-28 Thread BobAalsma
This question has been in the forum for about almost a week & no response. So please help a newbie out: is it too easy or too difficult to answer? On Jul 24, 7:29 pm, BobAalsma wrote: > I'm working on a programme where I want the user to register comments > on a third

Re: Newbie: how to tell a URL for a page?

2010-07-28 Thread BobAalsma
This question has been in the forum for about almost a week & no response. So please help a newbie out: is it too easy or too difficult to answer? On Jul 24, 7:29 pm, BobAalsma wrote: > I'm working on a programme where I want the user to register comments > on a third

Re: MySQL error -1

2010-07-28 Thread shacker
Well, I think I've got a culprit on this one. I was seeing occasional "/tmp is out of space" messages from the server lately as well, and wondered whether these two things might be connected. It's a VPS and the /tmp partition is locked at 100MBs - can't be made larger. So I reconfigured mysql to

ModelChoiceField Question

2010-07-28 Thread Carlos Daniel Ruvalcaba Valenzuela
Hello list, I was wondering which would be the best way to handle this situation with ModelChoiceFields: I have a form with a ModelChoiceField, the options presented in this field may change at the view depending on the user, however, ModelChoiceField requires the queryset to be given as a

Re: Best way to present N items in table row for list

2010-07-28 Thread Rainy
On Jul 27, 12:51 pm, Wadim wrote: > Hello. > I have a list that i want to present in a table. > Each row should have 5 items. > For now i create the function that returns me new grouped list, that i > use later in a template. > def groupListByRow(list): >        

Re: Django 1.2 modelformset_factory fails with meta: widgets

2010-07-28 Thread Jason
Traceback: File "C:\Python25\lib\site-packages\django\core\handlers\base.py" in get_response 100. response = callback(request, *callback_args, **callback_kwargs) File "C:\Documents and Settings\goodrich\PycharmProjects\CCC\Aggregator \newsmail\views.py" in manage_articles

Re: Django INNER JOIN

2010-07-28 Thread Roald de Vries
On Jul 28, 2010, at 6:02 PM, kostia wrote: Well, I used projects = projects.filter(favourites__user = request.user) And then I tired to order by 'date' field, which is in the Favourite model like here: projects = projects.filter(favourites__user = request.user)#.order_by(filter_field) And it

Re: Django doesn't load css

2010-07-28 Thread Andreas Pfrengle
Hallo everyone, thanks for the many answers, the problem is solved. There must have been an error in the urls.py. Now it works with the static serving: # from urls.py: site_media = os.path.join(os.path.dirname(__file__), 'site_media') urlpatterns += patterns('', url(r'^site_media/(?P.*)$',

Python/Django hosting

2010-07-28 Thread kostia
Our startup http://github.com/vaxXxa/projector has to be hosted somewhere. I'm looking for someone who can help. Be happy, Kostia. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Django doesn't load css

2010-07-28 Thread kostia
static is a folder, it is not a view our project code can be found here http://github.com/vaxXxa/projector You may look at and compare. Good luck. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Django 1.2 modelformset_factory fails with meta: widgets

2010-07-28 Thread Daniel Roseman
On Jul 28, 7:08 pm, Jason wrote: > For example: > > class ArticleForm(ModelForm): >     class Meta: >         model = Article >         widgets = { >              'pub_date': SplitSelectDateTimeWidget(), >              'expire_date': CalendarWidget(attrs={'class':'date- >

Django 1.2 modelformset_factory fails with meta: widgets

2010-07-28 Thread Jason
For example: class ArticleForm(ModelForm): class Meta: model = Article widgets = { 'pub_date': SplitSelectDateTimeWidget(), 'expire_date': CalendarWidget(attrs={'class':'date- pick'}) } And in a view function: ... ArticleFormSet =

Re: Django doesn't load css

2010-07-28 Thread Daniel Roseman
On Jul 28, 4:21 pm, Andreas Pfrengle wrote: > Hi, > > we've been trying for hours now to include a css-file in our project, > but it just doesn't work and we don't know why. We've already reduced > the project to the absolute minimum of necessary code: >

Re: Django doesn't load css

2010-07-28 Thread Antoni Aloy
2010/7/28 Andreas Pfrengle : > Hello Kostia, > > I get a template syntax error with your method, since I haven't > defined a "static" view. How does your static-view look like? > I've already tried it like described here -->

How to access a MySQL table in Django?

2010-07-28 Thread snipinben
I have the python-mysqldb installed already and i have django up and running. when i installed the python-mysqldb i had to hack the code kind of so that it didnt check if the versions were the same so that it would work. I got this idea from online. but anyways, I am wondering how to access

Re: Django doesn't load css

2010-07-28 Thread Andreas Pfrengle
Hello Kostia, I get a template syntax error with your method, since I haven't defined a "static" view. How does your static-view look like? I've already tried it like described here --> but I don't get it work either, I get a TypeError: bad operand type for unary +: 'list' for the urlpattern

Re: Calculate distance between 2 latitude/longitude Point

2010-07-28 Thread !!CONDORIOUS!!
(lat , lon in radians) pt 1 = lat, lon, alt=0 pt 2 = lat, lon, alt=0 p1_gcc = gd2gcc(p1) p1_gcc = gd2gcc(p2) gd2gcc ( is a standard operation found on the itnernet) dis = sqrt(sum(pow(p1_gcc-p2-gcc, 2))) cheers, 2010/7/28 Alexandre González : > Hi! I'm using the Django

Re: Calculate distance between 2 latitude/longitude Point

2010-07-28 Thread Alexandre González
I've tested it yet multiplying in miles and kilometers but the result if K miles/kms instead the correct result. Thanks for your reply. On Wed, Jul 28, 2010 at 19:00, Bill Freeman wrote: > Having done my geo distance by "hand" instead of Django GEOS, it may not > be

Thumbnail and separated media server approach

2010-07-28 Thread Michel Thadeu Sabchuk
Hi guys, I manage a Brazilian free ads portal and recently I migrated the static files to rackspace cloud files [1] (Amazon S3 like). Now the site open much faster but the media files are still in the same server of django. I couldn't migrate the dynamic media files to rackspace cloud files

Re: Calculate distance between 2 latitude/longitude Point

2010-07-28 Thread Bill Freeman
Having done my geo distance by "hand" instead of Django GEOS, it may not be relevant, but have you tried multiplying the result you get by the radius of the earth? Most formulas for this kind of thing are applicable to any size sphere, not just the earth, and return the distance as an angle, as

Re: generate cache by visiting protected links

2010-07-28 Thread Jirka Vejrazka
> i have cache enabled on a few heavy statistical views. > I would like to generate the pages before a user goes to that page and maybe > even > regenerate the pages every hour to avoid the initial delay. > However, i can't seem to automate the caching as my site's authentication > gets in the

Re: Using sqlite3 to test locally

2010-07-28 Thread Zo
I had not, i ran it and created a superuser. should I be changing my setting file for my user info? I also changed DATABASE_ROUTERS = [] because it was previously set to ['test.ReportAdmin.routers.ReportAdminRouter'] and I went back to DATABASES = { 'default' : {

Re: Django doesn't load css

2010-07-28 Thread Antoni Aloy
the css should be {% MEDIA_URL %} but you have to be sure you pass the RequestConext on your render_to_response method. If you're are on the development server you have to add additional urls to urls.py to serve static content. Is explained in the docs, but I suppose some examples you'll be

Re: MySQL error -1

2010-07-28 Thread Dennis Kaarsemaker
On wo, 2010-07-28 at 00:18 -0700, shacker wrote: > On Jul 27, 2:49 pm, Dennis Kaarsemaker wrote: > > Are the tracebacks all the same? Can you share a traceback? > > Sure, here's one (search/replaced to make it generic): > > http://dpaste.com/222645/ > > It's happening

Re: django storage chinese failed to mysql!!

2010-07-28 Thread Dennis Kaarsemaker
Those settings are not all. You need to check the table definition with either describe or show create table. On wo, 2010-07-28 at 19:40 +0800, pengbo xue wrote: > I have checked mysql database, maybe have no issue, but still show the > same error.detail as below: > > mysql> SHOW VARIABLES

Re: Django doesn't load css

2010-07-28 Thread kostia
I use in settings.py: MEDIA_ROOT = os.path.join(os.path.dirname(__file__), 'main', 'templates', 'static').replace('\\', '/') MEDIA_URL = '/static/' And then simply in an html file: Where the full folder path is the ../project_name/main/templates/ static/styles/nav.css -- You received

Re: HTTP POST sent from app to Django Server returns 403 Forbidden

2010-07-28 Thread Kieran Farr
Thanks, David -- you're right on, now I just return an HttpResponse with result code 404. Benedict, could you post the view for /management/statistics/top/user/ yearly/ that is causing the 403? Kieran On Jul 28, 6:47 am, steven314 wrote: > @etone: has this

Re: Using sqlite3 to test locally

2010-07-28 Thread Shawn Milochik
Did you run ./manage.py syncdb? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For

Using sqlite3 to test locally

2010-07-28 Thread Zo
Hello, I am trying to configure my django project to use sqlite3. As of now I do not have database creation permission for SQL, so i decided to try and do my prototyping locally. I set the following: DATABASES = { 'default' : { 'NAME' :

Django doesn't load css

2010-07-28 Thread Andreas Pfrengle
Hi, we've been trying for hours now to include a css-file in our project, but it just doesn't work and we don't know why. We've already reduced the project to the absolute minimum of necessary code: #settings.py: PROJECT_PATH =

Re: Django INNER JOIN

2010-07-28 Thread kostia
Well, I used projects = projects.filter(favourites__user = request.user) And then I tired to order by 'date' field, which is in the Favourite model like here: projects = projects.filter(favourites__user = request.user)#.order_by(filter_field) And it throws me an error: "Cannot resolve keyword

Re: Best way to present N items in table row for list

2010-07-28 Thread Daniel Hilton
On 27 July 2010 17:51, Wadim wrote: > Hello. > I have a list that i want to present in a table. > Each row should have 5 items. > For now i create the function that returns me new grouped list, that i > use later in a template. > def groupListByRow(list): >        

Re: moving to django 1.2.1

2010-07-28 Thread dan levine
One issue that bit me that has also been mentioned here in other threads: errors that were previously caught are now raised as errors. So technically it was wrong previously but functionally it only breaks on 1.2. I haven't found a good explanation / summary of what/why/ which errors it now

Re: Django INNER JOIN

2010-07-28 Thread Roald de Vries
On Jul 28, 2010, at 5:19 PM, kostia wrote: Thank you very much Roald, What is faster: projects = Project.objects.filter(favourites__user = request.user) or select_related('project') ? I think it doesn't matter much, but if one is faster, it should be the first one. If you only use

Re: Django INNER JOIN

2010-07-28 Thread Daniel Roseman
On Jul 28, 4:16 pm, backdoc wrote: > > > > > >    fav_and_projs = ((f, f.project) for f in favourites) > > This may not be a Django question. But, I'm not familiar with this syntax. > Is this returning a tuple for ever item in favourites?  So, fav_and_projs > would be a

Re: Django INNER JOIN

2010-07-28 Thread kostia
Thank you very much Roald, What is faster: projects = Project.objects.filter(favourites__user = request.user) or select_related('project') ? Kostia -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Django INNER JOIN

2010-07-28 Thread backdoc
> >fav_and_projs = ((f, f.project) for f in favourites) > This may not be a Django question. But, I'm not familiar with this syntax. Is this returning a tuple for ever item in favourites? So, fav_and_projs would be a tuple of tuples, like ((f1, f.project1), (f2, fproject2), .(fn,

Re: Django INNER JOIN

2010-07-28 Thread Roald de Vries
Dear Kostia On Jul 28, 2010, at 2:29 PM, kostia wrote: I have a model Favourite with fields User, Project, Date, what means that some user put some project as favourite on some date. I take all favourites filtered by this user and I want to INNER JOIN that info with Project model. How can I do

Re: Django INNER JOIN

2010-07-28 Thread kostia
Still need your help -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options,

Re: File sharing service on Django?

2010-07-28 Thread Christoph
Hi Artem, I don't know about it specifically but I have one possible solution. That may not be what you want and I'd like to hear critique on it: Have a model with fields id (or url or slug), status and filename (and more if you wish). This could be filled with: id=42, status=no_downloads_yet,

Re: moving to django 1.2.1

2010-07-28 Thread Massimiliano Ravelli
On 28 Lug, 15:44, knight wrote: > Does anybody knows a good post or blog about the changes including > csrf? I forgot to suggest reading http://docs.djangoproject.com/en/dev/releases/1.2/#backwards-incompatible-changes-in-1-2 -- You received this message because you are

Re: moving to django 1.2.1

2010-07-28 Thread Massimiliano Ravelli
On 28 Lug, 15:33, Maksymus007 wrote: > The same all the sentences link '1.1 and 1.2 are compatible'. > They are not. You are right: that page doesn't mention csrf changes. I upgraded few installations from 1.0 and from 1.1 to 1.2 and the only undocumented change I remember

Re: HTTP POST sent from app to Django Server returns 403 Forbidden

2010-07-28 Thread steven314
@etone: has this discussion of CSRF enabled you to hunt down your problem? Steven. On Jul 26, 4:30 pm, etone wrote: > Hi there, > > I'm trying to sent a HTTP POST from a client application to my Django > app.  Django does indeed receive the HTTP POST as I do hit >

Re: moving to django 1.2.1

2010-07-28 Thread knight
Does anybody knows a good post or blog about the changes including csrf? On Jul 28, 4:33 pm, Maksymus007 wrote: > On Wed, Jul 28, 2010 at 3:29 PM, Massimiliano Ravelli > > wrote: > > On Jul 28, 3:13 pm, knight wrote: >

Re: moving to django 1.2.1

2010-07-28 Thread knight
Is anybody knows a good post or blog about these thing including csrf changes? On Jul 28, 4:33 pm, Maksymus007 wrote: > On Wed, Jul 28, 2010 at 3:29 PM, Massimiliano Ravelli > > wrote: > > On Jul 28, 3:13 pm, knight

Re: Filtering within a ModelForm

2010-07-28 Thread derek
On Jul 26, 6:52 pm, "Casey S. Greene" wrote: > Does anyone have a hint for this (or an idea of where to get started in > the documentation)?  This seems relatively simple so my best guess is > that there is something that I am just missing. > > Thanks! > -- Casey > > On

Re: Filtering within a ModelForm

2010-07-28 Thread derek
On Jul 26, 6:52 pm, "Casey S. Greene" wrote: > Does anyone have a hint for this (or an idea of where to get started in > the documentation)?  This seems relatively simple so my best guess is > that there is something that I am just missing. > > Thanks! > -- Casey > > On

Re: moving to django 1.2.1

2010-07-28 Thread Maksymus007
On Wed, Jul 28, 2010 at 3:29 PM, Massimiliano Ravelli wrote: > On Jul 28, 3:13 pm, knight wrote: >> What are the minimal changes that I need to make in order to work with >> 1.2.1? > > Did you have a look at >

Re: moving to django 1.2.1

2010-07-28 Thread Massimiliano Ravelli
On Jul 28, 3:13 pm, knight wrote: > What are the minimal changes that I need to make in order to work with > 1.2.1? Did you have a look at http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges ? -- You received this message because you are subscribed to the

Calculate distance between 2 latitude/longitude Point

2010-07-28 Thread Alexandre González
Hi! I'm using the Django GEOS API [1] in my project to see the distance between two users. I get the coordinates from google maps in latitude/longitude mode and I need to calculate the distance between them. I'm testing with .distance() method at GEOSGeometry but I receive a strange value. This

Re: Django INNER JOIN

2010-07-28 Thread kostia
import datetime from django.db import models from django.utils.translation import ugettext_lazy as _ from django.contrib.auth.models import User class Project(models.Model): author = models.ForeignKey(User, verbose_name=_('Author'), related_name='projects') title =

moving to django 1.2.1

2010-07-28 Thread knight
Hi, I have pretty big django app running on django 1.0.2 and I want to move it to django 1.2.1 since I want to use multiple databases. What are the minimal changes that I need to make in order to work with 1.2.1? I mean, what should I do regarding csrf and so on... Is there a good place to read

Re: Help:How to post data to the admin form by urllib2 ?

2010-07-28 Thread Benedict Verheyen
On 27/07/2010 17:48, jerry wrote: > Hi: > I build a website and want to login the admin form by python code. I > have disabled the CSRF in my project and use urllib2 to post data. > here are my codes: >

Re: HTTP POST sent from app to Django Server returns 403 Forbidden

2010-07-28 Thread Benedict Verheyen
On 28/07/2010 3:54, Kieran Farr wrote: > Further research shows that CSRF is enabled regardless of my > settings.py if we use Django's built-in auth. > > Obviously, we need to still use Django's auth, so we can't just > disable CSRF site-wide like this hack: >

Re: Django INNER JOIN

2010-07-28 Thread Sævar Öfjörð
It would help if you submitted your models - Sævar On Jul 28, 2:29 pm, kostia wrote: > I have a model Favourite with fields User, Project, Date, what means > that some user put some project as favourite on some date. I take all > favourites filtered by this user and I

Simple Admin interface question - change header?

2010-07-28 Thread Derek
I'm sure this is simple... but, how do I change the header text that appears at the top of every change list? i.e. instead of "Select XXX to change", I'd like to have "List of XXX's" (where XXX's is the plural form of the object name) Is this in an admin template and, if so, which one? Thanks

Re: MySQL error -1

2010-07-28 Thread Michael
On Wed, Jul 28, 2010 at 3:18 AM, shacker wrote: > On Jul 27, 2:49 pm, Dennis Kaarsemaker wrote: > > Are the tracebacks all the same? Can you share a traceback? > > Sure, here's one (search/replaced to make it generic): > > http://dpaste.com/222645/

Django INNER JOIN

2010-07-28 Thread kostia
I have a model Favourite with fields User, Project, Date, what means that some user put some project as favourite on some date. I take all favourites filtered by this user and I want to INNER JOIN that info with Project model. How can I do that? Something like projects =

Re: Help:How to post data to the admin form by urllib2 ?

2010-07-28 Thread Rory Hart
On Wed, Jul 28, 2010 at 1:48 AM, jerry wrote: > Hi: > I build a website and want to login the admin form by python code. I > have disabled the CSRF in my project and use urllib2 to post data. > here are my codes: > >

Re: implementing next and previous of the object

2010-07-28 Thread Sævar Öfjörð
It's probably best to do this in a custom Manager. This code is based on this answer: http://markmail.org/message/kwwuskco4gilej2w You get the idea class GetPrevNextManager(models.Manager): def get_next_by_id(self, object): qs = self.filter(id__gt=object.id) if qs.count() >

Re: django storage chinese failed to mysql!!

2010-07-28 Thread pengbo xue
I have checked mysql database, maybe have no issue, but still show the same error.detail as below: mysql> SHOW VARIABLES LIKE 'character%'; +--+ -+ | Variable_name| Value |

Re: HTTP POST sent from app to Django Server returns 403 Forbidden

2010-07-28 Thread David De La Harpe Golden
On 28/07/10 03:45, Kieran Farr wrote: > Finally figured out what's going on. > > My hypothesis: > An HTTP request with POST method sent to a Django view wrapped with > @csrf_exempt will still raise a 403 CSRF error if the wrapped view > raises an Http404 exception. > Ah, but was your handler404

generate cache by visiting protected links

2010-07-28 Thread Benedict Verheyen
Hi, i have cache enabled on a few heavy statistical views. I would like to generate the pages before a user goes to that page and maybe even regenerate the pages every hour to avoid the initial delay. However, i can't seem to automate the caching as my site's authentication gets in the way of

Re: HTTP POST sent from app to Django Server returns 403 Forbidden

2010-07-28 Thread steven314
If it is a CSRF issue, then perhaps using this setting will help you get to the bottom of what's going on: http://docs.djangoproject.com/en/dev/ref/contrib/csrf/#rejected-requests As it says there, a 403 may be due to a lack of the {% csrf_token %} in the form that is being posted. Steven. --

Re: Can't figure out how to leverage a complex session object in a template?!?

2010-07-28 Thread Daniel Roseman
On Jul 28, 6:24 am, iJames wrote: > HI, > > I've got a session object which is a dict.  I'm using it to track the > state of screen elements (an expanding tree). > > request.session['mystate'] = {'1':'true', '2','false'} > > In my template I'm looping through the branches:

Re: MySQL error -1

2010-07-28 Thread shacker
On Jul 27, 2:49 pm, Dennis Kaarsemaker wrote: > Are the tracebacks all the same? Can you share a traceback? Sure, here's one (search/replaced to make it generic): http://dpaste.com/222645/ It's happening on various (and unrelated) pages, but the tracebacks are all

Can't figure out how to leverage a complex session object in a template?!?

2010-07-28 Thread iJames
HI, I've got a session object which is a dict. I'm using it to track the state of screen elements (an expanding tree). request.session['mystate'] = {'1':'true', '2','false'} In my template I'm looping through the branches: object.id is 1 object.id is 2 So: I want to test:

Re: django-admin-tools

2010-07-28 Thread gnarmis
Thanks for that link up there, David, solved my (similar, but not really similar) problem. Although this has me concerned about deployment issues... -gnarmis On Jun 1, 8:46 am, izi wrote: > Hi, > > As I said in my previous mail, you should bring this to the django- >

Re: django-admin-tools

2010-07-28 Thread gnarmis
nevermind my last mail, solved. Helpful link: http://docs.djangoproject.com/en/1.1/howto/static-files/#howto-static-files On Jun 1, 8:46 am, izi wrote: > Hi, > > As I said in my previous mail, you should bring this to the django- > admin-tools mailing

Re: django-admin-tools

2010-07-28 Thread gnarmis
Hi, I had a somewhat similar question. I've followed the setup and when the dashboard, etc, are uncommented in installedapps, i merely get a stripped down version of the admin page without the default styling. Mine is a local development server. The command prompt is posting this: [TIMESTAMP]