Re: Database design question

2007-04-25 Thread Doug Van Horn
On Apr 25, 3:16 pm, "Kai Kuehne" <[EMAIL PROTECTED]> wrote: > > I'm a bit confused on how do it 'right(tm)'. Is there a > rule or how would you do it? > You're asking about surrogate and natural keys: http://en.wikipedia.org/wiki/Surrogate_key http://en.wikipedia.org/wiki/Natural_key

Re: How do I pass label's attributes in newforms

2007-04-25 Thread Brian Rosner
On 2007-04-25 17:27:26 -0600, RollyF <[EMAIL PROTECTED]> said: > > canen, > > Thank you for your reply but I am not sure if I am getting this right. > I am getting an "Exception Value: __init__() got an unexpected > keyword argument 'attrs'" with the following code > > class

Re: new to django, please advise w/ some questions and concerns

2007-04-25 Thread Graham Dumpleton
On Apr 26, 8:10 am, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote: > On 4/25/07, Jin Lee <[EMAIL PROTECTED]> wrote: > > 5) Using apache, can you run a pool of django processes so that if one user > > is doing something particularly heavy, it doesnt slow down the entire site? > > (Basically what you do

Re: contextual ForeignKey?

2007-04-25 Thread Drasty
Thanks for the suggestion. Even if it doesn't work--I haven't really looked at Generic Relations before--it'll be fun figuring out how to play with them. I'll put something up if I figure out anything useful, either here or at djangosnippets.org Erik On Apr 25, 7:01 pm, "Russell Keith-Magee"

Re: contextual ForeignKey?

2007-04-25 Thread Russell Keith-Magee
On 4/25/07, Erik Vorhes <[EMAIL PROTECTED]> wrote: > > Since I'm only reviewing one thing in each Review, it'd be possible to > change ForeignKey to OneToOneField, but (aside from likely changes to > the way Django handles one-to-one relationships), that doesn't change > my predicament. > > I'd

Re: Initial Data for Django Classes?

2007-04-25 Thread Russell Keith-Magee
On 4/26/07, Greg Taylor <[EMAIL PROTECTED]> wrote: > Greetings, > > I was wondering if there's a way to include initial data for Django classes. > I noticed that there is a way to do so via a 'sql' subdirectory under your > own models, but didn't see any indication if there was a way to do this

Re: How do I pass label's attributes in newforms

2007-04-25 Thread RollyF
canen, Thank you for your reply but I am not sure if I am getting this right. I am getting an "Exception Value: __init__() got an unexpected keyword argument 'attrs'" with the following code class CreateGuestUserForm(forms.Form): first_name = forms.CharField(label='First Name',

Re: "mpm-prefork" vs. "mpm-worker"

2007-04-25 Thread Graham Dumpleton
On Apr 25, 7:10 pm, Atilla <[EMAIL PROTECTED]> wrote: > I personally find it Very bad to bind Django users to 1 apache worker > model, considering how the Apache modules progress and the performance > you can get out of using clever configurations. Can you elaborate on this further? I often see

Re: new to django, please advise w/ some questions and concerns

2007-04-25 Thread Jeremy Dunck
On 4/25/07, Jin Lee <[EMAIL PROTECTED]> wrote: ... > 1) how fast is django in Windows, specifically w/ SQL Server? Most people use Django under Linux, but I understand many people use apache + prefork + mod_python with good success. > 2) Are there any known bugs or shortcomings with the SQL

Re: How do I pass label's attributes in newforms

2007-04-25 Thread canen
You would use the attrs argument when declaring the field. . first_name = CharField('First name', attrs={'class': 'left'}) . On Apr 25, 1:02 pm, RollyF <[EMAIL PROTECTED]> wrote: > How do I do this using newforms if I want my output to be: > > First name: > > I want to know how to pass

Django Captcha (solution, with code)

2007-04-25 Thread [EMAIL PROTECTED]
I'm pretty new to django, but I did recently convert my personal site to be primarily django based. This is primarily a blog application, with a few little site-specific extras. I soon realized that I'd need some kind of comment spam prevention, but found the existing Django captcha solutions

Re: Database design question

2007-04-25 Thread dballanc
Why not do both. I've always preferred letting the database generate an auto primary key (id in django) even if my usage is primarily a different column for key. Storing an int isn't wasting much space, what do you have to lose? I've got a users object for example that requires a unique email

Re: Database design question

2007-04-25 Thread Kai Kuehne
A point that I missed was the speed. Is method 1) maybe faster than method 2? I think it could.. because in 1) there are only numbers stored as primary_key and not strings (which can be as long as 255 characters). Speed is one thing.. but is there any other difference between the two methods?

Re: Database design question

2007-04-25 Thread Kai Kuehne
Hi, On 4/25/07, Mike Caldwell <[EMAIL PROTECTED]> wrote: > I don't think there is a "right(tm)" way, but there are some things to > consider. A lot of people would argue that a unique characteristic makes a > very good primary key, I think I might be one of them. But, remember that > data

Re: Database design question

2007-04-25 Thread Mike Caldwell
I don't think there is a "right(tm)" way, but there are some things to consider. A lot of people would argue that a unique characteristic makes a very good primary key, I think I might be one of them. But, remember that data reflects the real world. In general, a person's name isn't very

new to django, please advise w/ some questions and concerns

2007-04-25 Thread Jin Lee
Hello everyone, I am a contract programmer new to python and django, but have been using Java (8 years) and Ruby (2-3 years). First, a quick story: I utilize RoR quite extensively for a number of clients. One particular client I have is on Win 2003 Server, Apache, SQL Server and RoR. I feel

Database design question

2007-04-25 Thread Kai Kuehne
Hello list, I have a question regarding general database design. Ok.. which method would you recommend, if you have a table with a field 'name' which values should be unique in the whole table? 1) use (implicit) id which is automatically added by django, as primary key and a 'name' field with

Re: import problem

2007-04-25 Thread Michael K
On Apr 24, 4:19 pm, kamil <[EMAIL PROTECTED]> wrote: > Thanx Michael for your attention. > I'm using todays build from svn trunk. > I started project from the beginning to eliminate possibility that its > something wrong with my code. > > when I run "python manage.py runserver" everything seams

Re: Initial Data for Django Classes?

2007-04-25 Thread [EMAIL PROTECTED]
You can use fixtures. In your application folder, create a "fixtures" folder and in that folder create a "initial_data.json" file. Populate it like this: [ { "pk": 1, "model": "application.Contact", "fields": { "name": "Vincent" } } ] And when you run syncdb, the data

Re: Primary key field can be empty

2007-04-25 Thread Jason McVetta
On 4/25/07, Ramiro Morales <[EMAIL PROTECTED]> wrote: > > Try adding blank=False explicitely because it works > at the admin UI level so it doesn't know about database > primary keys and such. I have experienced the same bug. I have a model that sets its primary key like this:

How do I pass label's attributes in newforms

2007-04-25 Thread RollyF
How do I do this using newforms if I want my output to be: First name: I want to know how to pass the "class" to the output. TIA, Rolly --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To

Philippine Celebrity Image Gallery

2007-04-25 Thread chikaz bigboss
Here are the collection of Philippine Celebrities Images. Feast on them. - * Aleck Bovick * (5) - *Alicia Meyer * (24) - *Aliya

Re: Primary key field can be empty

2007-04-25 Thread Kai Kuehne
Hi, On 4/25/07, Ramiro Morales <[EMAIL PROTECTED]> wrote: > Try adding blank=False explicitely because it works > at the admin UI level so it doesn't know about database > primary keys and such. I thoght "implies" means "automatically added". Well, I will try add it manually... seems like a

Re: Named URL patterns to use prefix?

2007-04-25 Thread Ryan Kanno
Already a ticket? Shoot, I swore I searched, but I couldn't find one. Sorry about that - my apologies. (http://code.djangoproject.net/ticket/4129) _RK On Apr 24, 6:32 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Tue, 2007-04-24 at 15:21 +, Ryan Kanno wrote: > > I'm just curious

Re: Initial Data for Django Classes?

2007-04-25 Thread [EMAIL PROTECTED]
Sorry for the double reply, I didn't think my first mail went through. I'll definitely check this out, it looks like it'll do the trick nicely. Thanks! On Apr 25, 11:13 am, Horst Gutmann <[EMAIL PROTECTED]> wrote: > Greg Taylor wrote: > > Greetings, > > > I was wondering if there's a way to

Initial Data for Django Classes?

2007-04-25 Thread Greg Taylor
Greetings, I was wondering if there's a way to include initial data for Django classes. I noticed that there is a way to do so via a 'sql' subdirectory under your own models, but didn't see any indication if there was a way to do this for base Django classes.

Re: Primary key field can be empty

2007-04-25 Thread Ramiro Morales
On 4/25/07, Kai Kuehne <[EMAIL PROTECTED]> wrote: > > Argh, sorry... I made a mistake: >primary_key implies blank=False and null=False. > > Now it should be correct. :) Oh, I kept reading that as "why can't I add..." Try adding blank=False explicitely because it works at the admin UI level

Re: Primary key field can be empty

2007-04-25 Thread Kai Kuehne
Argh, sorry... I made a mistake: primary_key implies blank=False and null=False. Now it should be correct. :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send

Re: Primary key field can be empty

2007-04-25 Thread Kai Kuehne
Hola, On 4/25/07, Ramiro Morales <[EMAIL PROTECTED]> wrote: > Sorry, I don't understand what you are asking.then.The > first paragraph of your message was: Second try: primary_key=True implies blank=True and null=True. This means that you cannot add an entry where the name (in my case) is

Re: Primary key field can be empty

2007-04-25 Thread Ramiro Morales
On 4/25/07, Kai Kuehne <[EMAIL PROTECTED]> wrote: > > Hi, > > On 4/25/07, Ramiro Morales <[EMAIL PROTECTED]> wrote: > > > Hi list, > > > why can I add a record in the admin where the name field is empty, > > > > Because, as you wrote, blank and null are False? > > blank=False means that a blank

Re: Cannot resolve keyword into field

2007-04-25 Thread Jason McVetta
On 4/24/07, Benjamin Slavin <[EMAIL PROTECTED]> wrote: > > I've posted a modified script of what I'm using internally for a > script that had encountered this problem. [0] I'll be curious to hear > if it this helps you out at all. Ben, thank you very much for the script -- it fixed my problem!

Re: Initial Data for Django Classes?

2007-04-25 Thread Horst Gutmann
Greg Taylor wrote: > Greetings, > > I was wondering if there's a way to include initial data for Django > classes. I noticed that there is a way to do so via a 'sql' > subdirectory under your own models, but didn't see any indication if > there was a way to do this for base Django classes. >

Re: Django database referential problem

2007-04-25 Thread Drasty
Depending on how you want to limit versions in your projects, you could do something with the "limit_choices_to" argument in your ForeignKey. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To

contextual ForeignKey?

2007-04-25 Thread Erik Vorhes
In my app I have a model, "Review," that uses a different (ForeignKey) citation form depending on the type of thing I'm reviewing. I'd like to be able to call a different ForeignKey dynamically based on the citation type but keep running into a bunch of errors. Here's my current "Review" model

Initial Data for Django Classes?

2007-04-25 Thread Greg Taylor
Greetings, I was wondering if there's a way to include initial data for Django classes. I noticed that there is a way to do so via a 'sql' subdirectory under your own models, but didn't see any indication if there was a way to do this for base Django classes.

Re: Primary key field can be empty

2007-04-25 Thread Kai Kuehne
Hi, On 4/25/07, Ramiro Morales <[EMAIL PROTECTED]> wrote: > > Hi list, > > why can I add a record in the admin where the name field is empty, > > Because, as you wrote, blank and null are False? blank=False means that a blank field ISN'T allowed. Kai

Re: Primary key field can be empty

2007-04-25 Thread Ramiro Morales
On 4/25/07, Kai Kuehne <[EMAIL PROTECTED]> wrote: > > Hi list, > why can I add a record in the admin where the name field is empty, Because, as you wrote, blank and null are False? -- Ramiro Morales --~--~-~--~~~---~--~~ You received this message because you

Primary key field can be empty

2007-04-25 Thread Kai Kuehne
Hi list, why can I add a record in the admin where the name field is empty, when the docs say: "primary_key=True implies blank=False, null=False and unique=True. Only one primary key is allowed on an object." My code: name = models.CharField(maxlength=255, primary_key=True, db_index=True) There

what you know about islam

2007-04-25 Thread ??????????????
http://www.islam-guide.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to

Re: paginator.has_next_page error?

2007-04-25 Thread Moses Ting
I ended up figuring out what the problem was. I was retrieving the value from key page_num from GET: pageNum = request.GET.get("page_num", 0) That's problematic because I remember it being mentioned in the docs that a get returns a string. Therefore, I need to do the following instead:

Re: Django database referential problem

2007-04-25 Thread Gerry Steele
Thanks for the reply Yaron. I think I was basically over thinking the whole thing. The ManyToMany was a mistake, you were right, as there is another class that should need manytomany. (each Issue will potentially relate to more than one ProjectVersion). The admin still displays all

Re: Django database referential problem

2007-04-25 Thread Yaron Buskilla
Hi Gerry. Why do you use the many to many field for version in the project model ? I think all you have to do is define the ForiegnKey as you did in the ProjectVersion model and it is enough . Because every project has many versions. Then you can get the versions of a projetc by writing : p

Re: Rendering a template according to model type

2007-04-25 Thread robin_percy
What about giving each Model a render() function to render it's contents against it's template and return the resulting string. You could then do something like this in the Display template: {% for e in elements %} {{ e.render }} {% endfor %} A more MVC-friendly approach may be to

Django database referential problem

2007-04-25 Thread Gerry Steele
I'm having a problem designing my data model. I'm sure there must be an elementary solution but I can't find it. Below i have two models. ProjectVersion and Project. It all kind of works, however the admin "add" section for Project displays all rows for ProjectVersion in that field,

Job offer in Switzerland

2007-04-25 Thread Patrick Lauber
We are looking for Django Devs in Switzerland...that would be interested in moving to Zürich. For Freelancers we are looking too. Remote work possible. If you are interested drop me a mail. Patrick Lauber Rich Media Architect Divio GmbH : www.divio.ch : [EMAIL PROTECTED] : ++41

Re: Using settings.LOGIN_URL and django.core.urlresolvers.reverse

2007-04-25 Thread Matt
On Apr 25, 11:46 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > I have doubts that using reverse() in the settings file is going to > work. It relies on the value of ROOT_URLCONF, which will only be > available once the settings module has been fully imported. So trying to > access that

Re: Using settings.LOGIN_URL and django.core.urlresolvers.reverse

2007-04-25 Thread Malcolm Tredinnick
On Wed, 2007-04-25 at 10:32 +, Matt wrote: > Hi everyone, > > I have a quick question about the new LOGIN_URL, LOGOUT_URL, and > LOGIN_REDIRECT_URL settings. If, in my project's settings module, I > write: > > LOGIN_URL = '/blah/' > LOGOUT_URL = '/blah/blah/' >

Using settings.LOGIN_URL and django.core.urlresolvers.reverse

2007-04-25 Thread Matt
Hi everyone, I have a quick question about the new LOGIN_URL, LOGOUT_URL, and LOGIN_REDIRECT_URL settings. If, in my project's settings module, I write: LOGIN_URL = '/blah/' LOGOUT_URL = '/blah/blah/' LOGIN_REDIRECT_URL = '/blah/blah/blah/' They work just fine. But I want to

Re: "mpm-prefork" vs. "mpm-worker"

2007-04-25 Thread Atilla
In my experience so far, there's nothing that prevents you from efficiently using the worker MPM with the latest Apache/Mod_python/Django versions. You have to be more careful when it comes to configuration, optimization, concurrency-load-memory when running under worker MPM, but so far I

Re: Please help, strange errors crashing my site

2007-04-25 Thread Graham Dumpleton
Both mod_wsgi and TurboGears contain specific notes about this issue with Python eggs when using Python running inside of Apache. In mod_wsgi documentation read section on 'Access Rights Of Apache User' in: http://code.google.com/p/modwsgi/wiki/ApplicationIssues In TurboGears documentation

Generic Template

2007-04-25 Thread Moses Ting
Hello DJ Users, I'm trying to write a generic template where I can auto-populate a html table depending on which model I use. So for example the view does something like this: def genericView(request, model): context = {} fields = model._meta.fields fieldNames = [] for

Re: Possible race condition in base.py

2007-04-25 Thread Malcolm Tredinnick
Hi Enrico, On Wed, 2007-04-25 at 19:03 +1200, Enrico de Klerk wrote: > I think the race condition can be removed by doing something like this > (It's similar to what mkstemp does): > > while True: > try: > fd = os.open(os.path.join(settings.MEDIA_ROOT, filename), > os.O_RDWR |

Re: Possible race condition in base.py

2007-04-25 Thread Enrico de Klerk
I think the race condition can be removed by doing something like this (It's similar to what mkstemp does): while True: try: fd = os.open(os.path.join(settings.MEDIA_ROOT, filename), os.O_RDWR | os.O_CREAT | os.O_EXCL) fp = os.fdopen(fd, 'wb') fp.write(raw_contents)

Re: Cannot resolve keyword into field

2007-04-25 Thread Ramashish Baranwal
On Apr 24, 1:45 am, "Jason McVetta" <[EMAIL PROTECTED]> wrote: > > TypeError: Cannot resolve keyword 'book' into field > > This is a long-standing, well-known bug that apparently no one (including > me) knows how to fix. > > Any time one defines a ManyToMany relationship, then calls all() on

Re: Linux web server + MSSQL database

2007-04-25 Thread mralokkp
Check out this link http://www.time-travellers.org/shane/howtos/MS-SQL-Express-Python-HOWTO.html You need some tweaks Regards Alok Tiwari On Apr 25, 2:13 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > All, > > I have Django running on a Linux machine, and I want to connect to a > MSSQL

+=+ Want To Be An Astronaut =+=

2007-04-25 Thread Rania Desai
*if you want to be an Astronaut of NASA please read this guaid* http://information.100stuff.com/want-to-be-astronaut/ Thanks Rania --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to

Re: select_related() does not span apps?

2007-04-25 Thread Paul Smith
My mistake -- I had unintentionally set 'null=True' in the ForeignKey definition. -Paul On Apr 24, 1:08 pm, Paul Smith <[EMAIL PROTECTED]> wrote: > I have a model defined with a ForeignKey that points to another model > in a different installed app. select_related() does not seem to follow >