Re: Deleting and creating a model

2008-09-13 Thread Ross
I think you would either have to assign the antenna's phone: antenna.phone = phone or refetch the antenna from the database so Django creates the object with the newly-created reference. The antenna you are looking at is only coming from memory when you do antenna.phone, not from the database.

Deleting and creating a model

2008-09-13 Thread Karish
Hi, I have two models in a one-to-one relationship: Phone and Antenna. In other words, within the Phone class I have this field: antenna = models.OneToOneField(Antenna, related_name='phone') What I want to do, given a specific antenna, is to delete its phone and add a different phone:

Re: Admin: design question

2008-09-13 Thread Marc Boivin
Keith Eberle wrote: >Maybe you can do something similar to what's in this post (using queryset): >http://groups.google.com/ > > > group/django-users/browse_thread/thread/c59b3807631d2914/a07cabfb4725447d?lnk=gst=restrict+users+to+their+own+data#a07cabfb4725447d It is valid, tested and working

Re: 3 models need to access 1 model

2008-09-13 Thread Steve Holden
[EMAIL PROTECTED] wrote: > OK, I'm new to Django and this is probably making a silly mistake but, > to me the admin.site.register(Tag) line should appear at the bottom of > the Tags model. If this is done Django will not syncdb or runserver > because it thinks "Tag" has been registered more than

Re: 3 models need to access 1 model

2008-09-13 Thread [EMAIL PROTECTED]
OK, I'm new to Django and this is probably making a silly mistake but, to me the admin.site.register(Tag) line should appear at the bottom of the Tags model. If this is done Django will not syncdb or runserver because it thinks "Tag" has been registered more than once. However, if you put the

Re: 3 models need to access 1 model

2008-09-13 Thread [EMAIL PROTECTED]
Hrm I have this working now, got lucky with a google and found a django bug that had the info I needed to start. So am now using: appt4.models import Tag But am now actually experiencing the bug which is thought to be fixed. I'm using Django 1.0: http://code.djangoproject.com/ticket/6776

3 models need to access 1 model

2008-09-13 Thread [EMAIL PROTECTED]
Hello, I have 3 apps. When records are saved to each app I want to associate tags to the records. In order for each app to access the same tags I think I would need a Tag app. Is it possible for models in different apps to access models in another ? So.. App1 class m1(models.Model): tag =

Re: ORM vs SQL vs HBase

2008-09-13 Thread Russell Keith-Magee
On Sun, Sep 14, 2008 at 7:24 AM, Martin Diers <[EMAIL PROTECTED]> wrote: > > On Sep 6, 2008, at 11:36 AM, Posi wrote: >> >> Still though, how tied are we to a true relational model and how does >> that tie to a column based DB. > > So utterly and completely, that if you wished to use HBase, there

Re: ORM vs SQL vs HBase

2008-09-13 Thread Martin Diers
On Sep 6, 2008, at 11:36 AM, Posi wrote: > > Still though, how tied are we to a true relational model and how does > that tie to a column based DB. So utterly and completely, that if you wished to use HBase, there would be no possible way to integrate in into the current ORM. In fact, the

Re: specifying MEDIA_URL in CSS files

2008-09-13 Thread Tim Chase
> What's the best way to use MEDIA_URL in a CSS file. For example, right > now my CSS file has something like: > > body { > background: transparent url('/media/images/bg.gif') repeat; > } > > I would like to use MEDIA_URL instead of /media/ (in a number of > places), but other than that the

Re: specifying MEDIA_URL in CSS files

2008-09-13 Thread Erik Allik
You should instead simply use relative URLs to images in CSS files. Style sheets and images are (normally) always at the same location relative to each other so nothing will break if you change their location. Of course if your images are in a different domain than your style sheets,

specifying MEDIA_URL in CSS files

2008-09-13 Thread MrJogo
What's the best way to use MEDIA_URL in a CSS file. For example, right now my CSS file has something like: body { background: transparent url('/media/images/bg.gif') repeat; } I would like to use MEDIA_URL instead of /media/ (in a number of places), but other than that the file is static.

Re: Template problem with dates(field, kind, order='ASC')

2008-09-13 Thread djandrow
Sorry, must have forgotton that part, it just wasn't displaying anything, its was cos I was archive.datetime, when archive was already a dateime object. Now I've changed it to {{ archive }} its fine. Thanks guys, Andrew --~--~-~--~~~---~--~~ You received this

Re: Problems with tutorial part 2

2008-09-13 Thread Neil
Thanks for the quick reply. I reinstalled Django using 'python setup.py install' and the problem has disappeared. Previously I installed Django by running 'python setup.py build' and then manually copying the Django directory created under the build/ directory to another directory in my Python

Re: Template problem with dates(field, kind, order='ASC')

2008-09-13 Thread Daniel Roseman
On Sep 13, 10:49 pm, djandrow <[EMAIL PROTECTED]> wrote: > This is probably really really obvious. I have the following statement > in my views.py: > > archive_list = Entry.objects.dates('entry_date', 'month', > order='DESC') > > then I have; > > {% for archive in archive_list %} > > {{

Re: Template problem with dates(field, kind, order='ASC')

2008-09-13 Thread Matthias Kestenholz
On Sat, Sep 13, 2008 at 11:49 PM, djandrow <[EMAIL PROTECTED]> wrote: > > This is probably really really obvious. I have the following statement > in my views.py: > > archive_list = Entry.objects.dates('entry_date', 'month', > order='DESC') > > then I have; > > {% for archive in archive_list %} >

Template problem with dates(field, kind, order='ASC')

2008-09-13 Thread djandrow
This is probably really really obvious. I have the following statement in my views.py: archive_list = Entry.objects.dates('entry_date', 'month', order='DESC') then I have; {% for archive in archive_list %} {{ archive.datetime }} {% endfor %} in my template, i am 99.9% my problem is with {{

Re: Import error: Model based on another model

2008-09-13 Thread Daniel Roseman
On Sep 13, 10:56 am, Gerard Petersen <[EMAIL PROTECTED]> wrote: > Daniel, > > > If you want a field that's populated with values from another model, > > you should use a ForeignKey. > > Is it then still possible to use filters and such, and keep it in the model > logic? > > Because the Meta

Re: Database Security

2008-09-13 Thread Sander Steffann
Hi Mario, > DATABASE_HOST ="http://192.168.1.128; DATABASE_HOST must contain a hostname or IP address, not an URL. You should remove the "http://; part and check that the IP address is correct and reachable. - Sander --~--~-~--~~~---~--~~ You received this

Re: flatpage -- content type?

2008-09-13 Thread Matthias Kestenholz
On Sat, Sep 13, 2008 at 11:12 PM, shaunc <[EMAIL PROTECTED]> wrote: > > umm... but that's not exactly according to "D.R.Y." :) -- but thanks. > It's good to try to follow DRY, but it's not the solution for everything. Django is a tool box, not a CMS with everything included. Sometimes it's

Re: flatpage -- content type?

2008-09-13 Thread shaunc
umm... but that's not exactly according to "D.R.Y." :) -- but thanks. On Sep 13, 3:36 pm, "Matthias Kestenholz" <[EMAIL PROTECTED]> wrote: > On Sat, Sep 13, 2008 at 9:33 PM, shaunc <[EMAIL PROTECTED]> wrote: > > > Hello, > > > Does anyone know how to set the content type when serving a page via

Re: Making sure published date is respected in views

2008-09-13 Thread Keith Eberle
Building on Marcelo's response, and an example from James Bennett's book (Ch 5), you could also add a custom manager. It'd go something like this: class PublishedEntryManager(models.Manager): def get_query_set(self): return super(PublishedEntryManager,

Re: flatpage -- content type?

2008-09-13 Thread Matthias Kestenholz
On Sat, Sep 13, 2008 at 9:33 PM, shaunc <[EMAIL PROTECTED]> wrote: > > Hello, > > Does anyone know how to set the content type when serving a page via > FlatPages? > You have to write your own middleware or view function. This is easy enough since you can copy the flatpages view and middleware

flatpage -- content type?

2008-09-13 Thread shaunc
Hello, Does anyone know how to set the content type when serving a page via FlatPages? Thanks, - Shaun --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: akismet and the new comments app

2008-09-13 Thread Eric Abrahamsen
On Sep 13, 2008, at 12:46 PM, Thejaswi Puthraya wrote: > > On Sep 12, 7:09 pm, Eric Abrahamsen <[EMAIL PROTECTED]> wrote: >> Has anyone tried using akismet with the new comments contrib app? >> I've >> set up a signal handler to run on 'comment_will_be_posted' and check >> the comment with

Re: Database Security

2008-09-13 Thread Steve Holden
Mario wrote: [some stuff which I have again moved to the bottom where it belongs] > On Sep 13, 12:46 pm, Steve Holden <[EMAIL PROTECTED]> wrote: >> Ross wrote: >> [some stuff you can now find after the question] >>> On Sep 13, 9:37 am, Mario <[EMAIL PROTECTED]> wrote: Hello, I would

Re: When to start an app?

2008-09-13 Thread barbara shaurette
Yep, you'll have some overlap, but I think it makes sense to create a separate app wherever the data model/views could logically stand alone. So, user registration would be one app. I'm working on a project that does a lot with demographic data based on user profiles, so profiles is another

Re: Database Security

2008-09-13 Thread Mario
Thank you for responding so quickly, but the question hasn't been answered. Assuming there are firewalls layered between the DMZ and the private network and the routing table has been setup correctly; what do I need to do to forward the http request to my remote database. Do I modify my

When to start an app?

2008-09-13 Thread mickeyckm
I'm a little confuse as to when to create an app. I'm trying to create a survey project. Is user registration an app on its own, the part where the person login/register? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: Admin: design question

2008-09-13 Thread Gertjan Klein
Keith Eberle wrote: >Maybe you can do something similar to what's in this post (using queryset): >http://groups.google.com/group/django-users/browse_thread/thread/c59b3807631d2914/a07cabfb4725447d?lnk=gst=restrict+users+to+their+own+data#a07cabfb4725447d Is that still valid? I can find no

Re: Database Security

2008-09-13 Thread Steve Holden
Ross wrote: [some stuff you can now find after the question] > On Sep 13, 9:37 am, Mario <[EMAIL PROTECTED]> wrote: >> Hello, >> >> I would like to move off the existing database server off Django. >> Currently, my settings.py file include the following configuration: >> >> DATABASE_ENGINE =

Re: Database Security

2008-09-13 Thread Ross
http://docs.djangoproject.com/en/dev/ref/databases/#connecting-to-the-database Putting your database in the DMZ is probably a very bad idea... You don't want to give the entire internet access to your database. The standard Django setup expects your database to be accessible on the same local

presenting my new blog

2008-09-13 Thread Vikti
Hi, finally I decided to (re)start blogging. As it's django based (actually runs on byteflow) I thought I will present it here. Besides django - as it was already told - I use byteflow [1], plus django-contact-form [2] and my own postimage [1] app. If you are interested in posts on standard

Re: How to prevent URL HTML encoding?

2008-09-13 Thread Ross
That will definitely do the trick, but the idea of APPEND_SLASH from what I understand is 'http://www.last.fm/music/Goo+Goo+Dolls/' and 'http://www.last.fm/music/Goo+Goo+Dolls' (with and without the trailing slash) are considered different URLs. Appending the slash normalizes all your URLs to

Re: Template.render and custom tags

2008-09-13 Thread Julien Phalip
You might want to give a shot with 'add_to_builtins': http://blog.michaeltrier.com/2007/8/7/common-template-tags On Sep 13, 11:05 am, akonsu <[EMAIL PROTECTED]> wrote: > hello, > > is there a way to make my custom tags and filters available to a > template that i create from a string like this:

Re: Admin: design question

2008-09-13 Thread Keith Eberle
Maybe you can do something similar to what's in this post (using queryset): http://groups.google.com/group/django-users/browse_thread/thread/c59b3807631d2914/a07cabfb4725447d?lnk=gst=restrict+users+to+their+own+data#a07cabfb4725447d keith On Sat, Sep 13, 2008 at 10:30 AM, Gertjan Klein <[EMAIL

Re: Help: Running 1.0 and 0.96 side by side?

2008-09-13 Thread Matt Conrad
On Fri, Sep 12, 2008 at 1:58 PM, Kevin Teague <[EMAIL PROTECTED]> wrote: > Finally, you could patch a Python program such as manage.py so that > you do something like: > > import sys > sys.path[0:0] = [ > '\somelocation-for-django-1.0\', > ] > import django > > This would pick up your Django

Re: how to use never_cache?

2008-09-13 Thread V
> > Rather than suspecting caching, I'd suspect you've got code running at > > import time instead of form instantiation time that is determining the file > > list.  You did not include the form definition, though, in what you showed > > us, so it's hard to be sure. Perfect pointer Karen, with

Database Security

2008-09-13 Thread Mario
Hello, I would like to move off the existing database server off Django. Currently, my settings.py file include the following configuration: DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. DATABASE_NAME = 'golf_prod'

Re: Admin: design question

2008-09-13 Thread Gertjan Klein
Steve Holden wrote: >Gertjan Klein wrote: >> However, there is one obvious problem >> here: when editing an Hours instance, the ProjectCode dropdown lists >> *all* project codes, not just those related to the selected customer. >As long as you only want this in th admin, check out the

Re: Map API's and Django, preferences?

2008-09-13 Thread TiNo
I wanted to do the same. I decided not to user GIS because of all the new stuff I needed to install. Two Coordinates are good enough for the google maps api. I plan on using geopy (http://exogen.case.edu/projects/geopy/) for translating addresses to coordinates. I also found these articles that

Re: problem with generic views (monthly archive) and different languages

2008-09-13 Thread Nathan Dabney
URL keyed off of numeric month instead of localized name. -Nathan On Sat, Sep 13, 2008 at 6:02 AM, Julian <[EMAIL PROTECTED]> wrote: > > hi there, > > in my settings.py there is the language specified as "de_de", wich > works well with things like: > > {{{ > blog_entry.timestamp|date:"b" > }}}

problem with generic views (monthly archive) and different languages

2008-09-13 Thread Julian
hi there, in my settings.py there is the language specified as "de_de", wich works well with things like: {{{ blog_entry.timestamp|date:"b" }}} in may, it returns "Mai", wich is german for may. but i am using the generic views for my blog archive, and monthly based i'm doing things like: {{{

Re: Admin: design question

2008-09-13 Thread Steve Holden
Gertjan Klein wrote: > Hi, > > I am writing a timekeeping app with Django, and have some design > questions. Stripped down, I have a model somewhat like this: > > class Customer(models.Model): > Name = models.CharField(max_length=200) > > class ProjectCode(models.Model): > Customer =

Re: Using models from another project/site

2008-09-13 Thread Donn
You are some kind of wonderful. Thanks for that, it has really helped me! \d --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com

Re: Import error: Model based on another model

2008-09-13 Thread Steve Holden
Gerard Petersen wrote: > Daniel, > >> If you want a field that's populated with values from another model, >> you should use a ForeignKey. > Is it then still possible to use filters and such, and keep it in the model > logic? > > Because the Meta model has these fields: 'attribute', 'value',

Admin: design question

2008-09-13 Thread Gertjan Klein
Hi, I am writing a timekeeping app with Django, and have some design questions. Stripped down, I have a model somewhat like this: class Customer(models.Model): Name = models.CharField(max_length=200) class ProjectCode(models.Model): Customer = models.ForeignKey('Customer') Code =

Re: migration problem from Django0.96 to Django1.0

2008-09-13 Thread Karen Tracey
On Sat, Sep 13, 2008 at 5:28 AM, vijay <[EMAIL PROTECTED]> wrote: > > When i'am trying to migrate my application which is wriiten in 0.96 > version to 1.0, i encountered the following error message. > > File "c:\python25\lib\site-packages\django\utils\dateformat.py", > line 127, in D >return

Re: Using models from another project/site

2008-09-13 Thread Karen Tracey
On Sat, Sep 13, 2008 at 8:00 AM, Donn <[EMAIL PROTECTED]> wrote: > > Extra info: > > I have many Projects that equate to 'websites'. > Each has it's own database in Mysql. > > I want one Project to be our Admin that let's us set some stuff that the > other > websites (projects) read and act upon.

Re: Using models from another project/site

2008-09-13 Thread Donn
Extra info: I have many Projects that equate to 'websites'. Each has it's own database in Mysql. I want one Project to be our Admin that let's us set some stuff that the other websites (projects) read and act upon. (Hence OP needing to access a model from another Project) If I setup each

Re: Using slug in comments urls

2008-09-13 Thread Karen Tracey
On Sat, Sep 13, 2008 at 4:14 AM, Shantp <[EMAIL PROTECTED]> wrote: > > > Just to clear up some confusion, I posted only the relevant part of my > urls.py file. I have all the other necessary stuff in it but i'm still > getting this error. > So if your root urlconf file does have urlpatterns

Re: status of per-object-level permission

2008-09-13 Thread rca
> Thanks for your answer, Malcolm, > > I was refering to the > branchhttp://code.djangoproject.com/browser/django/branches/per-object-perm... > which (according to the wiki) appeared to be almost ready for > inclusion in the > main branch of 0.96. To me, this always seemed to be the most

migration problem from Django0.96 to Django1.0

2008-09-13 Thread vijay
When i'am trying to migrate my application which is wriiten in 0.96 version to 1.0, i encountered the following error message. File "c:\python25\lib\site-packages\django\utils\dateformat.py", line 127, in D return WEEKDAYS_ABBR[self.data.weekday()] NameError: global name 'WEEKDAYS_ABBR' is

Logging exceptions using mod_python

2008-09-13 Thread mcordes
Hello, The mod_python deployment doc says: "When you use Apache/mod_python, errors will be caught by Django -- in other words, they won't propagate to the Apache level and won't appear in the Apache error_log". Is there a way to force errors to be recorded in the error_log? Failing that is

Using models from another project/site

2008-09-13 Thread Donn
I am getting confused by terms, but this is the basic need: 1. In a base dir I have site1 and site2 2. I am in site2 (views) and I want to use the models defined in site1 3. from site1.models import Blah -- seems to work without error. 4. I get an error on stuff like this: p = Blah.objects.all()

Re: Import error: Model based on another model

2008-09-13 Thread Gerard Petersen
Daniel, > If you want a field that's populated with values from another model, > you should use a ForeignKey. Is it then still possible to use filters and such, and keep it in the model logic? Because the Meta model has these fields: 'attribute', 'value', 'display', 'description' And it's

Re: Import error: Model based on another model

2008-09-13 Thread Daniel Roseman
On Sep 13, 9:25 am, Gerard Petersen <[EMAIL PROTECTED]> wrote: > Hi All, > > I need to create a field with a choice set that looks like this: > >     BTW_CHOICES = ( >         ('0.0', '0%'), >         ('6.0', '6%'), >         ('19.0', '19%'), >     ) > > This works as expected when using dropdown

Import error: Model based on another model

2008-09-13 Thread Gerard Petersen
Hi All, I need to create a field with a choice set that looks like this: BTW_CHOICES = ( ('0.0', '0%'), ('6.0', '6%'), ('19.0', '19%'), ) This works as expected when using dropdown lists in a form. But it needs to be build from data in another model. When

Re: Using slug in comments urls

2008-09-13 Thread Shantp
Just to clear up some confusion, I posted only the relevant part of my urls.py file. I have all the other necessary stuff in it but i'm still getting this error. On Sep 12, 8:14 pm, Eric Abrahamsen <[EMAIL PROTECTED]> wrote: > On Sep 13, 2008, at 8:32 AM, Shantp wrote: > > > > > Hi, > > > I

Re: How to prevent URL HTML encoding?

2008-09-13 Thread Karen Tracey
On Sat, Sep 13, 2008 at 1:36 AM, Ross <[EMAIL PROTECTED]> wrote: > > The URL encoding is not causing any problems in my code. Splitting the > parameter on '+' works the same whether the address is 'Goo+Goo+Dolls' > or 'Goo%2BGoo%2BDolls'. > > I can certainly add additional expressions to catch