Re: django as a platform for a commercial SaaS project?
Lee Hinde wrote: > > > On Mar 24, 8:03 pm, John DeRosa <[EMAIL PROTECTED]> wrote: >> walterbyrd wrote: >>> SaaS = Software as a service, just in case that was not clear. >> What's the difference between SaaS and an ASP? I don't quite get the >> distinction between them. > > The ASP provides the SaaS. Yes and no. The term "ASP" existed before "SaaS" came on the scene. I think ASPs were selling something to their customers before SaaS was "invented." The point of my original post was that the meaning of ASP and SaaS, and whether there's any real difference between them, depends on who's doing the talking. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: manage.py startapp suggestions
Tom, Thanks for going forward with this, there are alot of people who want something like this. On Mar 23, 8:17 am, Tom Smith <[EMAIL PROTECTED]> wrote: > > Unfortunatly given your example, 90% of what you want (urls.py with > > static file handling, a media directory, building the actual model) > > are things I expressly do NOT want the wizard to do for ME. (I have my > > own genapp.py tool I use for creating new apps.) > > Interesting... I'd like to know why you don't want those things and > see your own genapp script... It will be checked into the PyCon-Tech code base in a month or two (other projects are consuming my time these days). http://us.pycon.org/TX2007/PyConTech I optionally want models.py, views.py, forms.py, urls.py, decorators.py, media/{js, img, css}/, templates//, templatetags/.py with some standard header information. There are very, very few common threads between my models, and I would prefer a graphical interface for the models, as a second stage in the app building. Of the 7 core apps for the conference software, no two share a common model structure: https://svn.python.org/conference/django/trunk/pycon/ I was being a little disingenuous when I said I didn't want most of it. I don't want a text based model builder. The tool I have is a small wxpython app. A friend and I were thinking of turning it into a django app with an ajax model builder. I'm an old OMT hack and it appeals to me, but the recursive nature of it gives me a migraine. On the serving of static media: I have a custom django app (called appmedia) which deals with serving up static content in the 'media' directory of any app if its the dev server, otherwise it is up to apache or httplight to serve up media in production. (and adds {% app_media_root "myapp" %} ) so there is no need for me to serve up media local to the apps urls.py This goes against one of the django style rules, but I feel its cleaner. > I've started re-working mine based > purely on my own crazy preferences and habits. For example, if I add > an attribute to a class called "name", it assumes it's a CharField > and it also adds a SlugField called "slug"... I didn't know they > existed till today. If I add an attribute called "url"... you can > guess where that one is going.. I like the Idea of it, but I am concerned you will end up with a meta- model language once you get everything done. As long as you don't go too crazy with it, it should be fine. > I'd love a call like this... > > >>> python startapp.py my_app_name -flavour=(tom | doug | malcolm | > james ) My first implementation used something like the flavor you propose (I made the mistake of calling it -type). I had 4 spec'd out, and discovered that NONE of my 25 some odd apps actually conformed to any of the 4 specs. I think this was due to my purist mind conflicting with the reality of the apps I wrote. Someone other than me will hopefully be able to find some reoccurring patterns that actually reoccur. -Doug --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
A Quick Introduction To Islam
A Quick Introduction To Islam The word "Islam" is an Arabic word which means "submission to the will of God". This word comes from the same root as the Arabic word "salam", which means "peace". As such, the religion of Islam teaches that in order to achieve true peace of mind and surety of heart, one must submit to God and live according to His Divinely revealed Law. The most important truth that God revealed to mankind is that there is nothing divine or worthy of being worshipped except for Almighty God, thus all human beings should submit to Him. http://discover.islamway.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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: django as a platform for a commercial SaaS project?
On Mar 24, 8:03 pm, John DeRosa <[EMAIL PROTECTED]> wrote: > walterbyrd wrote: > > SaaS = Software as a service, just in case that was not clear. > > What's the difference between SaaS and an ASP? I don't quite get the > distinction between them. The ASP provides the SaaS. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: django as a platform for a commercial SaaS project?
walterbyrd wrote: > SaaS = Software as a service, just in case that was not clear. What's the difference between SaaS and an ASP? I don't quite get the distinction between them. John --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django and Routing SUBDOMAIN STYLE URL
How do you test the subdomin url style in Django development server? Developer server is at: http://127.0.0.1:8000/ Thank you. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Adding a field to a model
On 3/24/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > (3) At your database prompt ("manage.py shell" and go from there), > execute "ALTER TABLE ADD COLUMN ... DEFAULT ...", filling in the first > "..." part with the column definition you noted before. You will also > need to add a DEFAULT value to the column at the database level so that > existing entries have a value for that column. If the column can be > NULL, you won't need the default value -- it will just put NULLs in > there for all the existing entries. Alternative, and even better in my experience: write a SQL file which will run the update inside a transaction, and commit that into the SVN repo with your app so you have a history of what you've done to the DB. -- "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Adding a field to a model
On Sat, 2007-03-24 at 18:04 -0700, Mark Engelberg wrote: > I know that, unfortunately, there's no painless way to migrate all the > data in your database when you add a new optional field to your model. > Pity. > > So what is the MOST painless way to do this? (1) Add the field to your model. (2) Run "manage.py sql " and note the type of column that is added to the model's table. (3) At your database prompt ("manage.py shell" and go from there), execute "ALTER TABLE ADD COLUMN ... DEFAULT ...", filling in the first "..." part with the column definition you noted before. You will also need to add a DEFAULT value to the column at the database level so that existing entries have a value for that column. If the column can be NULL, you won't need the default value -- it will just put NULLs in there for all the existing entries. (4) Sit back with drink of choice and realise just how painless the whole process was. Regards, Malcolm --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Adding a field to a model
I think the new .96 version has a export / import data function now. On Mar 24, 6:04 pm, "Mark Engelberg" <[EMAIL PROTECTED]> wrote: > I know that, unfortunately, there's no painless way to migrate all the > data in your database when you add a new optional field to your model. > Pity. > > So what is the MOST painless way to do this? > > --Mark --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Adding a field to a model
I know that, unfortunately, there's no painless way to migrate all the data in your database when you add a new optional field to your model. Pity. So what is the MOST painless way to do this? --Mark --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: multiple field primary key and foreign keys as primary keys
On 3/25/07, checco <[EMAIL PROTECTED]> wrote: > > and I want to create a primary key that is composed of field1 and > field 2 in table 3, is this possible in django? Can I do something > like... > > field1 = ForeignKey('table1', primarykey=True) > field2= ForeignKey('table2', primarykey=True) Hi Francesco, You can make any individual field the primary key using `primary_key=True` - so, for example: class MyModel(models.Model): key = ForeignKey('table1', primary_key=True) data = ... would make a foreign key on Table1 the primary key on MyModel. However, if you give multiple fields the primary_key attribute, only the first will be used to designate a primary key. Django does not currently support multiple field primary keys. Yours, Russ Magee %-) --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: How to handle a preview page
On Sat, 2007-03-24 at 08:47 -0400, Todd O'Bryan wrote: [...] > Let me ask a silly question before I go off and do something radical, > just to make sure I won't hit a brick wall later. > > I'm trying to model every conceivable kind of question in a way that > won't involve changing the database later. To do this, my Question model > has some meta-information and has a OneToMany mapping to a DataBit > model. A DataBit has fields for type and one piece each of textual and > numeric data. If I want a true/false question, it has two DataBit > objects: a bit containing the statement and a bit indicating whether > it's true or false. If I want a fill-in-the-blank question, it has one > DataBit instance for the statement and one for each answer that belongs > in the blanks. For a multiple-choice question, there are several bits: > the question, each possible answer, and a bit saying which answer is > correct. Okay, I understand what you're trying to achieve here. It looks like it might be a job for Generic relations, since it sounds like you are wanting to relate one model (Question) to an arbitrary other type of model (the answers), differentiating by some "type" string. If you haven't seen them yet, have a look at http://www.djangoproject.com/documentation/models/generic_relations/ . I don't know if this will make your life easier or not, but it sounds like an alternative (or equivalent) to what you are doing. > Obviously, trying to represent these things directly from the database > is a bit of a pain, so I have non-model classes that translate from the > representation in the database to a more natural representation and vice > versa. These classes also create the forms (as in django.newforms) that > I display. > > Could I pickle one of these non-model objects and use the pickled value > in a hidden field to store everything all at once and then get it back > really easily? I've never used pickle, so I'm a little apprehensive that > there are gotchas I don't know about, but, if it works the way it's > advertised, it seems an easy way to dump something into the preview and > then reconstruct it on the way out. Are there any gotchas I should be > aware of before I start? It's a security hole if you just do it the way you described. As you no doubt realise, just because the field is hidden, doesn't mean it's value cannot be changed. So you are going to end up unpickling random data that somebody you don't know or trust has just sent you and that could have unintended side effects. One way to avoid this is to sign the pickled string (e.g. hash the combination of the string with a secret mixed in). Regards, Malcolm --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Newbie problem with view/model interaction
On 3/24/07, Ivan Sagalaev <[EMAIL PROTECTED]> wrote: > Not related to your question, but this is called 'template' in Django. > 'View' means a different thing (a controller). Well, Django doesn't really have anything that strictly matches the "controller" aspect; even Martin Fowler in his writeup of the MVC pattern admits that controller/view separation isn't always useful :) > I'm sure someone will suggest something less scary for a beginner but I > can now only come up with such a custom template tag: This is pretty much what I'd do (and what I've done in several situations); given that this is a common situation it might be useful for us to bundle an easy way to build if-style tags, much like the simple_tag and inclusion_tag decorators. -- "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django and Routing SUBDOMAIN STYLE URL
My solution to this is a custom middleware that rewrites the path according the subdomain, before url parsing and getting views: This is a short extract: class URLRewriteMiddleware(object): """Middleware that manages urls with subdomains """ def process_request(self, request): """change path (x).example.com/(y) -> example.com/subdomains/(x)/(y) exception: www.example.com """ if settings.SUBDOMAINS_SUPPORTED: site = Site.objects.get_current() subdomain = request.META['HTTP_HOST'][:-len(site.domain)-1] if subdomain and subdomain!="www": path = request.path[len(settings.ROOT_DIR)] request.path = "%s%s%s/%s" % (settings.ROOT_DIR, settings.SUBDOMAIN_MNG_DIR, subdomain, path) return None My settings variables: ROOT_DIR - either "/" or "/projectname/" depending on how my project is accessed - under some domain directly or in some directory of localhost. SUBDOMAINS_SUPPORTED - Are subdomains supported on that server? True/False SUBDOMAIN_MNG_DIR - the (x) directory to which all the query is added Regards, Aidas Bendoraitis [aka Archatas] On 3/24/07, johnny <[EMAIL PROTECTED]> wrote: > > How do I route subdomains style url: http://api.mysite.com/ ? > > Thank you. > > > > > --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Announcing Django 0.96!
On Mar 24, 1:22 pm, "Todd O'Bryan" <[EMAIL PROTECTED]> wrote: > Django gets installed in your Python version's site-packages > folder--/usr/lib/python2.x/site-packages is typical for Linux. Probably > the easiest thing to do is delete the django folder you find there and > re-install. Hm, yes, there is such a folder: /usr/lib/python2.4/site-packages/Django-0.95.1-py2.4.egg but isn't this recorded in some registry/database/path as well? Is it safe to just remove the folder? Why do you need a setup script if it all boils down to a folder? Just wondering. Thanks, Marius > > Todd > > On Sat, 2007-03-24 at 13:14 -0700, mariuss wrote: > > On Mar 23, 5:13 pm, "mariuss" <[EMAIL PROTECTED]> wrote: > > > I downloaded 0.96 and installed it using "python setup.py install" > > > > But it is still Django 0.95.1 (previously installed) that shows up. > > > How can I uninstall the old version? > > > Any suggestions? Pointers to some documentation? > > > The answer could be trivial, but since I am not familiar with > > setuptools I can't figure this out. Checked the setuptools site, could > > not find anything related to uninstall. Probably I am looking for the > > wrong thing. > > > Thanks, > > Marius --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Django and Routing SUBDOMAIN STYLE URL
How do I route subdomains style url: http://api.mysite.com/ ? Thank you. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Announcing Django 0.96!
Django gets installed in your Python version's site-packages folder--/usr/lib/python2.x/site-packages is typical for Linux. Probably the easiest thing to do is delete the django folder you find there and re-install. Todd On Sat, 2007-03-24 at 13:14 -0700, mariuss wrote: > On Mar 23, 5:13 pm, "mariuss" <[EMAIL PROTECTED]> wrote: > > I downloaded 0.96 and installed it using "python setup.py install" > > > > But it is still Django 0.95.1 (previously installed) that shows up. > > How can I uninstall the old version? > > Any suggestions? Pointers to some documentation? > > The answer could be trivial, but since I am not familiar with > setuptools I can't figure this out. Checked the setuptools site, could > not find anything related to uninstall. Probably I am looking for the > wrong thing. > > Thanks, > Marius --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Announcing Django 0.96!
On Mar 23, 5:13 pm, "mariuss" <[EMAIL PROTECTED]> wrote: > I downloaded 0.96 and installed it using "python setup.py install" > > But it is still Django 0.95.1 (previously installed) that shows up. > How can I uninstall the old version? Any suggestions? Pointers to some documentation? The answer could be trivial, but since I am not familiar with setuptools I can't figure this out. Checked the setuptools site, could not find anything related to uninstall. Probably I am looking for the wrong thing. Thanks, Marius --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django-0.96 hosting available at WebFaction
WOW! Cool, Remi - I'm already a member (a12007 is my ID) and I will activate Django later today!! Cheers! -Warren - Original Message - From: "Remi" <[EMAIL PROTECTED]> To: "Django users"Sent: Saturday, March 24, 2007 10:47 AM Subject: ANN: Django-0.96 hosting available at WebFaction > > Hi everyone, > > I'm happy to announce that WebFaction have added Django-0.96 to > their one-click installer. > We've also upgraded MySQLdb to version 1.2.2 on all of our servers > because the previous version we had wasn't compatible with the > new Django version. > > Remi > > http://www.webfaction.com - Hosting for an agile web. > > > > --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
multiple field primary key and foreign keys as primary keys
Hi, I'm designing a database where I have a situation similar to this... table1 field1(primary key), field2 . table 2 field1(primary key), field2, table 3 field1 (foreign key to field1 of table1), field2 (foreign key to field1 of table 2) and I want to create a primary key that is composed of field1 and field 2 in table 3, is this possible in django? Can I do something like... field1 = ForeignKey('table1', primarykey=True) field2= ForeignKey('table2', primarykey=True) Thanks, Francesco --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
ANN: Django-0.96 hosting available at WebFaction
Hi everyone, I'm happy to announce that WebFaction have added Django-0.96 to their one-click installer. We've also upgraded MySQLdb to version 1.2.2 on all of our servers because the previous version we had wasn't compatible with the new Django version. Remi http://www.webfaction.com - Hosting for an agile web. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: syncdb & postgreSQL
On 3/24/07, jewe <[EMAIL PROTECTED]> wrote: > The constraints was now creates with a new nameconstruct. > i.E.: team_id_refs_team_id_6e4cb777 > > The referenced tabel was now named without the tablename. I assume > that's a hash-value.(?) Yes, the way Django names database constraints changed between the 0.95 and 0.96 releases; there's an item in the release notes for 0.96 about this, including suggested workarounds. -- "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Newbie problem with view/model interaction
What is it you want to do with the ones they've voted on vs. haven't? If you're going to hide the ones they've already voted on, just write a query in the view method that only returns those and pass that to the context. (Note: the view method, not the template. See Ivan's response.) If they have to be in alphabetical order by title and you're going to show all of them, add something to each one that indicates whether they've been voted on. Your list could morph into a list of tuples where the first item is a paper and the second item is a boolean indicating whether the current user has voted. Something like: def display_votes(request): all_papers = Paper.objects.all() tuple_list = [(p, p.has_voted(request.user)) for p in all_papers] ... Then in the template: {% for paper_voted in tuple_list %} {% if paper_voted.1 %} stuff if they voted, paper is accessible as paper_voted.0 {% else %} stuff if they haven't {% endif %} HTH, Todd On Sat, 2007-03-24 at 07:55 -0700, Ross Burton wrote: > My initial implementation was split across the template and the > model. In my model: > > class Paper (models.Model): > ... > def has_voted(paper, user): > return paper.vote_set.filter(user__exact = user).count() != 0 > > then in the view: > > {% for paper in object_list|dictsort:"title" %} > {% if paper.has_voted( TODO ) %} > > > I then discovered that you can't pass arguments to methods in > templates, so I can't ask the model if the current user has voted. > > Can anyone give any hints on how I can fix this? > > Thanks, > Ross --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: name 'current_datetime' is not defined
On 3/24/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Like the commentor before, I could not get this example to run. > However, applying what he suggested, ie. specifying current_datetime > as a string instead, it runs now. Using a function directly, instead of a string, is included in the Django 0.96 release, and had been in the development version of Django for some time; the "function object has no attribute 'rindex'" error comes from using an older version of Django (such as the 0.95 release) which did not include this feature. Now that 0.96 is the current release, there shouldn't be any incompatibilities (assuming that anyone who follows along with the book is using the 0.96 release or a Subversion checkout of trunk). -- "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Can I write standalone Python app that uses Django auth, DB and models?
If this is a concern, you may want to take a look at Pyro. If this is intended to be an application that runs over a network, you can put the django code on the server and execute it as a remote object. This abstracts the code and prevents access to the full database API. On Mar 22, 11:14 pm, "Matthew Flanagan" <[EMAIL PROTECTED]> wrote: > On 3/23/07, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > > > > > On 23-Mar-07, at 6:22 AM, Mike Stoddart wrote: > > > > For example, I have a web app that defines a number of models. People > > > use the web interface but I also want to write some Python utils that > > > access the same database and data using the same models as standalone > > > applications. > > > as i am very fond of saying - django is nothing but python > > Yes, but Django auth is really only for web apps and can be easily > bypassed in commandline scripts, for example: > > $ python > Python 2.4.4 (#1, Mar 21 2007, 14:34:56) [C] on sunos5 > Type "help", "copyright", "credits" or "license" for more information. > > >>> from myapp.models import SomeThing > >>> for obj in SomeThing.objects.all(): > >>>obj.delete() > > If the full Django api is available on the system then this kind of > thing is difficult to prevent. > > > -- > > > regards > > kg > >http://lawgon.livejournal.com > >http://nrcfosshelpline.in/web/ > > -- > matthewhttp://wadofstuff.blogspot.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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
building a django rpm, probs with adding documentation
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello, I'm currently building a rpm of django for suse. But I can't figure out how to add the documentation, it doesn't get added, when running "python setup.py build" mfg Paul Rauch -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.5 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iQIVAwUBRgVILRG67lyyQrltAQIPPxAAmQEIUXONzAYWmMjsfvwwwFLexqEgSYvE pBNrXVdLuYh4GE/iuU9jrL5nxo7RN+/cc8AsQaWK76D0z98BdZjHccoNoqZy1RkA AJyYkZTMlgW2d715cKTFMIYAVWeKug7BtyeEvx+/rh7fh/OJnCB+G7ZcgUmZDw8H qIc2x/l6NkrynNlqbAL17Es0CyqiXmXl1p/sGregkjIxC5pJtxK8Ro2uIxVNnXIc B+lJMoJuySrWq9gp8kEzfM7orrB5No4bYIowUODVJBQGiLpM/1Xbj6/z3BtOvf3B wXp4hODzkgkmjYRdIp5UN0kIt2wMmy0eDq5tL9NjotVZLE8JbAzMNB1U6Ftp/2U+ mxCiEx6e2yMu+XrWK+H7NXjSDsG7+46GcFu8xdd7j58Ly36cjsmYOaq+WR6DaFf7 l0JotUlzTm9eJQo4TVgEjoZEbTh1Iygn00XDNjsvuqw9LMv/fOZ8WRcvr87Nw2ON O5+OHtuKYcLvIowFv+0Sk50dAwJIsJXyx1QactwTi4Wt310f8Vz2HHUWK25tPyb6 PY2EqrwGyr6D4GWDQcMuzGPutvnnUypP/yaRUci3u784dds9Z74Z6xEEvoEqW3uS DupMbWs8jvUGvkqPKYphBbTtj8kII1QJYJkm39HVkfGIdR/ZfblpbqTgg8y4lOpp PT0cIvXa2mo= =lsw0 -END PGP SIGNATURE- --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Newbie problem with view/model interaction
Ross Burton wrote: > then in the view: > > {% for paper in object_list|dictsort:"title" %} > {% if paper.has_voted( TODO ) %} > Not related to your question, but this is called 'template' in Django. 'View' means a different thing (a controller). > I then discovered that you can't pass arguments to methods in > templates, so I can't ask the model if the current user has voted. I'm sure someone will suggest something less scary for a beginner but I can now only come up with such a custom template tag: class IfVotedNode(template.Node): def __init__(self, paper_expr, node_list): self.paper_expr, self.node_list = obj_expr, node_list def render(self, context): paper = self.paper_expr.resolve(context) if paper.has_voted(context['user']): return self.node_list.render(context) else: return '' @register.tag def ifvoted(parser, token): bits = token.contents.split() if len(bits) != 2: raise template.TemplateSyntaxError, '"%s" takes 1 parameter ' % bits[0] node_list = parser.parse('end' + bits[0]) parser.delete_first_token() return IfVotedNode(parser.compile_filter(bits[1]),node_list) It's then used like this: {% ifvoted paper %}...{% endifvoted %} Docs on creating custom template tags are here: http://www.djangoproject.com/documentation/templates_python/#writing-custom-template-tags --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
django as a platform for a commercial SaaS project?
SaaS = Software as a service, just in case that was not clear. If I wanted to create commercial quality hosted software, would django be the best solution? The sort of things I have in mind would be very database oriented, and involve a lot of forms and reports. I would like to be able to easily customize the software. As much as I dislike microsoft, I wonder if I would be more productive with ASP.NET? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Newbie problem with view/model interaction
Hi, (I'm a bit of a newbie to Django so excuse any foolish mistakes) I'm writing a basic paper review system for a conference (Paper is the primary object, with Note and Vote objects having a foreign key to the paper), and currently have it somewhat working. Now my task is to make the list of papers (currently a generic object_list view) show whether the current user (all users are forced to login) has voted on each paper. My initial implementation was split across the template and the model. In my model: class Paper (models.Model): ... def has_voted(paper, user): return paper.vote_set.filter(user__exact = user).count() != 0 then in the view: {% for paper in object_list|dictsort:"title" %} {% if paper.has_voted( TODO ) %} I then discovered that you can't pass arguments to methods in templates, so I can't ask the model if the current user has voted. Can anyone give any hints on how I can fix this? Thanks, Ross --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: syncdb & postgreSQL
1 hour ago, I have installed the svn-version from django (rev.4809) and now, it works brilliant (for the moment :o)). The constraints was now creates with a new nameconstruct. i.E.: team_id_refs_team_id_6e4cb777 The referenced tabel was now named without the tablename. I assume that's a hash-value.(?) Anyway, now it works. thx, for the efforts!!! Note: If you try to install django from svn in windows and you have to create a new *.pth file. Use only small types in the path-statement!!! --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Fwd: Different subdomain for each application (again)
A while ago Doug and Eivind asked about using subdomains for each app. I'd like to do this, but in the example they had a stab at they were using Apache whereas I'm using Lighttpd... ideally I'd like subdomainone.wherever.com and subdomaintwo.wherever.com to pass through without anything AFTER the /. I tried creating a root urls.py like this... urlpatterns = patterns('', (r'^/?$', 'app.views.main'), (r'^admin/', include('django.contrib.admin.urls')),) and a kinda main views.py like this... def main(request): #handle any calls from django.conf.urls.defaults import * server_name = request.META['SERVER_NAME'].split(".") domain = server_name[0] if domain == 'subdomainone': urlpatterns = patterns('', (r'^/?$', include('seo.one.urls')), ) if domain == 'subdomaintwo': urlpatterns = patterns('', (r'^/?$', include('seo.two.urls')), ) . of course I can get the domain out of the SERVER_NAME, but then setting urlpatterns doesn't actually DO anything does it? regards tom Tom Smith http://www.theotherblog.com yahoo, aim, skype: everythingability mob: +44 (0) 7720 288 285 tel: +44 (0) 1904 870 565 fax: +44 (0) 8716 613 413 --- usability, findability, profitability, remarkability --- Tom Smith http://www.everythingability.com yahoo, aim, skype: everythingability mob: +44 (0) 7720 288 285 tel: +44 (0) 1904 870 565 fax: +44 (0) 8716 613 413 --- usability, findability, profitability, remarkability --- --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: name 'current_datetime' is not defined
I had the same problem. And I couldnt solve it by what MIke SPralding or gordy suggested. But here I found the solution # Arvind Jan 22nd, 2007 3 p.m. √ Passing a function as the second argument does not work. In fact, the example in the book till now does not work, even if used word for word. There is a problem in the urlconf, as it looks for a string. So, instead of (r'^now/$', current_datetime) , I need to specify it as (r'^now/$', "mysite.views.current_datetime") # Chai Ang Jan 29th, 2007 6:20 p.m. √ Like the commentor before, I could not get this example to run. However, applying what he suggested, ie. specifying current_datetime as a string instead, it runs now. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: How to handle a preview page
On Sat, 2007-03-24 at 08:41 +1100, Malcolm Tredinnick wrote: > Quite often, preview and edit are combined on the same form, so you see > the preview version at the top and the editable fields lower down. If > you do this, your single form (for edit/create) just needs a block at > the top that contains the optional "static preview" version. Yeah. I don't mind this much in wikis, but it feels ugly to me in general, especially if the form is rather long. > Another way is to layout the form fields as you normally would and then > use CSS to hide them (feels ugly to me, but technically possible). That's an idea, but probably not great for text readers. And you're right--using CSS for what is basically content formatting is just as bad, IMHO, as using HTML for presentation. > If you don't want to do either of these and truly want to store the > information in hidden fields the second time around, then, yes, you are > going to have to specify all the hidden fields, or provide a way to > alter the "type" of your original fields between their editable type and > "hidden". So there will be some repetition, whether you generate them > programmatically or by hand. That really can't be avoided because you > *are* repeating the information. Let me ask a silly question before I go off and do something radical, just to make sure I won't hit a brick wall later. I'm trying to model every conceivable kind of question in a way that won't involve changing the database later. To do this, my Question model has some meta-information and has a OneToMany mapping to a DataBit model. A DataBit has fields for type and one piece each of textual and numeric data. If I want a true/false question, it has two DataBit objects: a bit containing the statement and a bit indicating whether it's true or false. If I want a fill-in-the-blank question, it has one DataBit instance for the statement and one for each answer that belongs in the blanks. For a multiple-choice question, there are several bits: the question, each possible answer, and a bit saying which answer is correct. Obviously, trying to represent these things directly from the database is a bit of a pain, so I have non-model classes that translate from the representation in the database to a more natural representation and vice versa. These classes also create the forms (as in django.newforms) that I display. Could I pickle one of these non-model objects and use the pickled value in a hidden field to store everything all at once and then get it back really easily? I've never used pickle, so I'm a little apprehensive that there are gotchas I don't know about, but, if it works the way it's advertised, it seems an easy way to dump something into the preview and then reconstruct it on the way out. Are there any gotchas I should be aware of before I start? Thanks for reading all of that, Todd --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Announcing Django 0.96!
On 3/24/07, Marc Fargas Esteve <[EMAIL PROTECTED]> wrote: > Maybe the release notes should say that newforms do not yet support File > uploads in an easy way (see #3297) just to warn people moving from oldforms > to newforms ;) The release notes, I believe, mention that newforms is still under development; trying to run down every item in the library would probably be out of scope for the release notes for Django itself :) -- "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Announcing Django 0.96!
Hi James, Maybe the release notes should say that newforms do not yet support File uploads in an easy way (see #3297) just to warn people moving from oldforms to newforms ;) Cheers, Marc. On 3/23/07, James Bennett <[EMAIL PROTECTED]> wrote: > > > We're pleased to announce the release of Django 0.96 today; this > release involves cleanup and stabilization of features from the 0.95 > release, along with some nice new features: an integrated testing > framework, the first release of the newforms library, and a ton of > useful improvements. > > There are also a few backwards-incompatible changes, documented in the > release notes[1], but for most users this should be a simple and > painless upgrade. One particular change, however, bears mentioning > explicitly: users of MySQL who are relying on older versions of the > MySQLdb adapter will need to upgrade their copy of MySQLdb to at least > version 1.2.1p2 or switch to the new "mysql_old" backend until they > can upgrade. Check out the release notes for details on this and all > other backwards-incompatible changes. > > The full release, as always, is available from the "download page on > djangoproject.com: > http://www.djangoproject.com/download/ > > A huge round of thanks is due to everyone who's reported bugs, > submitted patches, triaged tickets and helped out in countless other > ways; we'd never be able to do this without you :) > > [1] http://www.djangoproject.com/documentation/release_notes_0.96/ > > -- > "Bureaucrat Conrad, you are technically correct -- the best kind of > correct." > > > > --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: ordering on a ForeignKey field in the admin
I still need to solve this issue. Am I missing something obvious, or can this be a bug? Thanks again... oMat On 23 Mart, 14:37, "omat * gezgin.com" <[EMAIL PROTECTED]> wrote: > I have two models, Artist and Album. I am able to add new albums via > the admin interface but the list of artists in the album edit / add > pages are not ordered. > > If I am not getting the documentation wrong, this should be achieved > simply by stating the default ordering in the meta class. My > (simplified) models are as follows: > > class Artist(models.Model): > name = models.CharField(maxlength = 100, core = True) > > class META: > ordering = ['name'] > > class Admin: > list_display = ['name'] > > class Album(models.Model): > title = models.CharField(maxlength = 100, core = True) > artist = models.ForeignKey(Artist) > > class Admin: > pass > > The artist list appears as a multiple select box as it should be, but > it is not ordered. > > Thanks for any 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-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Custom SQL - Do I need to close the connection?
On 3/22/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Do I need to close the connection after I'm done with the results? > I've also recently started receiving 'too many connections' errors... > and thought this might be the reason? Django will automatically close the connection at the end of the request, so you don't need to manually close it. Django also keeps only one DB connection per request, regardless of how you use it (e.g., whether you just use the Django ORM or grab the connection manually and execute custom SQL), so it shouldn't affect how many connections you have. Usually when I get that error message it's because someone else on my shared server turned on some Wordpress plugins and is doing a hundred queries per page on their blog. -- "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: syncdb & postgreSQL
OK, here are a piece of backgrounds: OS: Windows XP The version of Django is 0.95.1 (stable version; not svn), the version of PostgreSQL is 8.2. I use psycopg2-2.0.6b1.win32-py2.5-pg8.2.1- release for the databasebinding. The error comes from Django: Following steps (the applicationname is tm): - validate -> 0 errors found - syncdb -> creating tables and installing some initial data; all works fine - reset -> error: = Error: tm couldn't be installed. Possible reasons: * The database isn't running or isn't configured correctly. * At least one of the database tables already exists. * The SQL was invalid. Hint: Look at the output of 'django-admin.py sqlreset tm'. That's the SQL this command wasn't able to run. The full error: constraint "team_id_referencing_tm_team_team_id" does not exist = - sqlreset: (abstract) = BEGIN; ... ALTER TABLE "tm_player" DROP CONSTRAINT "team_id_referencing_tm_team_team_id"; ... "; = - a look in the databaseinterfcae (pgAdmin): the name of the constraint in table tm_player is: team_id_referencing_tm_team_team_id_1 I don't know, what can I do. For every changes in the db-model, I have delete all tables by hand and but now I can use 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-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Authentication Issues...
Totally fixed me up. Thanks! On Mar 19, 9:33 am, "James Bennett" <[EMAIL PROTECTED]> wrote: > On 3/19/07, mediumgrade <[EMAIL PROTECTED]> wrote: > > > I am not sure what the difference is between RequestContext and > > Context (I am still fairly new to Django and Python). > > RequestContext automatically adds some extra variables to the context > of every template that uses it; exactly which variables depends on the > TEMPLATE_CONTEXT_PROCESSORS setting, but the default set includes a > variable called 'user', which lets you do things like '{% if > user.is_authenticated %}' in a template. > > To use it you'd want to do something like this: > > from django.template import RequestContext > > def home(request): > if not request.user.is_authenticated(): > return render_to_response('login_error.html', {}, > context_instance=RequestContext(request)) > else: > return render_to_response('index.html', {}, > context_instance=RequestContext(request)) > > And also note that Django will happily help you out with forcing > login; you could write the view like this: > > from django.template import RequestContext > from django.contrib.auth.decorators import login_required > > def home(request): > return render_to_response('index.html', {}, > context_instance=RequestContext(request)) > > home = login_required(home) > > The 'login_required' decorator will accomplish the same thing as your > manual authentication check -- if the user isn't logged in, it will > force them to log in and then go on to your view. > > -- > "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---