Re: uploaidng media files ( such as mp3, images ) tutorial/how-to?

2009-07-11 Thread Daniel Roseman
On Jul 11, 9:11 am, djangonoob wrote: > Hi all, > may i know how do i upload media files such as mp3 files, images using > djanog? > > I understand that there is a documentation on file uploads at > :http://docs.djangoproject.com/en/dev/topics/http/file-uploads/ > > However, i do not quite under

Re: Customised admin saving

2009-07-11 Thread Daniel Roseman
On Jul 11, 11:37 am, "Daniele Procida" wrote: > I have a many-to-many relationship between two models, People and > Entities (enities are departments and offices etc). > > Some of these relationships are managed by the user in admin, but others > are implicit. > > For example, if the user adds Jo

Re: Object attributes in change_form.html

2009-07-13 Thread Daniel Roseman
On Jul 13, 4:02 pm, janedenone wrote: > Hi, > > I read the documentation on customizing admin templates, but I still > wonder how to access the object attributes in the change_form.html. I > am capable of getting the id using {{ object_id }}: > > {% if change %}{% if not is_popup %} >   >     c

Re: AttributeError when trying to save and access models

2009-07-14 Thread Daniel Roseman
On Jul 14, 8:09 am, Sam Walters wrote: > Hi Django world > I keep getting problems accessing and storing data in foreignkey and > one-to-one relationships. > Error is basically of the form: >  "AttributeError > Exception Value: 'DirectoryAdmin' object has no attribute 'abbrev'" > > The models.py

Re: AttributeError when trying to save and access models

2009-07-14 Thread Daniel Roseman
Sorry, to answer your second question: On Jul 14, 10:56 am, Daniel Roseman wrote: > On Jul 14, 8:09 am, Sam Walters wrote: > > And if i try to see an attribute in another table: > > >  var = dirdir.admin.abbrev #error: 'DirectoryAdmin' object has no attribute >

Re: .views._CheckLogin.__call__ didn't return an HttpResponse object

2009-07-14 Thread Daniel Roseman
Please don't snip the context. On Jul 14, 11:24 am, alecs wrote: > I'm just calling another view mail_to_user(request,username,dummy) , > which contains render_to_response! OK, think what happens when you return from that view: you go back to the calling view. Does that return anything? -- DR.

Re: newbie question information about js

2009-07-15 Thread Daniel Roseman
On Jul 15, 9:14 am, luca72 wrote: > Hello and thanks for your help. > I think that i need context, i attach my test file: > > from django.shortcuts import render_to_response > from off_bert.offerte.forms import RichiestaForm > from django.http import HttpResponseRedirect > > def richiesta(request

Re: DateTime Format & Spacing

2009-07-15 Thread Daniel Roseman
On Jul 15, 10:27 am, veasna bunhor wrote: > Dear All, > > I have spent 2 hours to search about how to use Datime Format and Comment > Spacing in Django, but i still found it . Does anybody know how to do this ? > Could you please tell me about that? > > Best regards, > > Veasna http://docs.djang

Re: New to unit testing, need advice

2009-07-16 Thread Daniel Roseman
On Jul 16, 1:20 am, Joshua Russo wrote: > I'm in the process of implementing testing (both doc tests and unit > tests) though I'm having some conceptual difficulty. I'm not sure how > far to take the testing. I'm curious what people concider an > appropriate level of testing. > > This thought str

Re: Django, MySQL - bug?

2009-07-19 Thread Daniel Roseman
On Jul 18, 10:39 pm, Tomasz Zieliński wrote: > I prepared following repro case, just paste to models.py to an empty > project: > > --- > from MySQLdb import Warning as Warning > from django.db import models > import unittest > > class TestMo

Re: ForeignKey model attribute value in save() method

2009-07-19 Thread Daniel Roseman
On Jul 17, 4:08 pm, onoxo wrote: > how can i access ForeignKey model attribute value in save() or > __unicode__ method? > some hint will help. > > here is my model.py: > > class PhotoSetPhotoItem(models.Model): >     photo_item = models.ForeignKey('Photo', related_name='photoitem') >     slug = m

Re: weird ValueError

2009-07-20 Thread Daniel Roseman
On Jul 20, 11:13 am, Viktor wrote: > my view calls > > survey = get_object_or_404(models.Survey, {'pk': int(survey_id)}) > > and gives a ValueError: need more than 1 value to unpack, the full > traceback is athttp://python.pastebin.com/m3f715909 > > I have no clue what the problem might be, espec

Re: Using Django's Cache

2009-07-20 Thread Daniel Roseman
On Jul 20, 5:49 pm, WilsonOfCanada wrote: > Well then I will have to try a different approach.  When using > render_to_response('webpage.html', d), I have d as a dictionary.  I > was wondering if you send a whole text file as a part of the > dictionary. > > For example: > > fileView = open('C://p

Re: Windows development server problem

2009-07-21 Thread Daniel Roseman
On Jul 21, 12:13 am, cwurld wrote: > Hi, > > I have a snippet of code that runs fine as a standalone program. But > when I incorporate it into a view and access that view w the > development server, the snippet no longer works. > > What is the difference between the python interpreter and the > d

Re: Django site on Apache

2009-07-21 Thread Daniel Roseman
On Jul 21, 12:16 pm, Kannan wrote: > Hi friends... >              I have downloaded the source of > thehttp://in.pycon.org/2009/fromherehttp://bitbucket.org/lawgon/fossconf/downloads/. > I try to run the site in my Apache server. > So i copy the extracted file to my /var/www/ directory named fos

Re: UnicodeEncodeError on admin site

2009-07-21 Thread Daniel Roseman
On Jul 21, 1:27 pm, Rodrigo Gomes wrote: > Hi, > > I'm getting the error below when i'm trying to edit a non ascii value on the > admin site. > I tried to put # -*- coding: utf-8 -*- on my model file, tried to set > settings.FILE_CHARSET to 'utf-8' and I tried to put > on the > admin page "chang

Re: Foreign Keys

2009-07-21 Thread Daniel Roseman
On Jul 21, 4:25 pm, AKK wrote: > Thanks, i tried this: > > blog_posts = Post.objects.filter(post_slug=slug) > blog_comments = blog_posts.comment_set.all() > > but i got this error and i don't know why: > > Traceback: > File "C:\ProgLangs\Python25\lib\site-packages\django\core\handlers > \base.py"

Re: UnicodeEncodeError on admin site

2009-07-21 Thread Daniel Roseman
On Jul 21, 3:46 pm, Rodrigo Gomes wrote: > Hi Daniel, > > My databse enconding (Mysql) is utf-8, as you can see below: > > Server characterset:    latin1 > Db     characterset:    utf8 > Client characterset:    latin1 > Conn.  characterset:    latin1 But what about your actual tables? When you d

Re: Don't understand ModelForm

2009-07-21 Thread Daniel Roseman
On Jul 21, 9:34 pm, mettwoch wrote: > I'd like this to work: > > class PartnerForm(forms.ModelForm): >     class Meta: >         model  = Partner  # I expect that all fields are included in > the form (the 'id' field as well) > > def partner_new(request): >     form = PartnerForm() >     return r

Re: Using Model Object Data in views.py

2009-07-22 Thread Daniel Roseman
On Jul 22, 8:54 pm, rpupkin77 wrote: > Hi, > > this is probably a  really basic question, but i can't find the answer > anywhere. > > I need to get data from a model and use it in the view (views.py), > before I pass it to the template. However, the result I get back (when > i examine the local v

Re: Generating images.

2009-07-23 Thread Daniel Roseman
On Jul 23, 10:09 am, Goldy wrote: > Hi, > > I can generate a specific image using the following from the Django > book. > > --- > --- > from django.http import HttpResponse > > def my_image(request): >     image_

Re: Extending AdminSite

2009-07-23 Thread Daniel Roseman
On Jul 23, 9:17 pm, James wrote: > Based some tutorials and code examples, I'm attempting to modify my > admin page by adding "admin.py" in my project directory. However, the > changes don't seem to make a lick of difference. > > This (http://www.webmonkey.com/tutorial/ > Install_Django_and_Build

Re: Admin Customisations

2009-07-24 Thread Daniel Roseman
On Jul 24, 8:27 am, StevenC wrote: > Hey, > > Im new to Django and have create an online application system. > > I need to know is it possible to customise the List Display and have a > customn link next to EVERY entry which points to a nother URL with its > ID within. > > For example, > > If i h

Re: cross-referencing design question

2009-07-24 Thread Daniel Roseman
On Jul 24, 5:46 am, Mike Dewhirst wrote: > I'm new to Django and want to express a self-referencing design > feature to link clients in the same table with each other. Django is > currently objecting to this. Could you please point me to > documentation which will let me figure it out? > > This i

Re: A confusing traceback.

2009-07-24 Thread Daniel Roseman
On Jul 24, 3:13 pm, cornjuliox wrote: > File "C:\Blog2\..\Blog2\Engine2\models.py" in save >   48.         super(Entry).save() > > Exception Type: AttributeError at /admin_add/ > Exception Value: 'super' object has no attribute 'save' > > Am I not supposed to be using 'super' here? The signatur

Re: Middleware that injects data for template

2009-07-25 Thread Daniel Roseman
On Jul 24, 8:24 pm, Stodge wrote: > Say I want to inject a piece of data into every page view. For now, > let's just say I want to inject the current time into each page view. > I write a piece of middleware that will do it. But how? Do I modify > the request? Or the view (process_view)? The bes

Re: Invalid command 'WSGIDaemonProcess'

2009-07-25 Thread Daniel Roseman
On Jul 25, 2:11 pm, Jose Sibande wrote: > I just uploaded my application to my server and this is the error that > I am getting when I try to restart apache: > Restarting web server: apache2Syntax error on line 6 of /etc/apache2/ > httpd.conf: > Invalid command 'WSGIDaemonProcess', perhaps misspe

Re: Where are the admin app icons from?

2009-07-25 Thread Daniel Roseman
On Jul 25, 6:46 pm, Margie wrote: > Thanks Alex - I will check those out.  But if anyone knows where the > admin icons came from, I'd still love to know ... > > Margie I suspect that they were designed for Django - probably by Wilson Miner, the guy who designed the look and feel of the admin int

Re: issue with simple image ordering view

2009-07-26 Thread Daniel Roseman
On Jul 26, 6:13 am, django user wrote: > I have a basic form with that shows user's uploaded images: > > > >     {% for photo in photos %} >     class="handle2" width="150" height="90" alt="test"> >         Order: label> value="{{ photo.position }}" name="image" /> > >     {% endfor %} > >  

Re: issue with simple image ordering view

2009-07-26 Thread Daniel Roseman
On Jul 26, 9:56 am, django user wrote: > How would I make a formset for exactly the # of images I have in a > queryset? Just pass the queryset into the formset instantiation, as described on the page I referenced: >>> from django.forms.models import modelformset_factory >>> AuthorFormSet = mode

Re: User.objects.create_user

2009-07-26 Thread Daniel Roseman
On Jul 26, 12:46 pm, ramanathan wrote: > I stored the username, password, email id  fields in auth_user table > using > > User.objects.create_user(username,email,password) > > But i was not able to store the first_name field.. > > I tried User.objects.create_user > (username,first_name=firstname,

Re: Editing model based forms.

2009-07-27 Thread Daniel Roseman
On Jul 27, 12:15 am, AKK wrote: > Hi, I have a form based on a model which allows users to add comment. > A comment is made up of the comment is about, the body, the date and > time and also who made the comment. > > I am mainly interested in the datetime and user fields. What i would > like to k

Re: Cross Table Query. List Books based on Author.

2009-07-27 Thread Daniel Roseman
On Jul 27, 4:13 pm, The Danny Bos wrote: > Heya, > > I'm currently displaying an 'Article' on a page, using the below. My > tables are Article, People, Book. I'm in the 'Article' table, trying > to get a list of 'Books' based on the person "selected" in Articles, > that person needs to be the Aut

Re: permalink don't works

2009-07-28 Thread Daniel Roseman
On Jul 28, 12:18 pm, gentlestone wrote: > Hello, > > I've got this exception > > Reverse for 'view' with arguments '('13',)' and keyword arguments '{}' > not found. > > This is my code: > > from django.db.models import per

Re: Value error......

2009-07-28 Thread Daniel Roseman
On Jul 28, 7:27 pm, ashish tiwari wrote: > I see the value error when I run the > > http://127.0.0.1:8000/People/Info/5 > > it shows me the error which is in the figure……attached with this folder….. > > here is the codes….of  “urls.py,views.py,models.py…….. > > > ## > > #vi

Re: "For object in object_list: related_list="...

2009-07-29 Thread Daniel Roseman
On Jul 29, 5:18 am, bweiss wrote: > I've got this to work in python shell mode, but am having trouble > translating it into a django view, and am hoping someone can point out > where I'm stuffing up. > > For background, I'm working with a database with two models: > "Employees" and "Projects", jo

Re: ANN: Django 1.1 released!

2009-07-29 Thread Daniel Roseman
On Jul 29, 7:23 am, James Bennett wrote: > Tonight we're extremely proud to announce the release of Django 1.1, > the latest major milestone in Django's development. > > To learn about the new release: > > * Blog post:http://www.djangoproject.com/weblog/2009/jul/29/1-point-1/ > * Release notes:ht

Re: No such Table Error

2009-07-29 Thread Daniel Roseman
On Jul 29, 3:54 am, marcoshernandez wrote: > Im having this error in my application (both admin models and my app > models) I'm almost certain that has to be something with Apache- > mod_wsgi not finding the files... but I just can't find the origin of > the error... > Exception Type: Operationa

Re: Where is the "Else if"... ?

2009-07-29 Thread Daniel Roseman
On Jul 29, 4:54 pm, Asinox wrote: > Hi guy, im looking for the simpley  if ...else if but i cant see > in the django documentation > > Thanks :) You need to be slightly less concise in your question. Do you mean in the template language? If so, it doesn't have one, by design. You can ne

Re: Submitting a form

2009-07-29 Thread Daniel Roseman
On Jul 29, 9:17 pm, When ideas fail wrote: > I've created a model form and I was wondering what the correct way to > save this was. I've tried adapting the view from the standard django > forms docs but maybe it should be different? > > This is what i have in my view (it says contact form but its

Re:

2009-07-29 Thread Daniel Roseman
On Jul 29, 10:01 pm, Margie wrote: > Currently each of my autocomplete fields ends up rendering with this > long script containing the contents of that html snippet (but longer > since there are a bunch of other arguments).  Is there a way for me to > use the model that you're describing for thi

Re: Comment Detail URI

2009-07-30 Thread Daniel Roseman
On Jul 30, 4:29 pm, grElement wrote: > I guess what I'm really looking for is someone who has an example of a > reverse() lookup for generic relationships like the ones created in > the django comments, just to be clear. > > Maybe this is just one of those instances where I need to write the > qu

Re: introspecting templates

2009-07-30 Thread Daniel Roseman
On Jul 30, 2:25 pm, perrin wrote: > Hi, > > I'd like to determine what data a template uses, in order to optimize > my database access for some large queries.  The idea is to fetch as > much as possible in a single query up front.  Is there any API for > looking at the tags used in a template?  I

Re:

2009-07-30 Thread Daniel Roseman
On Jul 30, 7:41 pm, Margie wrote: > Hi Vasil, > > Could you clarify how I access the variable from the javascript?  For > example, using my DateWidget as an example, say in my wdigets.py I > have this (note I've added ?myVar='xyz' in second line: > > class DateWidget(widgets.DateInput): >     cla

Re: Finding a Django expert to review my code

2009-07-31 Thread Daniel Roseman
On Jul 31, 7:21 am, Rex wrote: > I just created my first Django site (as an academic research project). > Now that it is done, I would like to get feedback on my code from a > Django expert so that I can learn where I can improve as a Django dev. > How can I find someone to spend 1 or 2 hours rev

Re: Admin Customisations

2009-07-31 Thread Daniel Roseman
2009/7/31 Steven Church : > Daniel, > > Thank you for replying. I have finally found time now to start working on > this project again. I have the following. > > def viewlink(self, obj): > return 'View & Print' > viewlink.allow_tags = True > > and i have put the "viewlink" within t

Re: i need custom database behaviour, but i dont know how to do it

2009-07-31 Thread Daniel Roseman
On Jul 31, 11:25 am, Mirat Bayrak wrote: > I am working on a *Categories* application for my project. The model that i > need to categorize ise *Announces*.. i descibed category in announces like > this > > class Category >     ... >     ... >     path = models.CharField > > class Announce:

Re: encoding problem

2009-07-31 Thread Daniel Roseman
On Jul 31, 11:55 am, alecs wrote: > I'm sending a file to user: > > upfile = UpFile.objects.get(file_hash=request.path[6:]) >         user = get_object_or_404(User, username=request.user.username) >         down_file_log = DownFile.objects.create(user_id=user, > file_id=upfile) >         wrapper

Re: i need custom database behaviour, but i dont know how to do it

2009-07-31 Thread Daniel Roseman
On Jul 31, 12:45 pm, Mirat Bayrak wrote: > > Do you mean you want the foreign key value to be the 'path' field of > > the Category model? You could do this, but why would you want to? If > > you ever want to refer to the category path from an Announce instance, > > you just do: > >   announce.cat

Re: annotations only in 1.1 ?

2009-07-31 Thread Daniel Roseman
On Jul 31, 12:54 pm, gentlestone wrote: > I want find all instances of model KeyWord, where ManyToMany field > categories is empty. I think in versieon 1.1 is the appropriate code > like this: > > ... KeyWord.objects.annotate(cnt = Count(categories)).filter(cnt = > 0) ... > > What is the similar

Re: Template Architecture: how to render template using several apps?

2009-08-02 Thread Daniel Roseman
On Aug 2, 7:35 am, aleph wrote: > Hi! > > My questions is about "the right way to do it" in Django: I have a > simple message board with two columns: news on the left, the board > itself (input form and messages list) on the right. In fact, this are > two different applications presented in one p

Re: Django on Hostmonster shared hosting

2009-08-02 Thread Daniel Roseman
On Aug 2, 8:10 pm, Tim wrote: > Hello > > I have been trying to get Django working with Hostmonster.com shared > webhosting with FCGI. > > From what I gather from the HM forums, this is possible, but I've been > hitting some issues. > > I've installed Python 2.6.2 in my home directory, and by all

Re: Retrieving the values from query set

2009-08-02 Thread Daniel Roseman
On Aug 3, 7:03 am, Subramanyam Vemu wrote: > Hi Malcom > > The values_list() returns a list of tuples whereas I am looking for a simple > list of the values > >From the link Malcolm so helpfully provided: "If you only pass in a single field, you can also pass in the `flat` parameter. If True, th

Re: how to modified filefiled after created it

2009-08-03 Thread Daniel Roseman
On Aug 3, 1:29 pm, Shuge Lee wrote: > NO > > just image add new seed in admin > > upload a file with status "UNAPPROVE" > then you change its status as "ACCET" > the problem is, the file you upload is still point to UNAPPROVE_PATH > > how to make it point to ACCEPT_PATH ? You can set the path va

Re: why is not IntegrityError an attribute of models?

2009-08-03 Thread Daniel Roseman
On Aug 3, 3:08 pm, dnedbaylo wrote: > Hey All, > > I have a model with unique field. Here is what i get when i try to > save record with not-unique field value: > > >>> from psdj.ksel import models > >>> try: > > ...   m = models.Keyword(phrase='insurance') > ...   m.save() > ... except models.Ke

Re: A custom ordering SQL and Django models

2009-08-04 Thread Daniel Roseman
On Aug 4, 8:28 am, Daybreaker wrote: > I want to run a query like this: > > select * from bbs_article a, bbs_article_tags a2, bbs_tag t where t.id > = a2.tag_id and a.id = a2.article_id order by (case when t.name = > 'notice' then '' else t.name end) > > which has a custom ordering rule. > > As f

Re: Django on Hostmonster shared hosting

2009-08-04 Thread Daniel Roseman
On Aug 3, 10:17 pm, uxp wrote: > On Aug 2, 4:21 pm, Daniel Roseman wrote: > > Maybe a silly question, but you keep talking about > > 'myproject.settings' - do you mean this is what you've called the > > file? That won't work at all. The settings should

Re: 'RelatedManager' object is not iterable

2009-08-04 Thread Daniel Roseman
On Aug 4, 8:15 pm, "british.assassin" wrote: > > {% extends "base.html" %} > > {% block title %}EvoWebs{% endblock %} > > {% block body %} > {% if categories %} > {% for category in categories %} > > {{category.name}} > {% for forum in category.forums %} > {{forum.name}} > {% endfor %} > > {% e

Re: model upload_to

2009-08-04 Thread Daniel Roseman
On Aug 4, 8:53 pm, caliman wrote: > Hi! > > I'm trying to change upload_to dynamically. > > My model: > class File(models.Model): >     type = models.CharField(max_length=10) >     the_file = models.FileField(upload_to="folder") > def __unicode__(self): >         return self.file.name > > Tried f

Re: Simple Ajax Page

2009-08-05 Thread Daniel Roseman
On Aug 5, 8:51 am, matt barto wrote: > Hello, > > I am attempting my first ajax page to no avail.  My goal is to have a > form with a text box and upon submission I will append all the text to > the html.  Here is the javascript leveraging jquery. > >  $(document).ready(function() { >     $('#sub

Re: Validation

2009-08-05 Thread Daniel Roseman
On Aug 5, 11:03 am, StevenC wrote: > Hey all!! > > I have had some validation working but it seems to have stopped. I > want the date format on my form to validate as DD-MM- so i have > done the following within the view: > > DOB = forms.DateField(('%d/%m/%Y',),'Date Of Birth',help_text="Plea

Re: No data in template available

2009-08-05 Thread Daniel Roseman
On Aug 5, 1:44 pm, Frulli58 wrote: > Hi together, > till now we worked with PHP. For a new database I desided to try > python and django. > I´m trying to find the right way and now I have a problem, that I can > ´t get data within a template. > My view: > from Django_Demo.news.models import D300,

Re: Select Table or Database based on User

2009-08-05 Thread Daniel Roseman
On Aug 5, 11:38 pm, Wojciech Gryc wrote: > Thanks for your replies! > > The problem with storing the user ID for each table and then filtering > by the ID is that once the data set grows very large, this will become > extremely slow (as far as I understand). > > I expected to have about 2000 piec

Re: Get current user outside a view / without an request object

2009-08-05 Thread Daniel Roseman
On Aug 6, 2:24 am, Julián C. Pérez wrote: > Hi everyone > I'm in trouble because of a form class > I have a form class with attributes defined, but with one thing: > One of the attributes requires the current user, or al least its > username > > The form definition in as shown below: > --- > clas

Re: Get current user outside a view / without an request object

2009-08-06 Thread Daniel Roseman
On Aug 6, 9:14 am, krylatij wrote: > You can also use threadlocals middleware (ask google about it =)) > to get current user without request object No, really, don't. Just don't. -- DR. --~--~-~--~~~---~--~~ You received this message because you are subscribed to

Re: HttpResponseRedirect with POST

2009-08-06 Thread Daniel Roseman
On Aug 6, 1:09 pm, Sławek Tuleja wrote: > HI everyone! > > Can I redirect to view with form passing few variables in POST method > (request.POST) and showing them in the form? (i need this in admin > action) > > for example this works: > def add_mailing(self, request, queryset): >         return

Re: syncdb does not find app on the PYTHONPATH

2009-08-06 Thread Daniel Roseman
On Aug 6, 1:32 pm, Matthew wrote: > $ ~/dev/source/cms: pwd > /home/matthew/dev/source/cms > $ ~/dev/source/cms: python > Python 2.6.2 (release26-maint, Apr 19 2009, 01:58:18) > [GCC 4.3.3] on linux2 > Type "help", "copyright", "credits" or "license" for more information.>>> > import coltrane >

Re: Get current user outside a view / without an request object

2009-08-06 Thread Daniel Roseman
On Aug 6, 3:34 pm, Julián C. Pérez wrote: > Hi > I tried doing that... > But it does not work > For example, if I do something like... > --- > class SendMessageForm(forms.Form): >         recipientUser = ShowValidContactList(label=u'Send to') >         messageSubject= forms.CharField(label=u'Subj

Re: Im lost with Save function in model and saving data from Form

2009-08-06 Thread Daniel Roseman
On Aug 6, 6:38 pm, Asinox wrote: > Hi guys, i need a litter help, i know that if i want a Form from Model > i need to use ModelForm, but im lost with something... i have a view > that render a Form (ModelFrom) and save this, but now i need to use > the  funcion SAVE in the  Model (for use in the

Re: How much DB queries is too much?

2009-08-06 Thread Daniel Roseman
On Aug 6, 5:07 pm, koranthala wrote: > Hi, >    I am designing a website with Django and Apache. This is my first > foray to web designing, even though I have quite a bit of experience > in another area. >    The logic for the site is somewhat involved - It is better to think > of it as more of a

Re: checking/using model data in form save

2009-08-06 Thread Daniel Roseman
On Aug 6, 8:36 pm, zayatzz wrote: > Hello > > I am not entirely sure if i am asking the right question, but here is > what am trying to do. > > I am saving user mugshot with form and it works just fine. I rename > the uploaded file to mugshot.[insert imagefile extension here], but i > want to do

Re: getting current page URL in a Django Template

2009-08-06 Thread Daniel Roseman
On Aug 6, 9:33 pm, NealWalters wrote: > Is there a keyword that will automatically put the URL of the current > page in the Django form? > Or do I have to do that in code and pass it to the form as a normal > user variable? > > Here's what I'm trying to accomplish. I have a feedback form on a bas

Re: Admin, two links to different views ?

2009-08-07 Thread Daniel Roseman
On Aug 7, 2:46 pm, Karen Tracey wrote: > On Fri, Aug 7, 2009 at 8:26 AM, Asinox wrote: > > > No body? :( > > Just a tip -- posts like this, which essentially translate to "!!ANSWER > ME NOW!!", sent just six hours after the original question, are going to > make some people less inclined

Re: How to get this URI

2009-08-07 Thread Daniel Roseman
On Aug 7, 6:16 pm, David wrote: > Hello, > > My project is Web-based and I work in Django environment on Linux. Let > me give a Scenario first. > > A user whose username is "peter" logins into "www.myfoo.com" online. > After his username/password get authenticated, he arrives this webpage > "www.

Re: Recursive request and page layout

2009-08-07 Thread Daniel Roseman
On Aug 7, 5:24 pm, SardarNL wrote: > Hi Folks > > Here is the problem, we have some pages that don't contain any > content, but rather layout the blocks which are served by other views. > Extending the template and overriding some blocks is not a solution, > because there are many unrelated block

Re: upgraded to python2.5, but error-reports/traceback still references python2.3?

2009-08-07 Thread Daniel Roseman
On Aug 7, 5:45 pm, Cody Django wrote: > This is weird: I used to use python2.3 on the mediatemple server, but > recently upgraded to python2.5.  I've also installed mysqldb, pil, ect > under python2.5.  I've updated my pythonpath so the python2.5 route is > being used.  Everything works just fine

Re: Need help with a modelChoiceField

2009-08-07 Thread Daniel Roseman
On Aug 7, 7:33 pm, Bobby Roberts wrote: > hi.  does anyone have any ideas why this is not working... we are > using django 0.96 on this particular server. label_from_instance was added after that version. For now the only thing you can do is to define __unicode__ on the Upload model, and that wi

Re: how to deploy Django on the web server?

2009-08-07 Thread Daniel Roseman
On Aug 7, 9:56 pm, justin jools wrote: > thanks for the reply but I have access to a server for free so I wanted to > set it up myself, how can it be so difficult? Django is renowned as an easy > rapid development framework so why is it so difficult to deploy? > You haven't said why you think it'

Re: apps that relate to each other

2009-08-07 Thread Daniel Roseman
On Aug 7, 10:33 pm, Milan Andric wrote: > Hello I have two apps that have foreign keys to each other.  Like: > > people.models: > >   class Profile(Model): >      secondary_email = CharField() > >   class Staff(Profile): >      office = ForeignKey(Room) > > resources.models: > >   class Room(Mode

Re: using python libraries in django?

2009-08-08 Thread Daniel Roseman
On Aug 8, 7:42 pm, djangonoob wrote: > Hi Alex, > in that case, do we need to know where is the python modules being > installed > before importing it? No. > Or do we install another python library to a directory where our > django project lives before importing the > python modules? > > Best R

Re: Javascript with built-in templates tags

2009-08-08 Thread Daniel Roseman
On Aug 8, 7:49 pm, WilsonOfCanada wrote: > Thanks, > It worked, but out of curiosity, what do the additional quotes change > (why are they needed)? They're needed in Javascript, not in Django. If you looked at the generated source (via View Source in your browser) you could have seen that the ou

Re: Managed attributes with 'filter()' and 'exclude()'

2009-08-08 Thread Daniel Roseman
On Aug 8, 8:25 pm, BenW wrote: > Hello, > > I am working with a legacy database that stores IP addresses as 32bit > packed integers.  Is there a way I can use 'managed' attributes with > filter() and exclude() etc?  Please see example below: > > Thanks! > > class Host(models.Model): > >     id =

Re: Javascript with built-in templates tags

2009-08-09 Thread Daniel Roseman
On Aug 9, 6:19 am, WilsonOfCanada wrote: > I tried that before, but it only seems to work when it is used on > the .html file. > > onchange="changeArea('{{ list_areas.BC|safe|escapejs}}') > > I need it to be onchange="changeArea('{{ list_areas|safe|escapejs}}') > so the function can use list_area

Re: Model Methods and displaying in template?

2009-08-09 Thread Daniel Roseman
On Aug 9, 12:42 pm, rmschne wrote: > I'm looking for the right syntax for inside a template to display a > model variable that is actually not a field in the database (defined > by the mode), but a Model method. > > Class Member(model.Models): >     id = models.IntegerField(primary_key=True, db_c

Re: javascript variable in url resolver template tag

2009-08-09 Thread Daniel Roseman
On Aug 9, 4:43 pm, Sven Richter wrote: > Hi all, > > i wanted to know if it is possible to pass a Javascript variable to > the url template tag? > > Like: > > ... >

Re: javascript variable in url resolver template tag

2009-08-09 Thread Daniel Roseman
On Aug 9, 4:59 pm, Sven Richter wrote: > I am looking for a rating function AJAX style. > So what i am trying to do is the following: > > Click on a link register a Jquery function to call on that click with: > $('a#vote_pos').click(rate_it); > and then in rate_it call the url rate with two para

Re: import problem

2009-08-09 Thread Daniel Roseman
On Aug 9, 7:34 pm, Léon Dignòn wrote: > Hello, > > some times I'd like not to import a class but just write it down. > > Instead of > from myproject.myapp.models import MyModel > > I'd like to use > myproject.myapp.models.MyModel > > But I get a NameError: name 'myproject' is not defined > > Also

Re: import problem

2009-08-09 Thread Daniel Roseman
On Aug 9, 7:59 pm, Léon Dignòn wrote: > In my myproject/urls.py I want to pass the class to a function. > Because my urls.py is full of imports, I do not want another import > line for this class I only use at one line, because it's easier to > read. > > I wonder that I have to import myproject w

Re: user online

2009-08-09 Thread Daniel Roseman
On Aug 9, 10:07 pm, "Rob B (uk)" wrote: > Im using this middleware to try and display a list of online user on > my site.http://dpaste.com/77464/ > > Im just not sure how to pass it to my view and template.  Any ideas? > > Middleware found > @http://groups.google.com/group/django-users/browse_th

Re: user online

2009-08-10 Thread Daniel Roseman
On Aug 10, 7:10 pm, "Rob B (uk)" wrote: > Thanks Daniel. > Im still quite new to python / django and not sure how to pass > OnlineUsers.get_online_user_ids() into the context. My view to list > all profiles looks like this: > def profile_list(request): > >         return render_to_response('profi

Re: Contact form

2009-08-10 Thread Daniel Roseman
On Aug 10, 8:23 pm, When ideas fail wrote: > Hi, i've created a contact fom based on the one in the docs but i > don't know what to put as the action in the form element as part of > template. I've got this template: > > > {{ form.as_p }} > > > > but presuambly the data is being handled by the

Re: Is it possible to skip this field?

2009-08-10 Thread Daniel Roseman
On Aug 10, 10:58 pm, David wrote: > Hello, > > When I use the following code, > >   >         >             {{ form.as_table }} >         > > . > > It prints all form fields with corresponding values on a user's > monitor. Now that in that form there is a field "username", for some > reaso

Re: user online

2009-08-10 Thread Daniel Roseman
On Aug 10, 10:45 pm, "Rob B (uk)" wrote: > Im reading through loads of python / django tutorials atm, hopefully > some of it will stick! > > I added what you suggested and now I'm getting the error "type object > 'OnlineUsers' has no attribute 'get_online_user_ids'" > view -http://dpaste.com/7796

Re: Post matching query does not exist.

2009-08-11 Thread Daniel Roseman
On Aug 11, 8:27 pm, When ideas fail wrote: > After some more experiments i've decided its definetly some sort of > problem with the URLs, if i comment one out the 2nd works and if i > have them uncomment it doesn't. > > Can anyone help me with this please? > > On 11 Aug, 19:30, When ideas fail w

Re: save as a new entry

2009-08-12 Thread Daniel Roseman
On Aug 12, 10:40 pm, Ali Rıza KELEŞ wrote: > In admin interface, in editing section of a model, I need a button to > save as a new entry. There are four button at the end of the editing > form. > - Delete, > - Save and Add New, > - Save And Continue Editing, > - Save. > > I want to save the curre

Re: Adding new object using form and inloine formset. Do I do it right?

2009-08-12 Thread Daniel Roseman
On Aug 12, 9:20 pm, Tomek wrote: > Hi, > > Question: Is there a better way of creating objects from formset > (children) without having to create and possibly delete object which > is referenced by them (parent) and which is being created on the same > page? > > Here's my (simplified) models. It'

Re: Complex model produces > 400 queries with one pageview

2009-08-13 Thread Daniel Roseman
On Aug 13, 2:59 pm, tom wrote: > Hi, > > i want to save a lot of data (measurement values). The structure is, > that i have dataloggers (which produce data), sensors (are connected > to the datalogger with foreignkey), and projects. every logger is > connected to one project (foreignkey). then, t

Re: Override __init__()

2009-08-14 Thread Daniel Roseman
On Aug 14, 3:50 pm, Léon Dignòn wrote: > Hi Emily, > > thanks so far! > > unfortunately this line: > > > instance = getattr(kwargs, 'instance') > throws this error: > > Exception Value: 'dict' object has no attribute 'instance' > > what next? > That should be: instance = kwargs.get('instance')

Re: Override __init__()

2009-08-14 Thread Daniel Roseman
On Aug 14, 6:44 pm, Léon Dignòn wrote: > Yeah! this is working very well! > > Now my last question. How can I change the initial-value of first_name > and last_name I defined in my class (look at first post)? I have  to > do it in the __init__() because I need some values of instance. > > Thanks

Re: How to tidy up data returned by raw sql has u'blahblah'

2009-08-15 Thread Daniel Roseman
On Aug 15, 5:23 am, adelaide_mike wrote: > My raw sql returns a list of data very nicely, except that character > cols have data surrounded by u'', and dates have datetime.date > (2009-01-01) etc. > > In my newbie innocence I have not discovered how to remove these > extras.  Any clues? > > Thank

<    1   2   3   4   5   6   7   8   9   10   >