Re: a rather big, new django site:
Damn, 3 weeks ago I was talking to a friend about an idea for a website which is just like Splice. The focus was a little bit more towards musicians, letting them upload tracks and setting prices for its usage, but anyway, the sound mixer you coded is fantastic, and I bet it was damn difficult, which is the whole reason why I really never went ahead with the idea. I guess that's why who's envy now it is me ;) Nice work, Bram! On 7/28/07, Bram - Smartelectronix <[EMAIL PROTECTED]> wrote: > > > http://www.splicemusic.com/ > > ( summary: upload sounds, load them into a flash audio sequencer with > effects and synthesizers + standard community features) > > thanks a lot to all the people who have helped me getting this thing up > and running! :-) > > cheerio, > > - bram > > > > -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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: removal of Django
Hi, You probably went to a website and saw a 404 error message saying that Django could not find the page. The thing is that what you're seeing is the message sent by Django installed on the server, not on your computer. There's no Django installed on your PC. On 7/20/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Hi all.Django auto loaded onto my computer from( I believe) a Harry > Potter web site.I want to remove it,as it is messing up one of the web > sites that I frequent.The site shows a 404 error.As I am a newby to > computer with NO codeing experience,I am at a loss as to removing > it.Hope that this is posted in the correct place.Thanks for any help > that you can give. > Leo > > > > > -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 Google index Django's pages?
hi Felix, Yes, Google will index your website even if you use Django. The only stuff that stop Google are the robots.txt, meta tags, and a direct request. Don't worry, if you can access your website using a browser, there's at least one link to it somewhere, and you didn't do any of the three things I mentioned to stop Google, search engines will find you. On 7/13/07, felixhummel <[EMAIL PROTECTED]> wrote: > > Hi! > > Before I decide to dive into Django, could you please tell me if > Google can crawl pages created by Django natively? > I am running an Apache with mod_python. Does this matter? > Thanks in advance! > > Felix > > > > > -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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: Did someone write an anti-spam module in django?
I was getting around 5 spams daily on my website when it had 1.5k impressions daily. I've implemented a very simple anti-spam solution which has eliminated every spam, while I've tripled my traffic. It's called "negative captcha", and it's very easy to implement. One day some spammers will learn how to defeat it but for now, it's doing the job :) http://damienkatz.net/2007/01/negative_captch.html On 6/14/07, kernel1983 <[EMAIL PROTECTED]> wrote: > > My weblog has got lots of spam. > > I'll try to deal with them. > > Any one has done this job? > Would you mind share your code? > > > > > -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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: Where did you put your homepage view?
On project_name/views.py ? Or do you mean the html template? I usually put on the template root dir, except for my largest project which has a sub-dir named after the website, where I store site related stuff like TOS, privacy policy... On 5/23/07, David Larlet <[EMAIL PROTECTED]> wrote: > > Hi, > > I'm juste curious, where did you put your homepage view when you've > got a project with a lot of apps? Is there a best practice here? > > Thanks, > David > > > > -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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: migrating 400 images
Just "mv" or "rename" the files and UPDATE the database with the new path. 10 seconds max. On 5/4/07, Milan Andric <[EMAIL PROTECTED]> wrote: > > Hi, > > I'm migrating a tutorials site to Django and have created a file model > that is associated with tutorial pages, etc. Now I need to go through > and migrate all the old content. Rather than upload 400 images I was > hoping to write a script to call the File.save() method appropriately > and just copy the images into the new location. > > Any thoughts on how to approach this? Do you think this will likely > take more time than just doing it by hand? > > Thanks, > > Milan > > > > > -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 do this in Django?
You can specify what frame should a page be loaded by putting its name on the "target" link attribute. What you'll have on your left frame are links to the right one. Most browsers won't reload the page when an anchor is clicked for a page already being displayed. So the browser will understand that you want to see content on the right frame, and "jump" to the link. If you need help doing frames and named html anchors, I am sure this material can be found on any search engine. Just try "html left right frames" and "html named anchor", but you'll hardly get satisfactory answers on this list since it's out of its scope. On 4/30/07, Pythoni <[EMAIL PROTECTED]> wrote: > > Julio,Thank you for your reply. > But can you provide some more details, please? > How can be a focus set in frames with anchors? > Thanks for reply. > L. > > > On Apr 30, 8:45 pm, "Julio Nobrega" <[EMAIL PROTECTED]> wrote: > > I don't know how Google Groups implemented, but wouldn't two frames > > with anchors work? You don't "need" Django for this, it's just HTML. > > > > On 4/30/07, Pythoni <[EMAIL PROTECTED]> wrote: > > > > > > > > > Is it possible to use in Django views two "windows" related together? > > > I mean something similar to Google groups . > > > If you choose Tree view, in Google groups, you have one "window'" of > > > authors and the other with their replies. > > > Now that you click on any author his reply will move to the top of the > > > screen. > > > It works like focus() in Javascript. > > > > -- > > Julio Nobrega -http://www.inerciasensorial.com.br > > > > > -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 do this in Django?
I don't know how Google Groups implemented, but wouldn't two frames with anchors work? You don't "need" Django for this, it's just HTML. On 4/30/07, Pythoni <[EMAIL PROTECTED]> wrote: > > Is it possible to use in Django views two "windows" related together? > I mean something similar to Google groups . > If you choose Tree view, in Google groups, you have one "window'" of > authors and the other with their replies. > Now that you click on any author his reply will move to the top of the > screen. > It works like focus() in Javascript. -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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: check if a list contains a single item in a template
{% if list|length_is:"1" %} Only one! {% endif %} http://www.djangoproject.com/documentation/templates/#length-is There's also: {% ifequal list|length "2" %} Two here! {% endifequal %} http://www.djangoproject.com/documentation/templates/#length On 4/20/07, drackett <[EMAIL PROTECTED]> wrote: > > Is there an easy way in djangos tempaltes to do any sort of counting? > I want to check if a list of objects only has a single object, and if > so display something. I could also see this being helpful for any > number of things using differnt count values. Is this possible? > > > > > -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 urls for the same view?
You could use different directories (Django projects) under multiple VirtualServers (different domain names / ports), each one for a particular developer. On 4/20/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > I'm trying to setup three development directories for different > programmers, for us each to be able to checkout our project to from > svn on the same development machine... -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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: Giving easy access to designers
If you think manage.py is the best solution but people would be unconfortable with the command line, you could make a few Python scripts to stay on their desktops so they would only need to double click them for something to happen. I don't know what requirements you have exactly and what's your network setup (even why designers need access to manage.py) , but imagine a folder on the designer desktop named "Projects". When opened, a few icons saying "Start Project X Server" or "any manage.py action as a simple name". The script ssh's to the server and run manage.py. The folder could be a shortcut to a Samba shared folder, where you're the one creating the scripts, so you still have control over what they do, but everyone has access. On 4/17/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Hello, > > Our web team recently decided to switch over to Django for new > projects since it's cleaner than PHP and easier to go from a small > site to a full-featured site. > > I have a problem however, I'm not sure how to set up an environment > for the web designers. When we used PHP, it was pretty easy and > simple: the projects were hosted on a machine with Samba, so all they > had to do was go to W:\Project, edit the files they needed to work on, > and load that project in their browser. > > With Django, it's more complicated. I thought of a few scenarios, but > none as simple as PHP. > > 1. Share the directory in which I keep my Django projects with Samba > and give them access. The downsides are that they could be editing > the same files as me at the same time (which is the reason we decided > to implement Subversion) and that if I am not running the development > server for a particular project, they need me to start it up. > > 2. Teach them how to use *nix and manage.py. This would work best, > however, this would not fly well with them. > > 3. Set up an Apache server for development (as indicated in the > mod_python documentation). This has the disadvantages that I would > need to manually set up a VirtualHost in apache2.conf for each project > everytime one is added and also that they would need to maintain a > hosts file on their workstations (we don't have an internal DNS > server.) > > Are there other possibilities that I haven't thought of? > > Vincent. > > > > > -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 comparison
Hi Harris, Django is a framework where you can build a CMS, it doesn't come with this behaviour after installed. You're going to have to make a "Model" for "Article", code the functions to retrieve them, build each display page (the html), etc... The comparision can't really be made, since when you install Joomla you get a very focused (even counting the plug-ins) solution. You would have to build a CMS using what Django offers. Now, that's good and bad :) You'll have complete control of the software, doing things your way, adding features that you want. If Joomla covers your needs as a CMS, go for it, unless you want things differently, and that's where Djando would fit it. I am sure someone has already built CMSs using Django, so a search on the list archives and Google might be fruitful if you want a starting point. On 4/16/07, M Harris <[EMAIL PROTECTED]> wrote: > > hi folks, > I have a client wishing to go with Django as a content management > solution > (safe web hosting) and would like to implement the server with MySql. > > I am new to Django, but am familiar with python. I am also familiar > with > joomla (formerly mambo), and I would like someone to provide a comparison / > contrast between Django and joomla please, no hype, just the facts. I am > interested in the strengths and weaknesses of each. > > Thanks folks, > > Ps Please feel free to send directly to my email to cut down on list > traffic. tnx > > -- > Kind regards, > > M Harris <>< > > > > -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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: Super long response times/load times: Looking for some guidance on alleviating the issue
On 4/15/07, Roboto <[EMAIL PROTECTED]> wrote: > You'll notice a SOLID 5-10 sec "wait" before the page loads, which > makes me believe that the server is doing something in the background Hi Roboto, I didn't had to wait for the page to load. It was fast. Perhaps it's an intermittent issue (probably peak server loads) or it just happen with logged in users? -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [EMAIL PROTECTED] 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 scaling and Database replication
Hummm... looks like I own you an apology, Merric. I was wrong about how to access the replicated data on the slave hosts. I was either thinking about clusters or I was flat out wrong. But what James said, and kemuri, approachs my mistake. I hope it helps you :) On 4/9/07, Merric Mercer <[EMAIL PROTECTED]> wrote: > > The official documentation on MySQL 5.1 "Using Replication for > ScaleOut" is explicit and states that it is the application (Django) > that needs to send the writes to the Master and the Reads to the > Slaves.Unless I'm wrong this would rule out using replication with > Django. > > The quote from the MySQL document is below. According to quote changing > Django to handle replication should be relatively trivial (but beyond my > skill set at present), - does anybody know whether any work has been > done on this? > > MerMer -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 scaling and Database replication
Yes, there's a way, but it's not in Django that you do this, but on the database. You don't need to configured Django (or any application accessing the database) to "talk" to slave hosts. It's the job of the database server software to abstract this step for you. You're going to setup slaves to a master host, and in most cases, the former will be used for SELECT and the latter to I/U/D. What happens is something like this: Master M and slaves S1 and S2 are configured. Application asks M for row id 15. M sends query to S1. S1 answers to M who answers to application. Application asks for row id 20. M sends to the next slave, S2, and so on. As new queries keep coming, so M keeps rotating between its slaves. On 4/8/07, Merric Mercer <[EMAIL PROTECTED]> wrote: > > The django book's chapter on deployment mentions the use of Database > replication as a means to scale using MySQL. > > My understanding with Database replication is it uses a MASTER DB and a > number of SLAVES. > The master updates the slaves, asynchronously. This means that the > slaves are used for reading data only and only the master is used for > writing data. > As the number of reads typically exceed the number of writes replication > is supposed to work well. > > However, I can't figure out how Django handles it. I can't see anything > in the documentation or the settings that would allow writes to be > handled by a different host to the reads. > > Is there a way to do this? > > MerMer > > > > > -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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: Preventing Multiple Logins
I did it using PHP. It can be circumvented but it's not something the average user would do. Everytime an user logins, the session id is stored on a table, with the time and the user id. On every request by every logged in user, I put every previous session ids from the user id on an array, remove the last element (which is the current session id), reverse the array (to increase the chance of finding the current session id faster), and check if the current session id is in there. Here's part of the code, I hope you can translate it to Python/Django. It costs one query on every page request, but since I charge people based on the number of users they create, I can't let them logon with the same username :) $sql = "SELECT session_id FROM access WHERE user_id = '$user_id' ORDER BY time"; $session_id_list = // queries and stuff to make the above SQL data in an array; $last_session_id = array_pop($session_id_list); $session_id_list_reverse = array_reverse($session_id_list); foreach ($session_id_list_reverse as $key => $_session_id) { if ($last_session_id == $_session_id) { unset($session_id_lista_reverse[$key]); } } if (in_array(session_id(), $session_id_list)) { header('logout.php'); } You can clean the 'access' table every once in a while to keep it small (I do it weekly). So, what happens is that I am checking if any session id, other than the last one from an user on my access table, is his current one. If it is, he's logged out, but the user who came later keeps logged in. It can happen that users will have to logon twice, but it never happened to any of my users, I just know it's something possible but I never bothered to fix it, because it only happens if they return to the login page without clicking on the logout button or closing the browser, and really my users don't have many reasons to return to this particular login page, which is just a form. Worst case, they only have to type their username and password twice. On 3/16/07, cwurld <[EMAIL PROTECTED]> wrote: > > Hi, > > In order for users to use my Django site they must login. I am using > the standard auth app. I set the session to expire when the browser is > closed or when the user clicks a log out button. > > I would like to find a way to prevent users from simultaniously > logging in from different computers but using the same username and > password. > > Any suggestions? > > Thanks, > Chuck > > > > > -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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: video uploads (like you tube)
Uploading a video is easy, just use the correct Field from Django. The real work is converting the video to .flv (Flash Video). I've never seen a Python module for this job but I bet there's one. I've never uploaded a video to YouTube neither... but I know Flash video players use .flv. On 1/24/07, carlwenrich <[EMAIL PROTECTED]> wrote: > > Is there a quick and easy way for users to upload videos the way they > do it on you tube? Is there an example django site that has this > capability? > > > > > -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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: Charset hell
I had a bunch of unicode errors using the template tag trans while using Python 2.3. Upgrading to 2.4 solved all my problems. What version of Python are you using? On 1/17/07, guzru <[EMAIL PROTECTED]> wrote: I'm using django 0.95 and xgettext 0.14.6 on fedora core 6. -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 a view open a page in a new browser window?
No. What you can do is open a "normal" webpage and use window.open() at body tag onLoad(). On 1/11/07, Bob T. <[EMAIL PROTECTED]> wrote: > > Hi All, > > I have a situation on the Django site where a view needs to either > return a normal page, or it might need to open a new browser window to > display the response (a report). I know for the normal case I can just > return an HttpResponse, but is there anything that can cause the > response to be displayed in a new browser window? I'd like to get the > same affect that using "target=" would have with a link. > > Thanks much, > Bob > > > > > -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 Projects and Subversion
What if someone commits something that brakes the live website? My recommendation is to checkout into the live folders the version/tag/branch you want. Or checkout somewhere, test the app, and then copy the files. Just don't run the website from a codebase where developers are commiting. On 1/10/07, Aidas Bendoraitis <[EMAIL PROTECTED]> wrote: > > I have an SVN-specific question which doesn't really fit into Django > groups. Anyway, maybe somebody of you will have enough experience and > competence to answer it. > > We are going to set our Django projects under > version control on a dedicated server. We will also publicly run > several Django websites on the same server. So what is a better > practice -- to use the code under source > control for the public websites directly, or to have copies (tags) of > the subversioned code for the public websites? > > How is this managed with djangoproject.com and djangobook.com? > > Regards, > Aidas Bendoraitis aka Archatas > > > > -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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: Handling bad URLs
Use get_object_or_404() or make a try/raise block with raise Http404. On 1/5/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: I'm not sure why this throws a 500 error rather than a 404, but I'm hoping somebody can help. On my site, each forum has a slug... site.com/foo-bar/ but if someone types in site.com/foobar/ it gives a 500 error. Traceback says "DoesNotExist: Forum matching query does not exist." which makes sense. Relevant url is: (r'^(?P[-\w]+)/$', 'views.topic_list'), I'm trying to figure out how to capture a non forum_slug and either route them to the right place if possible, or at least give them a 404. -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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: HTTP_REFERER isn't set using Explorer
On 1/4/07, Benedict Verheyen <[EMAIL PROTECTED]> wrote: Hi, This is what goes wrong in explorer: the HTTP_REFERER isn't set. With Firefox, the HTTP_REFERER is set. Any idea how i can solve this? I had this problem with a client that was running Norton and somewhere in the program preferences there's an option to disable the browser referer. This is not exactly the name of the option, you'll have to search for it. Maybe there's some application blocking, specially if there's one installed that has privacy settings. -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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: What if slug is already used?
Slugs columns are indexed only. You need to add unique = True if you want them to be, well... unique. The thing with slugs is that they're usually needed with another url fragment that makes them unique, either by design (with unique_together) or just probability (appending the date: /mm/dd). So, yeah, if you don't have dates to work with or don't want them in the URL, still wants to use a SlugField, either add uniqueness to it or something else to separate the data. ID columns are fine if you can live with numbers in your url. In the end, depends what's your site content and how do you want your urls to look. On 12/20/06, Rob Hudson <[EMAIL PROTECTED]> wrote: I have an object that has a title. I'd like to use the title to pre-populate a slug field for use in URLs so I can have descriptive URLs. Instead of: /myobject/(?P\d+)/ I want: /myobject/(?P[-\w]+)/ I'm concerned if the user types in a title that's already taken. Slug fields get a db_index=True by default. Does that mean it must be unique in the database or simply that it will index this column. I'm thinking (and hoping) the latter. But how do you look up by a field that could result in multiple rows in the case that the user types a title that results in a duplicate slug? Do you set the url to be something like this? /myobject/(?P\d+)/(?P[-\w]+)/ Thanks, Rob > -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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: Opera & caching
Opera's cache is very agressive. I use Opera for almost all of my internet browsing and I've never met a form that isn't shown again (with its field's content intact!) when "backing", either pressing the arrow or using mouse gestures, even when caching is completely disabled (in preferences, "always" check for images and documents). I like to think that's a feature... :p On 11/29/06, Michal <[EMAIL PROTECTED]> wrote: > > Hello, > I have problems with Opera browser and caching. > > I have URL /prihlaseni/. > If user isn't logged, I give him html form for login. > If user is already logged, I give him only text message, that inform him > about this state, together with link to logout. > > So, one URL, but two different content (depends on users login). > > Everything work just fine in my browser (Firefox). > I try the same in Opera browser, and there is problem. If user done > successfull login, then click on some other URL, and then go back to > /prihlaseni/ page, he see login form (but he should see only text). If I > make reload (CTRL+R), content is updated to correct content (text). > > I suppose, that this is occasioned by Opera and his caching, but maybe > this could be solved by some extra HTTP information send by Django (etag?). > > I don't use Django framework. > > Do you have some advice? > > > Thank you > Regards > > Michal > > > > > -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
/admin/ works with www, not without, on just one domain
Hi! I have two domains running Django. In one, I can access: http://babaia.com.br/admin/ or http://www.babaia.com.br/admin/ But on the other one: http://miniurl.com.br/admin/ gives me an error and http://www.miniurl.com.br/admin/ works fine. Here are their VirtualHost. Each reside on different files named after its domain inside the /etc/apache2/sites-available/ diretory, symlinked to /etc/apache2/sites-enabled/. Ubuntu Dapper is the distribution. They look identical, all I changed is the domain name. Everything works fine, except the admin from the server without the www. ServerName www.babaia.com.br ServerAlias babaia.com.br DocumentRoot /var/www/babaia.com.br CustomLog /var/log/apache2/babaia.com.br/access.log combined ErrorLog /var/log/apache2/babaia.com.br/error.log SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE babaia.settings PythonDebug Off PythonPath "['/usr/lib/python2.4/site-packages/django_091'] + sys.path" PythonInterpreter babaia SetHandler None SetHandler None ServerName www.miniurl.com.br ServerAlias miniurl.com.br DocumentRoot /var/www/miniurl.com.br CustomLog /var/log/apache2/miniurl.com.br/access.log combined ErrorLog /var/log/apache2/miniurl.com.br/error.log SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE miniurl.settings PythonDebug Off PythonPath "['/usr/lib/python2.4/site-packages/django_091'] + sys.path" PythonInterpreter miniurl SetHandler None SetHandler None Any idea of what's wrong? Many thanks, -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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: Automatically adding http:// to a URLField
Override the save method on your model to check if the "http://; string is not in the self.field_name, and if it's not, add it. http://www.djangoproject.com/documentation/model_api/#overriding-default-model-methods On 11/15/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Hey, > > Am trying to use a URLField in my app, but if the user doesn't stick > http:// on the front of it, it fails vaildation. Is there a way to > automatically add one if one isn't present - rather than it just > failing validation? > > Many Thanks, > Oliver > > > > > -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 does the forloop really work?
Ugly, but I guess it works: {% for article in list %} {% if forloop.first %} First {% else %} {% ifequal forloop.counter 2 %} Second {% else %} {% ifequal forloop.counter 3 %} Third {% else %} Rest goes here {% endifequal %} {% endifequal %} {% endif %} {% endfor %} On 11/14/06, Keith Mallory <[EMAIL PROTECTED]> wrote: > Hi, > > I am trying to get a list of articles displayed in different parts of a web > page. The latest article in specific , the next 2 in another and > rest of it somewhere down inside the same page. > > > > I am not able to figure out how? My guess is forloop, but how? > > > Thanks > > Keith > > > > -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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: A modest plea
Does Trac allows to disable the priority field? At least make it only available to certain users? Because I don't think this will never stop. Every place I've worked where we allow our costumers to tell the priority of a request, this happens. In fact, if we used a scaled priority, say, 0-10, there were people emailing us with "priority 11" requests, followed by "priority critical: out-of-scale" and "should be done yesterday already". What's the benefit of having a priority field? To priorize dev's work? If they review this data, aren't they the only ones with enough knowledge to assert its value? And the low priority requests which are in fact high priority because the submitter didn't saw other parts of the system affected by the bug? Sorry if that sound like a rant, I've had related bad work experiences :p On 10/22/06, James Bennett <[EMAIL PROTECTED]> wrote: > > Yes, every bug is important. Yes, I understand that something you need > that isn't working right is critical to you. But... > -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Migrating from ASP.NET to Django?
Sure there is hope. I haven't found any website that couldn't be made with Django. After all, it's about HTTP communication. There are even two websites that deal with price comparison in the wiki (http://code.djangoproject.com/wiki/DjangoPoweredSites): http://www.gutata.com/ and http://niftylist.co.uk/ But I believe none can answer your question besides yourself. Are you sure you can code in Python this C# specific code that you have? Does your database serves others apps which you'll have to modify? And what's a small website or a large one? I've seen Django powering social networks with more than one million members, but what's the load? Does it use cache? Does the DBA knows what she do? If you're confident you can do whatever you do in Django, I say go for it. On 10/20/06, Carlos Yoder <[EMAIL PROTECTED]> wrote: > > Hello folks, > > I have this idea in my head going for a lng time now. Since I > already deployed my first Django app and everybody's happy (especially > me), I'm getting excited about migrating my main project to Django. > > First of all, it's a not a small site, so planning is of the absolute > essence (we do price comparisons for a big catalogue of products). > > Has anybody tried to tackle this yet? At all? It's the whole deal: > MSSQL database (I know, I know), IIS6+, C#, a lot of very specific > code, etc. > > Is there hope, doctor? > > -- > Carlos Yoder > http://blog.argentinaslovenia.com/ > > > > -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: How to override the admin save method?
Override the "save" method. http://www.djangoproject.com/documentation/model_api/#overriding-default-model-methods I use nesh's ImageWithThumbnailField() which does this file rename on save, you might want to check its source code for tips. http://trac.studioquattro.biz/djangoutils/wiki/Thumbnail On 10/14/06, iain duncan <[EMAIL PROTECTED]> wrote: > > I got some previous advice on overriding how the admin does delete which > was pretty straightforward as it does just uses a url. The Save button > doesn't seem to work that way. > > I would like to save a file name not as it is given, but in an altered > format based on another field, so before the file gets uploaded I need > to save it's name. Any tips on how to approach that? > > Thanks > Iain > > > > > -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Birthday
You could use an SmallInteger field and store MMDD... or use a date field and default they Year value to some number, like 2000... On 10/12/06, Guillermo Fernandez Castellanos <[EMAIL PROTECTED]> wrote: > > Hi, > > I am trying to keep a birthday field in the database. But i am only > interested in the day and month. Is there a way of using a DateField > but only with day and month fields? Or should I use another solution? > > Thanks, > > G > > > > -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Extending a template - error
I think templates to be inherited must be on the base template dir... I remember reading this somewhere but can't find references online. Can you test please? On 10/12/06, MerMer <[EMAIL PROTECTED]> wrote: > > I've now moved the parent template into the same directory as the child > template but I'm still getting the same error. > -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: I'm so confused...
Ok Steven :) First of all, Django is not a "command line language". Django is a framework, a collection of practices and codes and data and functions that facilitate web development. Python is the programming language. It's what we use to open files, loop, add numbers, etc... It's a *very* good idea to learn some Python, the basics, before using Django. What you see in the tutorials and the examples related to "command line", or things that look like you can type on a command prompt, it is because Python has a "shell", an interpreter for your commands. You got one when you installed Python on Windows XP. At this place, you can type Python commands, for example, to "import modules". A module is a collection of code, data, functions and classes to organize your stuff. See the relation between modules and frameworks? Basically, Django is a series of Python modules oriented for certain things (web dev). There's a bunch of different Python modules, some came with your Python installation, to manipulate files, urls, or math, and a lot you can download from the net, to use graphics, DirectX, audio files, etc... anything a programming language can do. To develop with Django, the minimal thing you need is just Python installed. Search Google for the "python sqlite module" (a collection of code to manipulate sqlite databases), and install that. Then, follow Django's tutorial very closely, and search the net for more Django + Windows XP tips. And use Django's development web server! There's a reason why you pay thousands for people like me to do this stuff, buahahhhah! :) just kidding. It's not hard, but you need to be committed, and learn 2 programming languages, Javascript and Python, plus HTML. On 9/25/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Ok, > > I decided that I don't want to spend $1,000s on other people coding my > databases etc so I thought Django looked pretty good. I read some of > the code and it seems pretty intuitive (with a lot of hard work!) > > Now my problem is understanding just what the hell is being said in all > these setup tutorials. > Am I right that Django is a command line based language? > > This might seem a bit silly to you all but I like environments such as > dreamweaver with GUIs and options. > > I have a XAMPP based web server on my WinXP system which is nicely > configured to serve sites via Virtual Hosts. It took me a good few > hours to configure that! > > I followed several howtos on setting up django but with no success. > Python Paths? WTF? > > I've been here for hours downloading python 2.4, apache2triad and other > stuff to try and get it to work. > > Anyway I'd appreciate know exactly the steps needed with some decent > examples on how to set a development server with Django in mind. It > looks great and I want to develop for it! > > Perhaps someone can create a series of videos showing a WinXP setup of > Django? > > Thank you all for your help and patience! > > > > > -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Using a webservice as the datasource
On 8/31/06, Iwan Memruk <[EMAIL PROTECTED]> wrote: > Hi, > > Has anyone got any experience of doing that with Django? How > would you estimate the effort necessary for adapting Django to use > webservices as the data source? What would be your approach? I am using Django with the Yahoo API. There's even a python module to make web searches and other Yahoo stuff (*verrry* easy to use). What I did is create a model replicating every field from the returned data, then my view requests something and I obj.save() it, making it available on the admin interface. Something like (this is for Yahoo news search): from yahoo.search.news import NewsSearch srch = NewsSearch('yahoo_app_id', query = 'something', results = 50, language = 'en') for news in srch.parse_results(): publish_date = datetime.fromtimestamp(float(news.PublishDate)) thumbnail = news.Thumbnail if thumbnail is not None: thumbnail = thumbnail['Url'].encode('utf-8') try: obj = News.objects.get(slug = slugify(news.Title)[0:50].encode('utf-8')) except News.DoesNotExist: obj = News(slug = slugify(news.Title)[0:50].encode('utf-8')) obj.title = news.Title[0:125].encode('utf-8') obj.summary = news.Summary.encode('utf-8') obj.click_url = news.ClickUrl.encode('utf-8') obj.news_source = news.NewsSource.encode('utf-8') obj.news_source_url = news.NewsSourceUrl.encode('utf-8') obj.language = news.Language.encode('utf-8') obj.publish_date = publish_date.__str__() obj.thumbnail = thumbnail obj.save() Then I grab some news from the DB: news_list = News.objects.all().order_by('?')[0:3] The encode('utf-8') was necessary because Mysql was complaining about the data, don't know if it'll happen with your DB/server configuration. -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Custom tags and template inheritance
I opened a ticket for a similar problem. It's a feature ;) http://code.djangoproject.com/ticket/1193 On 8/22/06, Enrico <[EMAIL PROTECTED]> wrote: > > - or the docs should say that "load" tags doesn't get inherited. -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: How to log ALL queries
On 8/11/06, Hancock, David (DHANCOCK) <[EMAIL PROTECTED]> wrote: > > To get to the next step with the Oracle patch, I'd really like to learn > what to change to force ALL queries to be logged. I think I read a message on this group about a middleware that does this (the guy was selling it cheap, if I remember correctly). Another solution (I think) is to hack \django\db\backends\mysql\base.py, class MysqlDebugWrapper, method execute(), to write stuff to a file. -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Google-like API keys
On 8/10/06, hernan43 <[EMAIL PROTECTED]> wrote: > > If I wanted to make a Django app that utilized a custom authenticator > and my own "API key" what would be the best way to generate unique API > keys for my app. Anything random and unique will do it. You just need to differentiate between requests. md5 of a username + randomstring is fine. I also like how Yahoo handles it. They limit by IP addresses inside a time-frame, not per API key. So if someone gets someone else's key not much harm is done. -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Anybody set up Django using Dreamhost?
On 8/3/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > I'm working my way through the tutorial on Dreamhost's wiki > (http://wiki.dreamhost.com/index.php/Django) and came upon a problem, > namely the django-admin.py: command not found prompt. > Did you run "source ~/.bash_profile"? If yes, try to run "python django-admin.py etc". Hope it works :) -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Distribute Django program to run on a local computer
I was going to recommend a Live CD too, but let me get back a little to the first thread email and perhaps say something really stupid: On 7/31/06, Rob Hudson <[EMAIL PROTECTED]> wrote: > As part of the grant review > process, the reviewers must remain anonymous and therefore, we cannot > simply send a URL to our prototype Can't you use SSL, and tell the reviewers to use an anonymizer proxy? This is so much easier than hacking a Knoppix CD (been there, done that...) -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Design question (models? apps? field_type?)
Ok. Take it easy with me because I think I understand your problem, but the app goals seem amazing so I am going to try and help. First of all, I think you'll be asked to show both import and export to the same users (which are carriers and forwarders now, right?). So there's no sense in splitting them: Today, one delivers the goods and another one brings it, but someday a company can do both things. So I would merge Carrier and Forwarder, because they are really an "user", they just need to see different types of Offers depending on their interest. Let's call this model "Company" for now. An Offer is either an import or an export, so I would go with 2) Use one app "Offers" and put import/export models there, but with a ForeignKey to an Offer. Something like: class Offer(models.Model): products = models.ManyToManyField(Product) type = models.CharField(choices = (('import', 'Import'), ('export', 'Export')) seaport = models.ForeignKey(Seaport) target = models.ForeignKey(Y) # from your Seaport to Y example class Import(models.Model): company = models.ForeignKey(Company) offer = models.OneToOneField(Offer) # additional fields like Price, Time, Completed, etc... class Export(models.Model): company = models.ForeignKey(Company) offer = models.OneToOneField(Offer) # additional fields like Price, Time, Completed, etc... So here's what you're able to do (I hope I got it right): An user logs in. You pull the Offers based on the type field. He selects one, and you record it (pseudo: Import.save(company = request.user, offer = offer_selected)). In fact, Import and Export seems like they can be abstracted even more (maybe, I don't know your requirements). You can make a class named "Delivery" which has a ForeignKey to Company and Offer (unique_together'ed), and a Transaction class, which has a OneToOneField with Delivery but it stores the additional data. On 8/1/06, Robert <[EMAIL PROTECTED]> wrote: > > > I am designing a new truck transport database data service. > -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Displaying auto "id" field in Admin
Add "id" to your list_display on your model's Admin class, like this: class Admin: list_display = ('id', 'some_field', 'other_field') On change pages, no idea how it's done On 7/27/06, CL <[EMAIL PROTECTED]> wrote: > > Hello, > > Does anyone know of an easy way to have the auto generated id field > displayed in the Admin feature? > > Thanks, > > CL -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Django and Professional Widgets
I have a Django site with Dojo, but.. it's not very "integrated". I just call the necessary .js files on my base template and use the functions. There's no talk to Python code and vice-versa, or generators. On 7/27/06, jose <[EMAIL PROTECTED]> wrote: > > Hi all, > > I am going to create a site where I need very sofisticated widgets for > data presentation. > I wonder if anyone have tried to integrate Django with some professional > javascript tools like ActiveWidgets, > r.a.d controls, dojo, rico, etc. -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: hiding fields in admin
You can override the save() method and generate the slug yourself. There's also a templatetag that 'slugfies' a string. I think you can either use it to output the var or import the function on your save(). On 7/26/06, Tamara D. Snyder <[EMAIL PROTECTED]> wrote: > > Hi all, > > In my "Event" model I have a slug field that is automatically > generated from another field. I would like to hide the slug field > from admin users, but still allow it to be automatically generated. > I know I can hide it by using the "fields" parameter in the admin > class of my model. But if I do this then the slug field is not > automatically generated when I create a new event. Is there a way to > hide the slug field, but still have it be filled in when I create a > new event? > > Thanks! > > Tamara -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Best idea?
Depends on who are the "other visitors" :) And there's more than one way to do it. If you mean something like: it is either public or private, a BooleanField() on class Photo should do it. If you mean something like: The owner chooses the users that will have access to the photo, you can do a ManyToManyField() on Photo: class Photo(model.Model): owner = models.ForeignKey(User, related_name = 'owner') users = models.ManyToManyField(User, verbose_name = 'Give access to', related_name = 'access_to') But if you want more granularity on "access", for example, giving access for someone to see the Photo, and others to see and edit, and others to edit and send to email: permissions = ( ('see', 'See'), ('edit', 'Edit'), ('email', 'Email'), ) # owner is assumed to come from Photo class PhotoPermission(models.Model): photo = models.ForeignKey(Photo) access_to = models.ForeignKey(User) permission = models.CharField('Type of permission', maxlength = 5, choices = permissions) And there's always Django custom permissions, if it fits your needs: http://www.djangoproject.com/documentation/authentication/#custom-permissions On 7/22/06, PythonistL <[EMAIL PROTECTED]> wrote: > > I am creating an application in Django where users can insert photos > and I would like each owner of the photo(s) to be able to grant/revoke > access to this photo(s) to other visitors. > What could be the best idea how to do that? > Thank you for replies -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Django 0.91 and SVN (magic removal) on Dreamhost
Hi all! After some time I've managed to be able to run Django 0.91 and and the SVN version together on Dreamhost. I had a few projects done in 0.91 and I couldn't simply "svn update" the django_src directory. I don't know if this is useful to anyone else (perhaps to people on similar situation other hosts) but here's what you need to do :) I've followed Dreamhost's wiki instruction to install Django so the directory names are from there. - Create a directory for 0.91: mkdir $HOME/django_091/ - Copy django_src to django_091 (or grab a 0.91 copy and put there): cp -r django_src/* django_091 - Edit .bash_profile to accept the two Django dirs (don't know if it's really needed but I did it :p) export PATH=$PATH:$HOME/django_src/django/bin:$HOME/django_091/django/bin export PYTHONPATH=$PYTHONPATH:$HOME/django_src/:$HOME/django_091:$HOME/django_projects - Edit all the django.fcgi files you have, replacing: sys.path += ['/home/inerte/django_src'] with: sys.path += ['/home/inerte/django_091'] - Go to each project and make a link do django_091/django, so module imports are done on the correct directory: ln -s $HOME/django_091/django $HOME/django_projects/your_project_name/django - Remove two __init__.pyc files otherwise /admin/ will complain that someone messed with "magic numbers" (a django security thing, I suppose?): rm django_src/django/contrib/admin/urls/__init__.pyc rm django_src/django/contrib/admin/models/__init__.pyc - Update django_src to the newest SVN cd django_src svn update - Restart some stuff: pkill fcgi.py;pkill python And that's it :) Old projects living with 0.91, new ones living with SVN. As you convert your old stuff to the new Django syntax, remove the links made previously so Django imports from django_src: rm django_projects/your_project_name/django With hope that this will be useful to someone, -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: implementing a user login
Hello, Did you read http://www.djangoproject.com/documentation/authentication/ ? On 7/20/06, Josh Trutwin <[EMAIL PROTECTED]> wrote: > > Hi, > > I was browsing through the docs and tutorials but I'm not sure what > is the best place to look for how to implement the login portion. > I imagine this would require some use of sessions. -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
comments in Feeds
/utils/feedgenerator.py has code to add the 'comments' field to feeds but it seems contrib.syndication.views.feed doesn't deal with it if I use it on my child Feed class. Am I doing something wrong? Is this intended? The docs don't mention item_comments()... I would like to use it, if it's possible :) -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Perspective on building a community blog in a short timeframe
This might sound a little harsh, but if you need to ask if you can do it in Django, then you shouldn't do it. Not because it is not entirely possible... but because you're not confortable with the framework and its quirks and your productivity on it, yet. Since this is your Real Job, that will (probably) have your boss angry at you if it's not delivered on time... Also, the requirements that you gave us are too much broad: No multi-user weblog app with media files is only that. There will probably be comments (threaded?, how to deal spam?), image galleries, you will need HTML formatting while editing the posts, tags (?), categories, social-networking features (?), user registration, RSS/Atom, technoratti ping, templates per-user, plugins (?), send article via email, stuff like that. A full-wordpress clone in three weeks... I don't think it's a realistic goal. Unless you want something simpler. Talk to your boss and get *every* requirement for the project. If you don't need the fancy stuff (which I doubt, but I don't work there :p), try Django, otherwise, hack WP. On 7/14/06, Joe Murphy <[EMAIL PROTECTED]> wrote: > > Hi y'all, > > This week my boss sprang a new project on me: Build a community blog > app (multiple blogs and multiple users, also with photo- and video-type > content integrated and indexed). In three weeks. > > The original idea was to hack the Multi-User Wordpress to make this > work. I've done my time with PHP (5 years), so I figure I could hack > it. > > However, I'd much rather do it in Django. I've been messing around with > Django for about a month now, and it's real pretty. I'm no expert > though. > > Thought I would ask you all what your thoughts were on this -- hacking > an established application to get it to do what I want vs. building an > app from scratch, on a restricted timeline. > > Thanks, > Joe > > > > > -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Using an application more than once in a project
Sure. All Django/Python cares about is where the folder (module) is. Here's what I do sometimes: Create an app on my /home/ dir and symlink it inside the projects. So I am just re-using the same codebase on different projects, and getting the benefit of its changes/upgrades/development. On 7/7/06, Ahmad Alhashemi <[EMAIL PROTECTED]> wrote: > > Hi, > > Is it possible to use the same application more than once in the same > project? > > For example, if I download a ready made weblog application, can I use > it in one place as a general purpose weblog and in another place as a > seperate development weblog? > > TIA. > > --Ahmad > > > > > -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Django t-shirts: your ideas wanted!
You asked :) The green one from the flickr photo with this one liner in the back: ['hotclub' for name in frameworks if name is 'django'] Or this on the back: MVU (Just a play with the words. Controller is You, heh, heh? :p Okay...) Django: From Web 2.0 to Web Quintette Snakes on an OSCON Django: All the jazz and less typing too! (Okay, bad taste...) Django | Python: We indented jazz (some people say jazz' magic is the space between the notes, a definition that I love) On 6/27/06, Jacob Kaplan-Moss <[EMAIL PROTECTED]> wrote: > > Howdy folks -- > > I'm about to print up some Django shirts to take to OSCON next month > -- got any ideas? > > We gotta move pretty fast (we're going to try to get an order in to > the printer this week) so if you've got any hot ideas (or designs, > for that matter) send 'em to me! > > I'll mail anyone who gives an idea or a design one of the final > shirts, but otherwise please don't ask about "ordering" or otherwise > "getting" one. If there are any left after OSCON I'll make an > announcement then, but this are intended for OSCON promotions. > > For your reference, here's the one we did for PyCon: http:// > flickr.com/photos/uhop/104501907/. We'll reprint that one if we > don't get any better ideas. > > Let 'em rip! > > Jacob > > > > > -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: multiple templates on a single page
{% include 'file.html' %} http://www.djangoproject.com/documentation/templates/#include ? On 6/21/06, hubritic <[EMAIL PROTECTED]> wrote: > > I haven't seen this addressed in the documentation ... Say I want to > have a poll on how self-indulgent my blog post is. What I see in the > tutorial shows how to make use a poll template and how to use a blog > template, but I don't see how to use them both on the same page. > -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Slow initial startup on Django project
I had *many* problems with Django on Dreamhost the first two weeks that my systems ran there. Suddenly there are no more... I don't know what they did, what I did, or anything else. There's a page on the Dreamhost panel for you to vote on new features that they should add. Maybe +1 on an "official" Django support (like they have for RoR) would help. On 4/21/06, Clint Ecker <[EMAIL PROTECTED]> wrote: > Any ideas about what causes this "slow startup" phenomena? Is it just > inherent to fcgi or is there something wrong with how I'm doing business. > Thanks in advance! -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Overthinking urls.py?
I like the URLs at the model. Think in terms of URI (Uniform Resource Identifiers). The .get_absolute_url() tells how the model can be found. It's part of the "rules that give access" to data. On 3/27/06, Glenn Tenney <[EMAIL PROTECTED]> wrote: > Models are, in part, an abstraction of the data... the > scheme... etc. Models should have nothing to do with the URL for an > object! -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Overthinking urls.py?
What about mod_rewrite? And urls.py (afaik) can serve two different paths to the same view. On 3/27/06, Doug Van Horn <[EMAIL PROTECTED]> wrote: > > When drawing a link to that view in HTML from another app I would 'hard > code' that URL as, say, 'href="/foo/bar/99"'. -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Highlighting Search Results
I am doing it with template filters. There's a "highlight" function that I use like this: {{ var|highlight:keyword }} Where "keyword" is the search term. The function adds a around the word. On 3/27/06, bradford <[EMAIL PROTECTED]> wrote: > > A question came up in #django and I was wondering what the best > solution may be: how to highlight search results. > > Here are some possibilities: > 1. Add in around the returned results > for the searched words in the view. > 2. Template filter > 3. Template tags > > Please expand on any ideas. > > Thanks > > > > -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: FileField permissions
What kind of file? What I do (in PHP, but the principle is the same) is to pass the filename linked to a page: download.php?filename=something.ext And on download.php I get the file ID based on its name, check if the user has permissions to access it, and then send some headers to serve it for download or view (if it's an image). The files are uploaded to a directory not served by the web-server, and download.php fopen() it, fread() it and the headers take care of the rest. On 3/25/06, sam <[EMAIL PROTECTED]> wrote: > > I want to use FileField to upload files but I don't want the file URIs > directly visible to the user. Rather, I want to service the access to > the uploaded files via "views", so that I can exercise file access > permission (I implemented access permission myself, without using > django admin's). I think what this boils down to is to map a logical > URL such as myapp/ to a view that checks permission first > then retrieves the file from MEDIA_ROOT/. But how to do > that? Appreciate help! > > > > -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Form field
Some uses of disabled inputs are good. For example one with a default value and a checkbox next to it that when clicked allows you to edit the input content. Or a game where you must complete some task before a certain time-limit is reached and the input becomes uneditable. Or a html tutorial that shows what disabled="true" does. And perhaps even why you shouldn't use :) On 3/25/06, Don Arbow <[EMAIL PROTECTED]> wrote: > > The purpose of an input field is to accept input, if you want to > display uneditable text, you can just display it without using an > input field. To get any more advanced, you might be able to do > something with Javascript or CSS, but I would think that would be > confusing to a user who sees an input field that doesn't act like > other input fields. > > Don > > On Mar 25, 2006, at 7:08 AM, PythonistL wrote: > > > > > Is it possible to have a field in a form that a user can not edit? > > > > > -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: FileField not uploading
The first slash on file = meta.FileField (upload_to ="/myapps/uploads") is probably putting the file on drive C's root. Check if you have this directory: C:\myapps\uploads\ It bite me already :) Anyway this is what I have: settings.py: MEDIA_ROOT = 'C:/Python24/Lib/site-packages/project_name/templates/project_name/web/' MEDIA_URL = '/web/' And on my model: file = meta.FileField (upload_to ="files") So files are uploaded to here: C:/Python24/Lib/site-packages/project_name/templates/project_name/web/files/ When I use the development server, I have this on my urls.py: urlpatterns += patterns('', (r'^web/(?P.*)$', 'django.views.static.serve', {'document_root': 'C:/Python24/Lib/site-packages/project_name/templates/project_name/web/'}), ) And when I use Apache I have this on httpd.conf: SetHandler None On 3/21/06, layik <[EMAIL PROTECTED]> wrote: > > Hi all, > I am using: > > Windows xp > Django 0.91 > Django's own development server. > -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Error after python manage.py runserver
Is your project directory on your Python path? The easiest thing for me is to ln it to site-packages. On 3/21/06, Francisco Reyes <[EMAIL PROTECTED]> wrote: > ImportError at / > No module named opensourceadmin.urls > Request Method: GET > Request URL:http://127.0.0.1:8000/ > Exception Type: ImportError > Exception Value:No module named opensourceadmin.urls > Exception Location: > /usr/local/lib/python2.4/site-packages/django/core/urlresolvers.py in > _get_urlconf_module, line 87 > > In the settings.py I see a line: > ROOT_URLCONF = 'opensourceadmin.urls' > > Was I supposed to rename, copy or edit urls.py? -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: django pastebin
On 3/20/06, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > > hi, > dunno if it is possible, but could the default language in django > pastebin be set to python instead of php? > -- I get Python already selected when I access http://django.pastebin.com/ -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Joining foreign keys backwards?
On 3/18/06, Ned Batchelder <[EMAIL PROTECTED]> wrote: > > Or something like that, I'm backtranslating from my real app. Is there > a cleaner way? I think you can do this... Not very clean, but I just had lunch and I am feeling sleepy. poll_list = [] choice_list = choices.get_list(choice__exact = "overeasy", select_related = True) for choice in choice_list: poll_list.append(choice.get_poll()) The select_related = True argument will JOIN polls and choices avoiding a new database hit on every .get_poll() -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Advice on developing with django for a team of 10+
On 3/17/06, Jeremy Jones <[EMAIL PROTECTED]> wrote: > Actually, if you do ``svn export > http://path.to.svn.server/path/to/repository/`` > it'll strip out all the .svn cruft for you. I didn't know that Jeremy, tnx! -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Advice on developing with django for a team of 10+
Hey tone, Eric provided a good explanation of what's like working with svn. I would like to comment a little on point number 3. Having everything on svn helps us on deployment too. Most software management tips will tell you to compile your code daily. Because it gives the development team a clear goal and discourages them to commit bugged code. Here's what happens where I work: QA approves the 'build' (a svn revision), and a Python script that I made checkout this code, removes the .svn directories, encode it using Ioncube (it's PHP, remember :p) and uploads the file to the production server. It takes a minute from svn revision approved to real world server, and that's good. On 3/16/06, tonemcd <[EMAIL PROTECTED]> wrote: > > Hi Eric! ;) > > 3. that's a new one on us ;) (although Julios' comment on using pylint > is very interesting) > -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Advice on developing with django for a team of 10+
Option number three is the most common, and what we use here at work (even though it's PHP, the principle is the same). With one difference, the source code for each individual lies on the server. Here where I work, each user has a /home/ sub-directory on a server with Apache, PHP, Mysql and Subversion. The /home/ directories are shared using Samba. I used to use Linux, and now I use Windows, but the principle is the same. My "home" on the server appears on My Network Locations, I just open files there and edit them. Apache is setup to rewrite calls to http://ser.ver.ip/home/my_name/my_project/ to filesystem's /home/my_name/my_project/. So, when I edit a file on my /home/, I don't break anyone else's copy and I can see the changes by loading "/my_" URLs. From time to time, we commit things to a SVN repository. This is *crucial*. You mentioned that you don't have much experience with version control software, so it's a good chance to learn it :) Because with SVN, all I have to do is "svn update" (or use Tortoise, it's very good!) and get the changes done by anyone else. If you have, your QA team or testers can checkout a copy to test the latest developments. With Python and Django, nothing much changes from this process. You still can have Apache rewriting to shared directories. And maybe pylint running daily on the code... On 3/16/06, tonemcd <[EMAIL PROTECTED]> wrote: > > 3. People run their own local django installations, and commit changes > to a development server for testing before those changes are sent to > the deployment server. This means each individual user machine has to > have access to the databases and keeps a copy of the source on their > machine. It also means a lot of django trunk duplication on each > machine (I guess we could do an 'svn up' where the target is our own > django installation on the server - nice thought!). We have very little > experience of using svn etc however. -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: How to find out id of the first record?
Something like this perhaps... first_record = models.get_list(order_by = ['id'], limit = 1)[0] Maybe even .get_object() if it works with limit 1. On 3/8/06, Andy Shaw <[EMAIL PROTECTED]> wrote: > > As the ID field is auto-incremented, the earliest ('first') record will > be the one with the lowest ID. In python, you can determine this by > pulling all records from the database and finding the one with the > lowest ID, or you can write a custom SQL query to do the same thing. I > don't know if Django currently has a built-in feature to let you do > this, though it is possible that the database will return the records in > creation order anyway (someone correct me here). > > -Andy -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Attn. Dreamhost users
What I use sometimes on Dreamhost is this: pkill python;pkill fcgi.py "pkill python" refreshes the process', so I can hit reload on the browser and see the changed code. While "pkill fcgi.py" make the "Mysql server has gone away" problems disappear. Dreamhost hasn't been good to me. I will be switching hosts soon... can't have such unreliable apps live. On 3/7/06, PythonistL <[EMAIL PROTECTED]> wrote: > > Eugine, > I also use Dreamhost( and it works great) but have a problem how to > kill the correct process. > When I try "killall python" or "killall python2.4" I receive "no > process killed". > Why? > When I use ps ax to see the process number, I can see a lot of > /usr/bin/python django.fcgi and I do not know what is the right process > to be killed.Any idea? > > Thank you for help > Regards, > L. > > > > -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: MySQL + FastCGI + Dreamhost = Trouble with foreign key in admin
Can you paste the query here? I think the problem is an unsupported feature by Mysql... Do you have another Mysql install to test? On 3/2/06, Colleen Owens <[EMAIL PROTECTED]> wrote: > > I forgot to say this is with current Django trunk. > > -- Forwarded message -- > From: Colleen Owens > Date: Thu, 02 Mar 2006 03:34:08 - > Subject: MySQL + FastCGI + Dreamhost = Trouble with foreign key in > admin > To: "Django users" <django-users@googlegroups.com> > > I'm getting an error when I try to modify a foreign key edited inline > in the admin interface using MySQL + FastCGI on a Dreamhost account. I > get the same type of error when I try to modify a Poll object (with > inline Choices) from the tutorial, so I know it's not my model that's > the problem. > > I've tried this with sqlite3 running on my local machine and I have no > problem with editing these models. I see from the chat logs that > someone else was having this problem a week or two ago, but he didn't > seem to figure it out (he switched to postgres and said that everything > worked fine). Unfortunately mysql is the easiest option on Dreamhost. > > OperationalError at /admin/polls/polls/add/ > (1093, "You can't specify target table 'polls_choices' for update in > FROM clause") > Request Method: POST > Request URL:http:///admin/polls/polls/add/ > Exception Type: OperationalError > Exception Value:(1093, "You can't specify target table > 'polls_choices' for update in FROM clause") > Exception Location: > /home/coowwa/local/lib/python2.4/site-packages/MySQLdb/connections.py > in defaulterrorhandler, line 32 > > > > -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: admin-logout + opera8.52?
When I click "logout" I get a blank screen but I am logged out, because if I try to access an admin url the login form appears. Opera 8.5, Windows XP. On 2/21/06, gabor <[EMAIL PROTECTED]> wrote: > > hi, > > is there anyone using opera8? > > because for me it seems that i am unable to log out using opera8.* from > the admin interface. > > so before i start digging deeper...does anyone else has this problem? > > thanks, > gabor > > > -- Julio Nobrega - http://www.inerciasensorial.com.br --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Templating Pitfalls?
With "child page should not have to get those events" you mean not passing the events list as a variable to render_to_response() on each view? Well, I am using template tags. These are objects/functions/variables available globally on your templates. It's actually what I use to generate items for a navigation menu, which is data pulled from a database and displayed on every page: {% load templatetag_file %} {% function_from_templatetag %} {% for item in return_from_function_above %} {{ item }} {% endfor %} The template tag can also return HTML code, something you might want to consider giving the requirement (a calendar). On 2/15/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > I was wondering, in response to more complex templating setups. If as a > user, you wanted to subclass a parent template, but the parent template > needs to dynamically generate content given a data source. An example > could be a calendar of events that you want displayed on every page. > The child page should not have to get those events and pass it to the > renderer. Is there some convention that Django follows, and if not, > what seems to be the most practical way for people who have dealt with > this? > > -- Julio Nobrega - http://www.inerciasensorial.com.br
Re: recursive template calls
You don't *need* recursion on templates for threaded messages like your example app, that's exactly the point :) On 2/8/06, Shannon -jj Behrens <[EMAIL PROTECTED]> wrote: > > Sorry, guys, I'm confused. I *did* search before posting, but wasn't > able to find a full answer. I saw someone doing the bulletin board > example, but I never found out how to recursively call a template. > Must I use the non Django {% recurse %} custom tag? > > Thanks, > -jj > > On 2/8/06, Max Battcher <[EMAIL PROTECTED]> wrote: > > > > Jamie Scheinblum wrote: > > > that's funny. they answered how to do the tree thing, but the wiki > > > basically says no recursion... I should look into the % recurse % > > > keyword tho. > > > > The {% recurse %} is a custom tag from the Custard work at Greenpeace, > > not a Django-contributed tag. It is Open Source under the LGPL. > > > > -- > > --Max Battcher-- > > http://www.worldmaker.net/ > > > -- Julio Nobrega - http://www.inerciasensorial.com.br
Re: Tree View
's are possible, it's in fact what I use on my (to-be) site: {% for node in node_tree %} {{ node.body }} {% endfor %} Screenshot of (a more styleshed) output here: http://static.flickr.com/42/95381035_a51eb622dc_o.png On 2/4/06, Max Battcher <[EMAIL PROTECTED]> wrote: > > akaihola wrote: > > See these cookbook recipes for ideas: > > http://code.djangoproject.com/wiki/CookBookCategoryDataModel > > I was using this already. > > > http://code.djangoproject.com/wiki/ModifiedPreorderTreeTraversal > > Thanks. That's a start. I was hoping for something a bit wiser and > more generic, though... something to produce nice semantic XHTML > (s). I'll ponder on this subject a bit more later. > > -- > --Max Battcher-- > http://www.worldmaker.net/ > -- Julio Nobrega - http://www.inerciasensorial.com.br
Modified Preorder Tree Traversal on the Wiki
I added an article at the Wiki about Modified Preorder Tree Traversal, a way to store parent/children relationship. I don't know how good my english is (I am from Brazil, and speak portuguese), and I extracted the code from an app I am doing. Could someone "proof-read" it please, and if any errors are found, please let me know? Many thanks, -- Julio Nobrega - http://www.inerciasensorial.com.br
Re: Question About Multi Column Keys
Something like this for your models: class User(meta.Model): name = meta.CharField() class Website(meta.Model): url = meta.CharField() class Tag(meta.Model): name = meta.CharField() class Tagged(meta.Model): user = meta.ForeignKey(User) site = meta.ForeignKey(Site) tag = meta.ForeignKey(Tag) And that's it... now some magic: - All tag names for http://www.google.com tagged_list = taggeds.get_list(site__url__exact = 'http://www.google.com') for tag in tagged_list: print tag.name - All tags for user 'inerte' on http://www.google.com: tagged_list = taggeds.get_list(site__url__exact = 'http://www.google.com', user__name__exact = 'inerte') - All users that tagged http://www.google.com with 'search': tagged_list = taggeds.get_list(site__url__exact = 'http://www.google.com', tag__name__exact = 'search') You get the idea :) The 'id' column is implicit here: It exists, but we didn't had to specify. A "Website" object will have the "id" and "url" parameters, and it doesn't matter much what you will use for __exact, as long as they are unique, I guess... What's a highly normalized database and why did you get the impression that isn't Django focus? If you pass the 'selected_related = True' parameter to get_list() you will see some really complicated queries being built to aggregate all the possible data, avoiding many re-queries (which I probably should have done on the first get_list() example). Btw, you should really stop thinking about the database design before writing your models with Django. Code how your data is structured, its relationships, let Django figure out how to select them, and only fix if it brakes. On 1/31/06, kggroups <[EMAIL PROTECTED]> wrote: > > I could also foresee situations where I would use a key on 3-tuples, > etc. How well is django equipped to handle relationships like this? > > -- Julio Nobrega - http://www.inerciasensorial.com.br
Re: possible to validate a subset of a model's fields?
You could pickle (as in, serialize) the data and save on the database. Then just unpickle when you need to view it. On 1/30/06, Oliver Rutherfurd <[EMAIL PROTECTED]> wrote: > Thanks for the suggestion, but saving to the db after every page is a > requirement of the app. If someone fills out a page and comes back a > week, or even a year later, everything they previously entered should > be in the db. -- Julio Nobrega - http://www.inerciasensorial.com.br
Re: utf-8 characters in database fileds(names)
Maybe, MySQL has a default character set, which your databases and table are created with.You can change with this command: ALTER DATABASE `db_name` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci On 1/28/06, cayco <[EMAIL PROTECTED]> wrote: > > I did not. > > I used only: mysqladmin create dbname > > Could that be the problem? > > -- Julio Nobrega - http://www.inerciasensorial.com.br
Re: urls question
On 1/18/06, Huy Do <[EMAIL PROTECTED]> wrote: > > Sorry for the non django related question. I figured it out already. > > For anyone whos interested in cleaning up your generic views code, just > use, (note the star) > > urlpatterns = patterns('', >*generic_crud(MyModel) > ) > regards, > > Huy > Huy Do wrote: > > > > > Should it be possible for me to do the following in my urls.py > > > > from django.conf.urls.defaults import * > > from myproject.myapp.models import MyModel > > > > def generic_crud(model): > >return generic_list(model), generic_create(model), > > generic_update(model), > > > > def generic_list(model): > >info_dict = { 'model': model, } > >return (r'^%s/$' % model.__name__.lower(), > > 'django.views.generic.list_detail.object_list', info_dict) > > #return (r'^%s/$' % model.__name__.lower(), > > 'django.views.generic.list_detail.object_list', info_dict) > > > > def generic_create(model): > >info_dict = { 'model': model, } > >return (r'^%s/$' % model.__name__.lower(), > > 'django.views.generic.create_update.create_object', info_dict) > > #return (r'^%s/$' % model.__name__.lower(), > > 'django.views.generic.create_update.create_object', info_dict) > > > > def generic_update(model): > >info_dict = { 'model': model, } > >return (r'^%s/(?P\d+)/$' % model.__name__.lower(), > > 'django.views.generic.create_update.update_object', info_dict) > > #return (r'^%s/$' % model.__name__.lower(), > > 'django.views.generic.create_update.create_object', info_dict) > > urlpatterns = patterns('', > >generic_crud(MyModel) > > ) > > > > I get a > > > > Exception Type: TypeError > > Exception Value: dict objects are unhashable > > Exception Location: c:\usr_local\python24\lib\sre.py in _compile, > > line 215 > > > > > > > > However, > > > > if I did > > urlpatterns = patterns('', > >generic_list(MyModel), generic_create(MyModel), > > generic_update(MyModel), > > ) > > > > it works. Any ideas ? > > > > Thanks > > > > > > Huy > > >
Re: Preserving data through db updates/changes
Just dump the data into a file and reload it after re-creating the tables. At most, you will have to edit a few SQL fields/values to comply with the new column/table names. Doing it automated is *really* hard and I don't think it will be better (or more accurate) than just re-inserting the data via some db command. On 1/18/06, Luke Skibinski Holt <[EMAIL PROTECTED]> wrote: > > How probable would it be to implement a means of updating a database > schema when only minor changes occur? > > 'minor' has to be defined, but the removal of columns or entire models > could also be considered depending on their impact to the rest of the > app/project. With no regard for the actual data, models with no > relations could easily be dropped or have fields added/removed without > a sqlreset and then a clumsy find/replace on the data dump to reinsert > it back. > > I'm just looking for a quick way to update my models in the development > stage while keeping test data. Django is great for prototyping, and > despite my best laid plans (and usecases), things change and grow as I > discover new ways of doing them (as they rightfully should in a > prototype). > > Are there any such plans in the works? > > > Luke Skibinski Holt > >
Re: making slug field unique
Afaik Django enforces uniqueness at the application level, but you could always add it to the database: ALTER TABLE table ADD UNIQUE (slug) I don't think it's a bad idea at all, it all depends ;) On 1/16/06, Bryan Murdock <[EMAIL PROTECTED]> wrote: > > I think I want my model's SlugField to be unique (let me know if this > is a Bad Idea for any reason). So I edit my model and change > slug=meta.SlugField() to slug=meta.SlugField(unique=True). Do I need > to do anything to update the database now? > > Thanks, > > Bryan >