outer joins, raw sql or one-to-many?

2011-05-09 Thread Michel30
Hey all, I'm having trouble wrapping my head around querying multiple tables with relations between them. I'm writing an (cms-like) app that will use an existing mysql database. I modeled that, got my code up and running and am now in the process of trying to retrieve and submit data to it. Here i

Re: filter in python

2011-05-09 Thread Jani Tiainen
On Mon, 2011-05-09 at 06:15 -0700, pankaj sharma wrote: > i have 4 branches in a college.. > some college have three some have 4 and so on > so i want to provide a search system to the user that they can see the > list of all the colleges which are having some branch say branch2 may > be he can

Re: using django on a server?

2011-05-09 Thread Kenneth Gonsalves
On Mon, 2011-05-09 at 20:33 -0700, raj wrote: > I'm sort of new to all of this, why cloud computing? low end use webfaction medium use a vps high end go for a dedicated server or cloud -- regards KG http://lawgon.livejournal.com Coimbatore LUG rox http://ilugcbe.techstud.org/ -- You received th

Re: using django on a server?

2011-05-09 Thread Greg Donald
On Mon, May 9, 2011 at 11:02 PM, Eric Chamberlain wrote: > We use Amazon Web Services and can change our setup on an hourly basis. Do they support DNS yet, or are you still responsible for that yourself? -- Greg Donald destiney.com | gregdonald.com -- You received this message because you ar

Re: using django on a server?

2011-05-09 Thread Greg Donald
On Mon, May 9, 2011 at 10:33 PM, raj wrote: > I'm sort of new to all of this, why cloud computing? What exactly is > the advantage of it. Not depending on a host to provide software you have an interest in? > I'm not quite sure how all of this works. I > looked at the rackspace cloud website, an

Re: using django on a server?

2011-05-09 Thread Eric Chamberlain
Cloud computing is basically resources that you don't have to pay for when you don't use them and no long-term commitments. We use Amazon Web Services and can change our setup on an hourly basis. We just finished consolidating some low utilization servers with Amazon EC2. We cut our costs down

Re: Loading initial data with a post_syncdb hook?

2011-05-09 Thread Adam Seering
On May 9, 12:24 pm, Karen Tracey wrote: > On Mon, May 9, 2011 at 12:56 AM, Adam Seering wrote: > > On May 8, 10:53 pm, Karen Tracey wrote:> > > > The change you have noticed is documented in the 1.3 > > > backwards-incompatibility list: > >http://docs.djangoproject.com/en/1.3/releases/1.3/#use

Re: using django on a server?

2011-05-09 Thread raj
I'm sort of new to all of this, why cloud computing? What exactly is the advantage of it. I'm not quite sure how all of this works. I looked at the rackspace cloud website, and it looked confusing. Like a server is like greater than $750 a month. I'm not really connecting all the dots together. I d

Re: using django on a server?

2011-05-09 Thread Greg Donald
On Mon, May 9, 2011 at 6:25 PM, raj wrote: > what hosting websites > would handle it? Any host that does cloud-based virtual servers will work. I use Rackspace Cloud. Put on your sysadmin hat, spin up an instance and go. No real need to depend on a host to "support" anything nowadays. -- Gr

Looking for recommendations to replace vBulletin with a django based forum

2011-05-09 Thread Eric Chamberlain
Hello, We are thinking about replacing our low-usage vBulletin forum with a django integrated forum. Has anyone used djangobb, pybb, or askbot? -- Eric Chamberlain, Founder RF.com - http://RF.com/ -- You received this message because you are subscribed to the Google Groups "Django us

using django on a server?

2011-05-09 Thread raj
Hey guys, I'm sort of new to the whole web framework idea. I have very good knowledge of python and cgi scripting and I have a few questions about django. 1. What is the purpose of using a web framework like django? Could I get the same functionality by just using pythong cgi and python to access

performance of model instgance save()

2011-05-09 Thread Brian
Hi, I've been writing a testing to backfill a database (postgres) with a year's history to test the performance and I've been a bit surprised by the length of time it takes to run. I have a simple model that contains only a single datetime value and it seems (based on timing 1000 operations) that

Re: Error (EXTERNAL IP): /add_comment/10/

2011-05-09 Thread Ulrich Petri
> message = "Comment was was added to '%s' by '%s': \n\n%s" % (self.post, > self.author, self.body) Most likely your users are posting utf-8 data which you are trying to insert into a byte string . To fix this change that line to: message = u"Comment was was added to '%s' by '%s': \n\n%s" % (s

Re: DateTime in Django (Help)

2011-05-09 Thread Kenny Meyer
Oh! I have found a precious discussion on SO. http://stackoverflow.com/questions/38601/using-django-time-date-widgets-in-custom-form I think you might like the highest-voted solution. Kenny On Mon, May 9, 2011 at 9:28 PM, Kenny Meyer wrote: > s/sting/string > > On Mon, May 9, 2011 at 9:27 PM,

Re: DateTime in Django (Help)

2011-05-09 Thread Kenny Meyer
s/sting/string On Mon, May 9, 2011 at 9:27 PM, Kenny Meyer wrote: >> However, I keep getting validating errors with datetime, probably is >> how I am entering the data. I have also tried the SplitDateTimeWidget >> I am getting the same >> validation error > These are the valid input formats: > ht

Re: DateTime in Django (Help)

2011-05-09 Thread Kenny Meyer
> However, I keep getting validating errors with datetime, probably is > how I am entering the data. I have also tried the SplitDateTimeWidget > I am getting the same > validation error These are the valid input formats: http://docs.djangoproject.com/en/dev/ref/forms/fields/#django.forms.DateTimeFi

Re: Can't Test Apps Without Models?

2011-05-09 Thread Maksymus007
just create empty models,py file in your app folder. I don't know why,but thats how Django 'sees' your applications. Pozdrawiam, Maksymilian Pawlak 09-05-2011 23:58 użytkownik "protonpopsicle" napisał: > Is this a bug? > > If I run my unittest with './manage.py test myapp' and myapp does not > co

Re: Can't Test Apps Without Models?

2011-05-09 Thread Boštjan Mejak
You must create a tests.py file in your project's directory. Have your tests in that file. I am not sure on that one, but try. -- 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

Re: QUESTION

2011-05-09 Thread Boštjan Mejak
Don't do it like that. Do it like this: *manage.py* runserver -- 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 django-users+unsubsc

Can't Test Apps Without Models?

2011-05-09 Thread protonpopsicle
Is this a bug? If I run my unittest with './manage.py test myapp' and myapp does not contain a models.py file, the following error results: django.core.exceptions.ImproperlyConfigured: App with label fogbugz could not be found This error does not describe the problem. Also, shouldn't one be able

QUESTION

2011-05-09 Thread Amadou L .Diallo
I'am new in django and i have some: if i launch django-admin.py runserver i have this sentence iError: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined. help brother!! -- You received this message because you are subscribed to the G

Re: Encrpting urls to hide PKs

2011-05-09 Thread Cal Leeming [Simplicity Media Ltd]
Just to be clear, the issue I was referring to, was to not trust the data sent by the client. I.e. if you are allowing the user to access an object in the database, and not enforcing any restrictions other than client side UI, then this is bad. This topic spreads wa long cookies and

Re: Encrpting urls to hide PKs

2011-05-09 Thread Cal Leeming [Simplicity Media Ltd]
If you are looking for a quick and easy way to encrypt the URLs, why not create some Middleware which encrypts/decrypts them on the fly with a secret string from settings? Although, the URLs are going to look ugly as sin, and I wouldn't recommend this if you want decent SEO lol. Remember you

Re: Encrpting urls to hide PKs

2011-05-09 Thread Greg Donald
On Mon, May 9, 2011 at 8:15 AM, Brian Bouterse wrote: > In the name of not trusting any data coming from the client, one way that > IBM uses often is called continuations. I thought they were called cookies? > Basically you keep all data on the > server, and only give the client an identifier of

Re: Encrpting urls to hide PKs

2011-05-09 Thread Eric Chamberlain
On May 9, 2011, at 11:43 AM, ALJ wrote: > I was really looking for something lightweight. I didn't really want > to have to change the model structure to include a UUID ... although I > realise that this seems to way to go. I really just wanted to avoid > any 'opportunistic' attempts at extractin

Re: Loading project to alwaysdata

2011-05-09 Thread werefrog
Hi, From their wiki [1], they provide a link for activating your ssh account [2]. Then, you can connect from your client (they link to PuTTY [3]). I see that your host provides a browser based client [4]. Using a ssh client is really easy, you've done hardest things. Just install it, connect

forms.URLField and models.URLField not having the same default for verify_exists

2011-05-09 Thread etienned
verify_exists default to false in forms.URLField and defaults to True in models.URLField. Is there any reasons for that? It can lead to some troubles because it's easy for people to assume that both Fields have the same default. I understand that changing one or the other default now in Django wil

Re: Image upload from another website using image url

2011-05-09 Thread nederhoed
Hi Esam, first of all: form = Addpic(request.POST) Secondly, could you respond to my 3 suggestions, are they clear? Why would start processing the form before checking if it is valid? See also: http://docs.djangoproject.com/en/dev/topics/forms/ Good luck! RR On May 9, 8:45 pm, esam al deen w

Re: Encrpting urls to hide PKs

2011-05-09 Thread Shawn Milochik
There's no need to change your models to add UUIDs. You can just store a dict of UUID-to-primary key values in the session data. -- 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.

Re: Image upload from another website using image url

2011-05-09 Thread esam al deen
@nederhoed: what i need to to do is allow user to store files from anywhere include another web site , when user give me a file "browse button " i get it and store it, another method that user can give me file url >>www.example.com/main.jpg ,, i wrote the code that got the file and stored it into

Re: Encrpting urls to hide PKs

2011-05-09 Thread ALJ
I was really looking for something lightweight. I didn't really want to have to change the model structure to include a UUID ... although I realise that this seems to way to go. I really just wanted to avoid any 'opportunistic' attempts at extracting the data. The data itself isn't critical and not

Re: Image upload from another website using image url

2011-05-09 Thread esam al deen
@nederhoed: what i need to to do is allow user to store files from anywhere include another web site , when user give me a file "browse button " i get it and store it, another method that user can give me file url >>www.example.com/main.jpg ,, i wrote the code that got the file and stored it int

Re: boolwan field filter

2011-05-09 Thread nederhoed
A bit off topic, but I can't resist. Does a college really always have 4 "branches"? (I might be mistaken, but a branch sounds to me like a dynamic property.) I would consider using a many-to-many relation between colleges and branches. It would change your question a lot... class Branch(models.M

Re: ajax cart

2011-05-09 Thread nederhoed
Hi Pasha, 1. Try using a dict instead of a list: data = { 'items': [{'id':'2','quant':3},{'id':4','quant':1}] } 2. could you provide the relevant part of the view? I expect something like: from django.http import HttpResponse from django.utils import simplejson def update_cart(request):

Re: error on django admin

2011-05-09 Thread Karen Tracey
On Mon, May 9, 2011 at 3:32 AM, chhots wrote: > class Like(models.Model): > smartbuy = models.ForeignKey(SmartBuy) > User = models.ForeignKey(User) > def __unicode__(self): > return self.smartbuy or “Smartbuy #%d” % self.smartbuy > What are you trying to do here? If you are trying to do somethin

Re: How to use CreateView?

2011-05-09 Thread Boštjan Mejak
What if you add the dot to action, like above? What does that mean? And note that my form method is get. Anyone knows about what the dot does? -- 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@go

Re: How to use CreateView?

2011-05-09 Thread Bryan L
You need to specify "action"... what was the URI for the get form? The action should be the same. On Mar 11, 2:41 pm, hassan wrote: > Hi, > > I am testing django 1.3 class based generic views. I have a model like > this one: > > class Book(models.Model): >     name = models.CharField(max_leng

Re: Loading initial data with a post_syncdb hook?

2011-05-09 Thread Karen Tracey
On Mon, May 9, 2011 at 12:56 AM, Adam Seering wrote: > On May 8, 10:53 pm, Karen Tracey wrote:> > > The change you have noticed is documented in the 1.3 > > backwards-incompatibility list: > http://docs.djangoproject.com/en/1.3/releases/1.3/#use-of-custom-sql-... > > Actually, that's a different

Re: DateTime in Django (Help)

2011-05-09 Thread Kevin Miller
Thanks so much for your response. I have done all that and I have model forms working for other models. However, I keep getting validating errors with datetime, probably is how I am entering the data. I have also tried the SplitDateTimeWidget I am getting the same validation error. I have tried man

Re: DateTime in Django (Help)

2011-05-09 Thread Kenny Meyer
On Mon, May 9, 2011 at 10:55 AM, Kevin Miller wrote: > Dear all, > > I am new to django but is in the process of building my first website. I have > been ok for a while as I am not new to programming in python. However, I have > one problem that I cannot figure out the proper way to do it. I want

Re: Many2many field and ModelChoiceField

2011-05-09 Thread Roodie
Hello, Thanks, yes, that was my idea when I mentioned manual handling. I just wanted to ask since it is quite common for me to miss a relevant parameter or a small note in the documentation ;-) On máj. 9, 17:21, Shawn Milochik wrote: > You can exclude that field from your ModelForm and manually

Re: Many2many field and ModelChoiceField

2011-05-09 Thread Shawn Milochik
You can exclude that field from your ModelForm and manually add in a new field with just the option(s) you want. Then override the save() of your ModelForm to set the proper value of self.cleaned_data or self.instance to the value from your custom field. -- You received this message because

Re: Image upload from another website using image url

2011-05-09 Thread nederhoed
Hi Esam, If I understand you correctly, you want to preserve the image data even if the user used an invalid value in another form field, rendering the form invalid? You could: 1. add the image to the user's session, without saving it to the DB. 2. add the image URL to the user's session, showing

best framework/reusable app for caching model instances (object level cache) ?

2011-05-09 Thread stargazer
What is the best framework/library/reusable app for caching model instances in Django? (This approach is also known as transparently object cache, ORM cache, row-level object cache, object level cache) The are reausable apps implementing this. The problem is there are so many of them! Here what I

Re: Error (EXTERNAL IP): /add_comment/10/

2011-05-09 Thread Aragorn
This is line 44: message = "Comment was was added to '%s' by '%s': \n\n%s" % (self.post, self.author, self.body) another one more thing I do not understand, I put 6 post in the blog , where I insert the comment to Nr. 4 in the article the comment is accepted and I get e-mail. When I put the co

DateTime in Django (Help)

2011-05-09 Thread Kevin Miller
Dear all, I am new to django but is in the process of building my first website. I have been ok for a while as I am not new to programming in python. However, I have one problem that I cannot figure out the proper way to do it. I want to use ModelForm but have a DateTime Field. I can do it with

Re: Django filefield

2011-05-09 Thread nederhoed
Hi Pulkit, This could be of help too: http://docs.djangoproject.com/en/dev/ref/forms/api/#binding-uploaded-files-to-a-form Do not forget to add the multipart to your form element: Store the file on your filesystem, store the path to the file in your database. Cheers, RR On May 8, 10:32 pm, P

Image upload from another website using image url

2011-05-09 Thread esam al deen
i want to make an image uploader using images links on the internet (eq: .example.com/image.jpg). The user writes the previous url and then my model upload it. This my code: form>> view.py def Post_date(): if request.method == 'POST': form = Addpic()#simple form to capture data image_url

Many2many field and ModelChoiceField

2011-05-09 Thread Roodie
Hello, I have a small issue, I am sure the solution is simple, but I couldn't find it (I blame Monday). I have a model with a Many2Many field, and I have a few forms for editing that model. Everything is working fine there. In one specific case however I have to produce a form where the user can s

Ann: django-photofile released - thumbnail generation with automatic rotation based on Exif.Orientation

2011-05-09 Thread Thomas Weholt
Just released a simple reusable app with a templatetag for thumbnail generation, with support for automatic rotation based on Exif.Orientation. Looked at sorl-thumbnail and friends, but none of them featured automatic rotation based on Exif.Orientation. http://pypi.python.org/pypi/Django-Photofile

Re: django admin site and debug

2011-05-09 Thread bitgandtter
i try your advices but didnt work i dont know why because the admin pattern should handle this urls On May 4, 3:01 pm, Ivan <492...@gmail.com> wrote: > Try to replace your patern '^admin/' this '^admin/$', or swap > ( r'^admin/', include( admin.site.urls ) ) > and ( r'', include( 'role.company.url

Re: error on django admin

2011-05-09 Thread Oleg Lomaka
Try to add __unicode__ method to your SmartBuy model that returns string. On Mon, May 9, 2011 at 10:32 AM, chhots wrote: > class Like(models.Model): > smartbuy = models.ForeignKey(SmartBuy) > User = models.ForeignKey(User) > def __unicode__(self): > return self.smartbuy or “Smartbuy #%d” % self.

Re: Format a python date

2011-05-09 Thread Sithembewena Lloyd Dube
Hi Oleg, Thanks so much! Your examples (specifically the last one) do what I need. I had done a very ugly hack in my view, which involved slicing the dates, switching the slices around and converting to datetime objects again - not clean at all. I have taken that out and just went with your solut

Re: ajax select box

2011-05-09 Thread Goodwin
I've used "Django smart selects" recently for what you want to do and it worked well - https://github.com/digi604/django-smart-selects Goodwin -- 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@go

error on django admin

2011-05-09 Thread chhots
class Like(models.Model): smartbuy = models.ForeignKey(SmartBuy) User = models.ForeignKey(User) def __unicode__(self): return self.smartbuy or “Smartbuy #%d” % self.smartbuy i have this model which is both fields are foreign key from other table and when i tri to add some in this model through djna

Re: Encrpting urls to hide PKs

2011-05-09 Thread Brian Bouterse
In the name of not trusting any data coming from the client, one way that IBM uses often is called continuations. Basically you keep all data on the server, and only give the client an identifier of that data. This typically enforces a server-side state

Re: filter in python

2011-05-09 Thread pankaj sharma
i have 4 branches in a college.. some college have three some have 4 and so on so i want to provide a search system to the user that they can see the list of all the colleges which are having some branch say branch2 may be he can select branch 3 and 4 and 1 also so i am taking a query from the

Re: Encrpting urls to hide PKs

2011-05-09 Thread Cal Leeming [Simplicity Media Ltd]
To be honest, I'd be careful when using this approach. If you are intending on hiding the PKs, as a way to stop people hitting PKs they shouldn't be able to hit, then this means your security model is flawed from the ground up. However, if you are doing it to stop PKs from being leaked, then this

Re: Format a python date

2011-05-09 Thread Oleg Lomaka
You can format your python date in template using datefilter. Also your default date format depends on your current locale. And you can change your date format in settings.py by setting DATE_FORMAT

Re: Encrpting urls to hide PKs

2011-05-09 Thread Oleg Lomaka
Take a look at django-registration app. With slight modification it should satisfy your requirements. For URL encryption, you can generate some sort of UUID and save in your database that such UUID corresponds to given profile PK. django-registration uses such urls for email confirmation. On Mon,

Re: ajax cart

2011-05-09 Thread Oleg Lomaka
you your answer object is 'data', for example, then data[0].id data[0].quant On Mon, May 9, 2011 at 1:56 PM, Паша Тявин wrote: > Hello. I'm newbie and trying to make a simple shopping cart using anonymous > session under ajax control. > I have a special url "/update_cart/" for only post request

Encrpting urls to hide PKs

2011-05-09 Thread ALJ
I have a form that I use to collect contact information from unregistered users. When they submit the form I want to redirect to a confirmation page (as the Django documentation suggests). However, instead of a generic page, I wanted to include the information that they have submitted and the conta

Re: filter in python

2011-05-09 Thread Jani Tiainen
Since I'm not really good at reading people minds, can you clarify your question, preferably with code how your view/form/query does work now and how you have tried to resolve this particular problem and where the problem then is. On Mon, 2011-05-09 at 03:50 -0700, pankaj sharma wrote: > thanks fo

boolwan field filter

2011-05-09 Thread pankaj sharma
hello .. i am having a database of college which have a name city state branches etc... so class College(models.Model): name = models.CharField(max_length=250) city = models.ForeignKey(City) branch1 = models.BooleanField(default=False, blank=True) branch2 = models.BooleanField(default=

ajax cart

2011-05-09 Thread Паша Тявин
Hello. I'm newbie and trying to make a simple shopping cart using anonymous session under ajax control. I have a special url "/update_cart/" for only post request from the the page "/product/" and I made a dictionary "request.session['cart']" with a text like [{'id':'2','quant':3},{'id':4','quan

Re: filter in python

2011-05-09 Thread pankaj sharma
thanks for ur answer jani but i didn't get it . as i am getting one query for branch {which is Qbranch} so where i use this? On May 8, 10:40 pm, Jani Tiainen wrote: > On Sun, 2011-05-08 at 09:59 -0700, pankaj sharma wrote: > > hello .. > > > i am having a database of college  which have a name ci

unpredictable CSRF error on mobile devices

2011-05-09 Thread nederhoed
Hi everyone, just a few users of our website get an CSRF error when trying to log on using a mobile device. This behavior only occurs with about 3 out of 150 users. We have 2 colleagues with the same device (iPhone) of which one of the two has this problem. The other hasn't. The user can login usi

Re: Problem in Configuring the database

2011-05-09 Thread Stuart MacKay
Rajul, If disk space is a problem why did you install VMWare and SUse - it should be easier to run MySQL directly on Windows. If you are using a viurtual machine then the VMWare installation, SUSE and then MySQL is going to take a lot more space. At this point I would use SQLite just to get

Format a python date

2011-05-09 Thread Sithembewena Lloyd Dube
Hi all, I am using a jquery datepicker control on a page of mine, and it formats the date different than the django admin datepicker. (MM-DD-YYY). If I have a date in that format, how can I format it to DD-MM-? I have tried using strftime with no success. -- Regards, Sithembewena Lloyd Dube