Re: Dajax or Jquery
On Monday 12 July 2010 16:06:14 Imad Elharoussi wrote: > I want to know what's the best plugin of Ajax to use with django Dajax or > Jquery (for someone who just began in developping with such technologies) > jquery is a general javascript toolkit. dajax integrates general javascript toolkits with django (jquery among them). I suspect you would be best off using both. -- Regards Kenneth Gonsalves Senior Associate NRC-FOSS at AU-KBC -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: μ must be μ
2010/7/12 Martin Melin > 2010/7/12 Alessandro Ronchi : > > I want django to return μ instead of the html enscaped form μ in my > > views, because I need it to return a reportlab template wich doesn't > handle > > the escaped version. > > I already have an unicode template and unicode output, so I only those > > characters not to convert to their HTML version. > > Isn't this simply the matter of running it through the template tag > "safe"? {{ your_output_string|safe }} should output the unicode data > verbatim. > I'm already using safe. Maybe the problem is that the standard pdf character μ is missing... I will try some tests. Thanks in advance. -- Alessandro Ronchi http://www.soasi.com Hobby & Giochi http://hobbygiochi.com http://www.facebook.com/hobbygiochi -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
ModelAdmin,get_form or Field._get_val_from_obj
I need to "decode" the value of the fields of ModelAdmin.form so that, for some fields, the int value is translated in a string showing its meaning. I do not want to implement this in the Model class (using Model.to_python or Model.formfield for example), because the information displayed in the columns of changelist_view page are enough for the 90% of the times, so I prefer to do the extra work necessary to generate the strings only when requested thus avoiding the overhead necessary to select the correct string to be wasted in most cases. So I was in doubt whether to override the ModelAdmin,get_form or some _get_val_from_obj for some fields from the ModelAdmin.form. Which one is more correct in your opinion? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: ModelAdmin,get_form or Field._get_val_from_obj
On Jul 13, 9:28 am, Massimiliano della Rovere wrote: > I need to "decode" the value of the fields of ModelAdmin.form so that, > for some fields, the int value is translated in a string showing its > meaning. > I do not want to implement this in the Model class (using > Model.to_python or Model.formfield for example), because the > information displayed in the columns of changelist_view page are > enough for the 90% of the times, so I prefer to do the extra work > necessary to generate the strings only when requested thus avoiding > the overhead necessary to select the correct string to be wasted in > most cases. > > So I was in doubt whether to override the ModelAdmin,get_form or some > _get_val_from_obj for some fields from the ModelAdmin.form. > > Which one is more correct in your opinion? Couldn't you just use `choices` for that? Specify the possible values and their 'decoded' versions in a 2-tuple, set the field's choices parameter to that constant, and you would automatically get a `get_FOO_display()` method which would show the 'decoded' value instead of the original one. -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: ModelAdmin,get_form or Field._get_val_from_obj
Hi Daniel, choices is how it is currently implemented, but it has 2 flaws: 1) this happens for all records, just when they are loaded; 2) the "translator" function, checks if the int can be used as a key to retrieve the meaning, else (KeyError) it returns 'currently unused'. 3) the choice solution forces me to list all the possible values (usually less than 20 out of 255 are meaningful). Now I am trying the ModelAdmin.render_change_form On Tue, Jul 13, 2010 at 10:34, Daniel Roseman wrote: > On Jul 13, 9:28 am, Massimiliano della Rovere > wrote: >> I need to "decode" the value of the fields of ModelAdmin.form so that, >> for some fields, the int value is translated in a string showing its >> meaning. >> I do not want to implement this in the Model class (using >> Model.to_python or Model.formfield for example), because the >> information displayed in the columns of changelist_view page are >> enough for the 90% of the times, so I prefer to do the extra work >> necessary to generate the strings only when requested thus avoiding >> the overhead necessary to select the correct string to be wasted in >> most cases. >> >> So I was in doubt whether to override the ModelAdmin,get_form or some >> _get_val_from_obj for some fields from the ModelAdmin.form. >> >> Which one is more correct in your opinion? > > Couldn't you just use `choices` for that? Specify the possible values > and their 'decoded' versions in a 2-tuple, set the field's choices > parameter to that constant, and you would automatically get a > `get_FOO_display()` method which would show the 'decoded' value > instead of the original one. > -- > DR. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Extending Admin to Include URLs for 3rd party ID fields.
Hi, I am new to Django and would like to advise on customising admin forms. I have references in my model to ID held in 3rd party systems. e.g. Salesforce, Zendesk etc. What I want to do for these field types is display a URL that links to the object in the respective source system. What would be the best way to go about adding this capability - ideally in some generic way such that for a given type of field I can calculate the appropriate URL prefix to append and include in the view. Many thanks for the tips! Jono -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Saving File/Image in tmp. I'm in trouble ...
Hey there, Is there any way to skip saving a file to the /tmp directory on a server? I got in a lot of trouble from my host when they found 10,000 files just sitting there from a Django script I'd been running to import book covers from an API. So far, the guts of my save code are: Save the file: - item.cover.save("cover name", File(open(the_file_itself)), save=True) Within def save() in the model, I send it to S3: - temp_file = "This is where the Model saves the file, upload_to="files/" - filedata = open(temp_file, 'rb').read() - conn.put(BUCKET_NAME, S3_PATH, s3.S3Object(filedata), {'x-amz-acl': 'public-read', 'Content-Type': 'image/jpeg'}) So, I'm guessing as a default it creates the file under the servers "/ tmp" directory? This is what I need to change. I tried: FILE_UPLOAD_TEMP_DIR = "/a/better/directory/tmp" But it hasn't changed anything. Any ideas would be great, Thanks so much ... Danny -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Saving File/Image in tmp. I'm in trouble ...
Forgot to mention, my files are all under 20k. Very small JPGs. Cheers, Danny -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Saving File/Image in tmp. I'm in trouble ...
Can't you erase the /tmp file after use it? os.remove(path) On Tue, Jul 13, 2010 at 12:11, The Danny Bos wrote: > > Forgot to mention, my files are all under 20k. > Very small JPGs. > > Cheers, > > Danny > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt and/or .pptx http://mirblu.com -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: μ must be μ
Alessandro, days ago I have the same problem, with |safe the chars aren't scaped, so I started to use mark_safe() from the view, try it, and let us know if it works. 2010/7/13 Alessandro Ronchi > > > 2010/7/12 Martin Melin > > 2010/7/12 Alessandro Ronchi : >> > I want django to return μ instead of the html enscaped form μ in my >> > views, because I need it to return a reportlab template wich doesn't >> handle >> > the escaped version. >> > I already have an unicode template and unicode output, so I only those >> > characters not to convert to their HTML version. >> >> Isn't this simply the matter of running it through the template tag >> "safe"? {{ your_output_string|safe }} should output the unicode data >> verbatim. >> > > I'm already using safe. Maybe the problem is that the standard pdf > character μ is missing... I will try some tests. > Thanks in advance. > > -- > Alessandro Ronchi > http://www.soasi.com > > Hobby & Giochi > http://hobbygiochi.com > http://www.facebook.com/hobbygiochi > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt and/or .pptx http://mirblu.com -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Saving File/Image in tmp. I'm in trouble ...
I can't get access to the servers own tmp path, only my own "/home/ 72999/data/tmp" which the file isn't saving to. Madness. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
templates translation problem
I have site with text written in Russian. Now I want to translate it to English. I've upgraded templates with trans tag like that {% trans "Всем привет" %}. Then I run makemessages, translated what I want, compilemessages. And now, the translation for the string "Всем привет" is never shown. Templates encoding is UTF-8. I've tried and loaded translation directly from python shell - it is loaded and present in translation object. What am I doing wrong? Cheers, Nick -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: ModelAdmin,get_form or Field._get_val_from_obj
It seems that modifying context['adminform'].form.instance or obj in render_change_form has no impact on the rendered html. Where does the admin interface take the values to display from? On Tue, Jul 13, 2010 at 10:28, Massimiliano della Rovere wrote: > I need to "decode" the value of the fields of ModelAdmin.form so that, > for some fields, the int value is translated in a string showing its > meaning. > I do not want to implement this in the Model class (using > Model.to_python or Model.formfield for example), because the > information displayed in the columns of changelist_view page are > enough for the 90% of the times, so I prefer to do the extra work > necessary to generate the strings only when requested thus avoiding > the overhead necessary to select the correct string to be wasted in > most cases. > > So I was in doubt whether to override the ModelAdmin,get_form or some > _get_val_from_obj for some fields from the ModelAdmin.form. > > Which one is more correct in your opinion? > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
How to handle Jaywalking - parsing a comma-delimited value in field and do lookups (1,4,5,6...)
Hi, I have an "interesting" problem here - in a given mysql database scheme some sql wizard used comma-separated values in a text-field and with that values lookups have to be done. The data itself is simple numbers like 1,34,25,66,78,134 and so on. So what I have is something like this: id | username | groups | more... - 1 | name| 1,23,4,55,6 | ... 2 | name2 | 3,2,4,5| ... The groups string can be very long. there is also a table "groups" with "id, name", as expected. Yes, this is bad design. No, I can not immediately change the design, I will try to, but atm I have to handle the situation as it is. Of course normally this would be solved with an intersection table and a many-to-many relation. For anybody interested: there is a book by Bill Karwin called "SQL Antipatterns" - he names the described design Jaywalking and it is the first antipattern in the book. I was surprised to find it in real life So my question is: how to handle this with django? I really would like to use django to build a nice management interface on top of that tables, but currently I do not know how to go on with that jaywalking antipattern in my way. My first idea was to create my own intersection table - but the process of [re-]converting data does only work in a static environment - the data is heavily used and so transformations of tabledata would be neccassery on every request to mirror the live situation...too slow! So I am looking for a good way to implement some kind of layer that would translate this field for django into an intersaection table so that I can use models - will this work? What do you think? How to handle this? Thank you very much for your attention! Snaky -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Saving File/Image in tmp. I'm in trouble ...
I never used Django with S3 but the upload_to is a folder inside the folder referenced by the MEDIA_ROOT setting. Atenciosamente, Vinicius Mendes Solucione Sistemas vinic...@solucione.info On Tue, Jul 13, 2010 at 8:06 AM, The Danny Bos wrote: > I can't get access to the servers own tmp path, only my own "/home/ > 72999/data/tmp" which the file isn't saving to. > > Madness. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Saving File/Image in tmp. I'm in trouble ...
I think that if python can save in /tmp you can remove it... Can you test in a simple python script if you can remove a file owned by you in /tmp? On Tue, Jul 13, 2010 at 13:06, The Danny Bos wrote: > I can't get access to the servers own tmp path, only my own "/home/ > 72999/data/tmp" which the file isn't saving to. > > Madness. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt and/or .pptx http://mirblu.com -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Saving File/Image in tmp. I'm in trouble ...
Den 13/07/2010 kl. 13.06 skrev The Danny Bos: > I can't get access to the servers own tmp path, only my own "/home/ > 72999/data/tmp" which the file isn't saving to. If you can't get access to /tmp, how did the files get there in the first place? Erik smime.p7s Description: S/MIME cryptographic signature
Re: Saving File/Image in tmp. I'm in trouble ...
Yeh, understood. It's saving a copy of the file to the directory set by "upload_to", which is where I'm getting the file to push toward S3. But alongside this it seems to be storing a copy of the file in the servers '/tmp' directory, this is the step I need to skip or similar. I'm getting my ass kicked. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Saving File/Image in tmp. I'm in trouble ...
On Tuesday 13 July 2010 16:48:31 The Danny Bos wrote: > Yeh, understood. It's saving a copy of the file to the directory set > by "upload_to", which is where I'm getting the file to push toward S3. > But alongside this it seems to be storing a copy of the file in the > servers '/tmp' directory, this is the step I need to skip or similar. > I'm getting my ass kicked. > does it not save it in tmp in the process of upload and then delete it? -- Regards Kenneth Gonsalves Senior Associate NRC-FOSS at AU-KBC -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Saving File/Image in tmp. I'm in trouble ...
Good point re: if I can upload it to tmp, surely I can delete it. I'll give that another crack. Kenneth, It doesn't delete it from tmp by default in my case, which is why they're on my back. Turned out there were 40,000 files in there, they were a bit pissy. My script that saves it where I define it in "upload_to", upload it to S3, then delete it from "upload_to" works beautifully. It's just this damn '/tmp' folder filling up with a copy. Is there anyway to skip this physical directory and play with each image file in RAM? Or is that a mad idea? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Saving File/Image in tmp. I'm in trouble ...
On Tuesday 13 July 2010 17:04:08 The Danny Bos wrote: > Good point re: if I can upload it to tmp, surely I can delete it. I'll > give that another crack. > > Kenneth, > It doesn't delete it from tmp by default in my case, which is why > they're on my back. Turned out there were 40,000 files in there, they > were a bit pissy. > > My script that saves it where I define it in "upload_to", upload it to > S3, then delete it from "upload_to" works beautifully. It's just this > damn '/tmp' folder filling up with a copy. Is there anyway to skip > this physical directory and play with each image file in RAM? Or is > that a mad idea? > so add a line that deletes the file from /tmp the moment it is saved -- Regards Kenneth Gonsalves Senior Associate NRC-FOSS at AU-KBC -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Pre-Registration User versus Registerred User?
U can try using sessions. Django supports anonymous sessions. See here: http://docs.djangoproject.com/en/dev/topics/http/sessions/ and here: http://www.djangobook.com/en/2.0/chapter14/ Best. On Jul 8, 12:38 am, iJames wrote: > I think my brains have been un-djangoed because I think I'm missing > something obvious. > > I've got the user model linked in with my own model serving as the > profile which is working for registerring and authenticating a user. > > But I'm wondering how to have a guest be able to do some things with > the intention of registerring later on? > > For instance, I want a user to be able to input some data and upload a > file and then after that set themselves up with a login and/or openid > or something like that. > > There are three aspects I'm troubled with which I think should be > obvious but I'm missing them: > > 1) If I setup these views/templates to be accessible to a non- > authenticated user, how will any data they create be associated with > the authenticated user later? And if they don't register, how can I > find and purge the data after some time? > > 2) Can I not delete the session cookie so that the non-authenticated > user can return in the same browser and still see their data? > > 3) What is the best practice for managing views/templates for the > triple world Guest versus Registerred User versus Admin? In > particular, how do I manage the different contexts that can ripple > through a the base template and the included templates? > > Thanks! I've got another burning question, but this one's first! > > James -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Admin Model Validation on ManyToMany Field
Hello, I have the following classes: class Application(models.Model): users = models.ManyToManyField(User, through='Permission') folder = models.ForeignKey(Folder) class Folder(models.Model): company = models.ManyToManyField(Compnay) class UserProfile(models.Model): user = models.OneToOneField(User, related_name='profile') company = models.ManyToManyField(Company) Now when I save application, I would like to check if the users do not belong to the application's folder's companies. I have posed this question before and someone came up with the following sollution: forms.py: class ApplicationForm(ModelForm): class Meta: model = Application def clean(self): cleaned_data = self.cleaned_data users = cleaned_data['users'] folder = cleaned_data['folder'] if users.filter(profile__company__in=folder.company.all()).count() > 0: raise forms.ValidationError('One of the users of this Application works in one of the Folder companies!') return cleaned_data admin.py class ApplicationAdmin(ModelAdmin): form = ApplicationForm This seems like right the way to go about this. The problem is that neither the users nor folder fields are in the cleaned_data and I get a keyerror when it hits the users = cleaned_data['users'] line. I was hoping that someone here could explain to me why these manytomany fields don't show up in cleaned_data and that someone could possibly give me a sollution to my problem. Thanks! Heleen -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Saving File/Image in tmp. I'm in trouble ...
Den 13/07/2010 kl. 13.34 skrev The Danny Bos: > > Good point re: if I can upload it to tmp, surely I can delete it. I'll > give that another crack. > > Kenneth, > It doesn't delete it from tmp by default in my case, which is why > they're on my back. Turned out there were 40,000 files in there, they > were a bit pissy. Tell them to not allow their customers to place files in directories they don't want filled up :-) Erik smime.p7s Description: S/MIME cryptographic signature
Re: Help Converting a Query getting one result using .filter() to .get()
Sorry, I should've said what I'm using it for... Here's my models http://dpaste.com/217686/ The query above I just want to get the next/upcoming game in the database, which I display on the sidebar of the front page. What I am trying to do, is also get ALL other entries from the database, in a separate query where sport=sport and opponent=opponent to figure out the historical Win/Loss record between the teams? On Jul 12, 8:15 pm, John M wrote: > Why does it matter? > > You could just say next_game[0] instead. > > J > > On Jul 12, 4:28 pm, Chris McComas wrote: > > > > > I have this query, trying to get the next game in the future. > > > today = datetime.datetime.now() > > next_game = Game.objects.filter(date__gt=today).order_by('date')[:1] > > > I need to use .get() if possible, instead of .filter() how can I do > > this? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Existing sites using Django
Hi, I've discussed using Django to my MD and he's asked for some example large sites that were built using Django. Does anyone maintain or know of any neat URLs I can point him to to see how great it is. I'm not looking for front-end features, rather speed of page request or volume of data. Many thanks, Adam Auckland -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: __init__ custom form validation
Your init is expecting a value for field3_type, so you need to provide it when you create the form in your view (prior to request.POST in the postback instance). On Jul 12, 2:44 pm, Nick wrote: > I am working on a validation that will require a field be filled in if > it is another field enters on of three values: > > For example: > > I have a form > > class myform(forms.Modelform): > field1 = forms.CharField > field2 = forms.Charfield > field3_type = forms.CharField(choices=choices) > field3 = forms.DateTimeField(required=True) > > def __init__(self, field3_type, *args, **kwargs): > super(myform, self_.__init__(*args, **kwargs) > if field3_type in ('option 1', 'option 2', 'option 3'): > self.field['field3'] = forms.DateTiemField(required=False) > > The view: > if request.method == 'POST': > form = myform(request.POST) > field3_type = form.cleaned_data['field3_type'] > if form.is_valid(): > # some form processing > else: > form = myform() > > When i try to use the form I get an error at the myform() line stating > that __init__ takes exactyl 2 arguments and only 1 is given. > > Any thoughts? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Existing sites using Django
http://www.djangosites.org/ HTH, Richard Shebora On Tue, Jul 13, 2010 at 9:31 AM, Adam Auckland wrote: > Hi, > > I've discussed using Django to my MD and he's asked for some example > large sites that were built using Django. > > Does anyone maintain or know of any neat URLs I can point him to to > see how great it is. I'm not looking for front-end features, rather > speed of page request or volume of data. > > Many thanks, > > Adam Auckland > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Anyone want to take over maintaining Instant Django?
Djangoholics: I no longer have the time or interest to maintain my little project: http://www.instantdjango.com If anyone would like to take over the project, I would gladly give it away. Right now it costs a few dollars in shared hosting a month, and a few more dollars for the downloads I host with AWS. If you take over the project I will give you the domain, but I'm not going to pay the hosting. I'll also give you my 'build' script, but it no longer works correctly because the Python core devs broke the Windows installer, and mocked me when I reported the bug. The project website gets a hundred or so hits a day, and several thousand downloads a month. It also ranks highly for a few different google searches related to Django. Let me know if you have any interest. It wouldn't take much effort to maintain, I just can't do it anymore. -cjl -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Anyone want to take over maintaining Instant Django?
It is your child. :( On Tue, Jul 13, 2010 at 5:37 PM, cjl wrote: > Djangoholics: > > I no longer have the time or interest to maintain my little project: > > http://www.instantdjango.com > > If anyone would like to take over the project, I would gladly give it > away. Right now it costs a few dollars in shared hosting a month, and > a few more dollars for the downloads I host with AWS. If you take over > the project I will give you the domain, but I'm not going to pay the > hosting. > > I'll also give you my 'build' script, but it no longer works correctly > because the Python core devs broke the Windows installer, and mocked > me when I reported the bug. > > The project website gets a hundred or so hits a day, and several > thousand downloads a month. It also ranks highly for a few different > google searches related to Django. > > Let me know if you have any interest. It wouldn't take much effort to > maintain, I just can't do it anymore. > > -cjl > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Existing sites using Django
Two of the bigger django sites are www.disqus.com and www.theunion.com. A couple more known sites can be found at the frontpage of djangoproject.com. Djangoproject.com itself is probably one of the biggest when it comes to visitors as well, serving 500 000 unique visitors per month. You could also mention that Google, NASA and Mozilla are Django supporters :) On Jul 13, 3:31 pm, Adam Auckland wrote: > Hi, > > I've discussed using Django to my MD and he's asked for some example > large sites that were built using Django. > > Does anyone maintain or know of any neat URLs I can point him to to > see how great it is. I'm not looking for front-end features, rather > speed of page request or volume of data. > > Many thanks, > > Adam Auckland -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Anyone want to take over maintaining Instant Django?
Hi there. While I cannot extend on it for a while yet, I have a few thoughts on why one would keep this site "alive". Please email me some stats like total running costs, average monthly hits? Would be nice to see Google Analytics stats. Thanks. On Tue, Jul 13, 2010 at 4:37 PM, cjl wrote: > Djangoholics: > > I no longer have the time or interest to maintain my little project: > > http://www.instantdjango.com > > If anyone would like to take over the project, I would gladly give it > away. Right now it costs a few dollars in shared hosting a month, and > a few more dollars for the downloads I host with AWS. If you take over > the project I will give you the domain, but I'm not going to pay the > hosting. > > I'll also give you my 'build' script, but it no longer works correctly > because the Python core devs broke the Windows installer, and mocked > me when I reported the bug. > > The project website gets a hundred or so hits a day, and several > thousand downloads a month. It also ranks highly for a few different > google searches related to Django. > > Let me know if you have any interest. It wouldn't take much effort to > maintain, I just can't do it anymore. > > -cjl > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- Regards, Sithembewena Lloyd Dube http://www.lloyddube.com -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Odd Issue Updating Model Values -- They get wrapped in parenthesis and quotes
You have a trailing comma on each of your assignment lines which will turn the right hand value into a tuple :) > > if len(line['Youth - First Name']) > 0: > youth.name_first=line['Youth - First Name'].title().strip(), > if len(line['Youth - Middle Name']) > 0: > youth.name_middle=line['Youth - Middle Name'].title().strip(), > if len(line['Youth - Last Name']) > 0: youth.name_last=line['Youth > - Last Name'].title().strip(), > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Form validation and template errors - need n00b help
HI, Forgive me, here's another n00b doozie. I've created a form, which extends form, however, my form is not validating and I can't get the form to print errors next to my form fields. What's curious, at the form.is_valid() in all the examples, I don't see an else: clause. Which leads me to believe that a validation error should be raised at this point, so an else is not neccessary?? So, my form should hold clean_fieldname methods for each field name correct? and if an error is raised, automagically, django handles the error messages, as long as it's defined in my template, correct or not? So every property needs a clean method? Sorry, I've read the resources and I'm a little unclear on this? Thanks for your time, Django and the community rocks from my views: def listing(request): if request.method == 'POST': # If the form has been submitted... new_listing = Listing() form = ListingForm(data=request.POST,instance=new_listing) #form.save() if form.is_valid(): # All validation rules pass form.save() return HttpResponseRedirect('/listing/') # Redirect after POST #else: #return HttpResponseRedirect('/listing/') # Redirect after POST #return HttpResponse('form is a failure, like you.') #return HttpResponseRedirect('/create/') # Redirect after POST else: form = ListingForm() # An unbound form return render_to_response('listing.html', { 'form': form, }) listing.html template {% extends "base.html" %} {% block content %} {% include "form_snippet.html" %} {% endblock %} so apparently that should work form_snippet.html template % for field in form %} {{ field.errors }} {{ field.label_tag }}: {{ field }} {% endfor %} -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Silly Question? Mulitple Checkbox Processing
Maybe this is a silly question, but if I have a form with multiple checkboxes that are outputted by a for loop, how is the data passed in the POST? Is it like a dictionary? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Anyone want to take over maintaining Instant Django?
Hi, I wouldn't mind taking it on. I can host it on my hosting server and maintain your child for you. Do let me know and we can exchange the information.I am an eager new learner of django but am creating an enterprise level application for a university at the moment and will get up to speed rather fast. Cheers, Thusjanthan. On Jul 13, 7:37 am, cjl wrote: > Djangoholics: > > I no longer have the time or interest to maintain my little project: > > http://www.instantdjango.com > > If anyone would like to take over the project, I would gladly give it > away. Right now it costs a few dollars in shared hosting a month, and > a few more dollars for the downloads I host with AWS. If you take over > the project I will give you the domain, but I'm not going to pay the > hosting. > > I'll also give you my 'build' script, but it no longer works correctly > because the Python core devs broke the Windows installer, and mocked > me when I reported the bug. > > The project website gets a hundred or so hits a day, and several > thousand downloads a month. It also ranks highly for a few different > google searches related to Django. > > Let me know if you have any interest. It wouldn't take much effort to > maintain, I just can't do it anymore. > > -cjl -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Existing sites using Django
On Tue, Jul 13, 2010 at 7:01 PM, Adam Auckland wrote: > I've discussed using Django to my MD and he's asked for some example > large sites that were built using Django. > > Does anyone maintain or know of any neat URLs I can point him to to > see how great it is. I'm not looking for front-end features, rather > speed of page request or volume of data. > djangosites is pretty good. I need to add my site there : http://www.mapatree.org/ -V -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Silly Question? Mulitple Checkbox Processing
Try it and see :) If the checkboxes share the same name (as in the name attribute of the input tag), then the checked ones' values form a comma-delimited list. On Jul 13, 11:19 am, zippzom wrote: > Maybe this is a silly question, but if I have a form with multiple > checkboxes that are outputted by a for loop, how is the data passed in > the POST? > > Is it like a dictionary? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Mass Hosting on mod_wsgi?
So it would work to just create a standard deployment for each VirtualHost, just specifying a different DJANGO_SETTINGS_MODULE in each WSGI script? I should be able to get that working, as a fallback at worst. I've read the Django integration and Application Issues pages from the mod_wsgi docs, and feel like I got the gist but won't claim to have understood every word; also read the virtualenv docs and was mostly lost. I do have someone lined up to handle the actual installation of mod_wsgi, but he has no experience with Django and very little with Python. My server administration skills are pretty basic (navigating the filesystem, configuring a plain-vanilla virtual host, etc), and I'm sure there are things I don't understand about the Python and Django operating environment -- I'm a little more familiar with the PHP model where everything is set up and torn down for each request. I figured there might be some solution using mod_rewrite or routing in the WSGI script to avoid having to create separate Virtual Hosts and WSGI scripts for each instance, but it is crucial that the correct "current site" be identified by the Sites contrib module for every request, and I have no idea whether that would be derailed by any sort of internal routing. Each settings file is named based on the domain it's associated with. So example.com and www.example.com would both be served using user_settings.example_com. example.co.uk and www.example.co.uk would be served using user_settings.example_co_uk. The domain-specific settings files basically just import all the settings from a global settings file and then override the SITE_ID. All media will be served from a single separate domain / virtual host, so there's no need to configure media serving for each site. Thanks for your help! Nan On Jul 12, 7:13 pm, Graham Dumpleton wrote: > > > How much of the documentation on the official mod_wsgi site have you > read? > > Your use case is basically the standard deployment method, duplicated > for each VirtualHost. > > I could suggest some alternatives to that to support a common WSGI > script file, but still allow a way of restarting a single daemon > process by touching a file specific to each site, eg., that sites > settings file. > > Before doing that though would like to see that you have the standard > deployment method working first and understand that else if I start > talking about improvements to that without you have actually got the > standard method working first, then may just confuse you. > > Also would need to know what naming strategy you are going to use for > the site specific settings files. If know that can describe > alternative in a way that makes sense to you rather than you having to > translate it. > > Graham -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Anyone want to take over maintaining Instant Django?
Hello Cjl, I can host it for you and spend some time keeping it up to date. I have built windows installers before so I could probably fix the installer issues. Cheers, Condor On Tue, Jul 13, 2010 at 7:37 AM, cjl wrote: > Djangoholics: > > I no longer have the time or interest to maintain my little project: > > http://www.instantdjango.com > > If anyone would like to take over the project, I would gladly give it > away. Right now it costs a few dollars in shared hosting a month, and > a few more dollars for the downloads I host with AWS. If you take over > the project I will give you the domain, but I'm not going to pay the > hosting. > > I'll also give you my 'build' script, but it no longer works correctly > because the Python core devs broke the Windows installer, and mocked > me when I reported the bug. > > The project website gets a hundred or so hits a day, and several > thousand downloads a month. It also ranks highly for a few different > google searches related to Django. > > Let me know if you have any interest. It wouldn't take much effort to > maintain, I just can't do it anymore. > > -cjl > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Anyone want to take over maintaining Instant Django?
On 2010-07-13, at 7:37 AM, cjl wrote: > I no longer have the time or interest to maintain my little project: > > http://www.instantdjango.com > I'll also give you my 'build' script, but it no longer works correctly > because the Python core devs broke the Windows installer, and mocked > me when I reported the bug. Is the source for building it in some sort of source control eg: github? -- Andy McKay, @andymckay Django Consulting, Training and Support -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Existing sites using Django
Hi, As far as I know, http://grono.net was built using Django. At once it was Polish biggest community portal which recently probably lost much traffic in favor of the Nasza Klasa crap ;) Regards, Piotr -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Existing sites using Django
And don't forget sites like http://www.giantbomb.com and other sites by Whiskey Media :-) -- Horst On Tue, Jul 13, 2010 at 7:59 PM, Piotr Kilczuk wrote: > Hi, > > As far as I know, http://grono.net was built using Django. At once it > was Polish biggest community portal which recently probably lost much > traffic in favor of the Nasza Klasa crap ;) > > Regards, > Piotr > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: automatic documentation (docutils) does not pull in class methods?
On Jun 22, 4:12 am, "euan.godd...@googlemail.com" wrote: > You could try using Spinhx if you don't think docutils gives you > enough flexibility. The autodoc extension is great. > However sphinx + autodoc does not know how to extra django model definitions, e.g. class A(models.Model): field_not_seen_by_autodoc = models.CharField(...) Whereas the django admindocs utility knows about these fields. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Django x Dreamhost
Hi people, I just got a dreamhost account and I need to install Django there. I follow some usual links like wiki but I still have problems, the best instruction I found was http://jeffcroft.com/blog/2006/may/11/django-dreamhost/. Is there anyone here that install Django in dreamhost last days ? Thanks Alex -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: None field : Admin save setting it to empty value instead of NULL during save
Could it be generic ?. I mean i don't want to specify self.naughty_field. How to do it for self.any_field ? RJ On Tue, Jun 29, 2010 at 9:29 AM, euan.godd...@googlemail.com wrote: > Django admin can't differentiate between empty string and None and > picks empty string which makes sense in most cases. > > If you don't like the idea of empty string override the save method > and coerce empty string to None before calling the super classes save, > e.g. > > class YourModel(models.Model): > ... > > def save(self, *args, **kwargs): > if self.naughty_field == '': > self.naughty_field = None > super(YourModel, self).save(*args, **kwargs) > > Euan > > On Jun 29, 4:15 pm, rahul jain wrote: >> Hi there ! >> >> One of my model fields attribute is set to null="true" to allow None >> values. But if I use admin to save those model objects and leave it >> blank, it saves blank value instead of None. >> How to fix this ? >> >> And Blank value is not None. Blank is "" (empty) but None is NULL in >> databases. >> >> -RJ > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Mass Hosting on mod_wsgi?
On Jul 14, 3:05 am, ringemup wrote: > So it would work to just create a standard deployment for each > VirtualHost, just specifying a different DJANGO_SETTINGS_MODULE in > each WSGI script? I should be able to get that working, as a fallback > at worst. > > I've read the Django integration and Application Issues pages from the > mod_wsgi docs, and feel like I got the gist but won't claim to have > understood every word; also read the virtualenv docs and was mostly > lost. I do have someone lined up to handle the actual installation of > mod_wsgi, but he has no experience with Django and very little with > Python. My server administration skills are pretty basic (navigating > the filesystem, configuring a plain-vanilla virtual host, etc), and > I'm sure there are things I don't understand about the Python and > Django operating environment -- I'm a little more familiar with the > PHP model where everything is set up and torn down for each request. If you are just getting started, then would very much recommend going with the basic approach of separate VirtualHost for each with standard configuration, but where delegate each Django instance to a daemon process group. To get a better understanding of how to do it and the problems watch my Sydney PyCon talk. For details see: http://blog.dscpl.com.au/2010/06/sydney-pycon-modwsgi-talk-slides.html > I figured there might be some solution using mod_rewrite or routing in > the WSGI script to avoid having to create separate Virtual Hosts and > WSGI scripts for each instance, but it is crucial that the correct > "current site" be identified by the Sites contrib module for every > request, and I have no idea whether that would be derailed by any sort > of internal routing. VirtualHost is better to start with because then you can have a separate Apache access/error log for each site. If you use other mechanisms then cant have separate log files. > Each settings file is named based on the domain it's associated with. > So example.com andwww.example.comwould both be served using > user_settings.example_com. example.co.uk andwww.example.co.ukwould > be served using user_settings.example_co_uk. The domain-specific > settings files basically just import all the settings from a global > settings file and then override the SITE_ID. > > All media will be served from a single separate domain / virtual host, > so there's no need to configure media serving for each site. The one thing you should be aware of given suggestion to use VirtualHost and mod_wsgi daemon process groups, is that you will need to restart Apache each time you add a new site. If that isn't very often, then quite acceptable. Graham > Thanks for your help! > Nan > > On Jul 12, 7:13 pm, Graham Dumpleton > wrote: > > > > > > > How much of the documentation on the official mod_wsgi site have you > > read? > > > Your use case is basically the standard deployment method, duplicated > > for each VirtualHost. > > > I could suggest some alternatives to that to support a common WSGI > > script file, but still allow a way of restarting a single daemon > > process by touching a file specific to each site, eg., that sites > > settings file. > > > Before doing that though would like to see that you have the standard > > deployment method working first and understand that else if I start > > talking about improvements to that without you have actually got the > > standard method working first, then may just confuse you. > > > Also would need to know what naming strategy you are going to use for > > the site specific settings files. If know that can describe > > alternative in a way that makes sense to you rather than you having to > > translate it. > > > Graham -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Django x Dreamhost
Hi Alex, I follow the steps in http://wiki.dreamhost.com/Django. I manage to do it successfully. Cheers, Ivan On Wed, Jul 14, 2010 at 6:52 AM, Alex s wrote: > Hi people, > > I just got a dreamhost account and I need to install Django there. > > I follow some usual links like wiki but I still have problems, the best > instruction I found was > http://jeffcroft.com/blog/2006/may/11/django-dreamhost/. > > Is there anyone here that install Django in dreamhost last days ? > > Thanks > Alex > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
django and handling form validation errors
HI, (sorry for this re-post, my original post isn't here??, so I replaced it, and I have been checking up all day as I hope to find the solution) Forgive me, here's another n00b doozie. I've created a form, which extends form, however, my form is not validating and I can't get the form to print errors next to my form fields. What's curious, at the form.is_valid() in all the examples, I don't see an else: clause. Which leads me to believe that a validation error should be raised at this point, so an else is not neccessary?? So, my form should hold clean_fieldname methods for each field name correct? and if an error is raised, automagically, django handles the error messages, as long as it's defined in my template, correct or not? So every property needs a clean method? Sorry, I've read the resources and I'm a little unclear on this? Thanks for your time, Django and the community rocks from my views: def listing(request): if request.method == 'POST': # If the form has been submitted... new_listing = Listing() form = ListingForm(data=request.POST,instance=new_listing) #form.save() if form.is_valid(): # All validation rules pass form.save() return HttpResponseRedirect('/listing/') # Redirect after #else: #return HttpResponseRedirect('/listing/') # Redirect after #return HttpResponse('form is a failure, like you.') #return HttpResponseRedirect('/create/') # Redirect after else: form = ListingForm() # An unbound form return render_to_response('listing.html', { 'form': form, }) listing.html template {% extends "base.html" %} {% block content %} {% include "form_snippet.html" %} {% endblock %} so apparently that should work form_snippet.html template % for field in form %} {{ field.errors }} {{ field.label_tag }}: {{ field }} {% endfor %} -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Form Relationships, Multiple Models Using a loop?
I think what I was looking for was inlineformsets. Easy enough i suppose. We'll see. Anyone interested, see here: http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#inline-formsets On Jun 16, 8:35 pm, Erich wrote: > First time poster, so go easy on me... > > I need to create a form that will display a heading / description that > comes from one model (DReq) which I can get to display in a for loop. > Each dreq.desc is dependent on the results of a var that gets set and > read in from the user's session. Then I need to add a couple form > fields (from Saq) to each one that will relate to dreq.req_number > (also displayed alongside the desc) so that I can save the user's > input to the db (the DReq and MSaq are related as a MTM through > another model Saq). > > The best way I can figure out how to do this is to use some sort of > for loop that will display each item and the respective form fields. I > have gotten that far by going the template route (see below). My > problem is that I do not know how to relate them to each other. Below > is some of what I have come up with. If all else fails I will just > create four (there are only four possible configurations for the form, > but it seems like this would be more elegant in a loop, somehow > relating them) individual forms to handle the task. > > Here is what I have come up with so far (I know this together doesn't > work, it is just what I have tried in the various MTV places): > > forms.py: > > class MSForm(forms.Form): > answer = forms.Charfield(widget=forms.NullBooleanSelect) > note = forms.Charfield(widget=forms.TextArea) > # Perhaps use a ModelForm? > # class Meta: > # model = DReq > # fields = [ > # 'answer', > # 'note', > # ] > > views.py > > @login_required > def saq(request): > current_saq = request.session.get('current_saq') > question = DReq.objects.filter(s_types=current_saq) > > # Probably not the right place for the loop, but i was trying > something different > for dreq in question: > if question.headline: > req_headline = question.headline > req_number = dreq.req_num > if dreq.needs_answer: > saq_form = MSForm() > > if request.method == 'POST': > saq_form = MSForm(request.POST) > > if saq_form.is_valid(): > # Query that pulls the requirement and assigns the correct > answer to it. > ... > > template.html -- This will display the form with the proper > information (from a different views.py version), but the form inputs > and the desc/reqs are not related in any way. Closest I've come except > it obviously doesn't work. > > ... > {% csrf_token %} > > > {% for dreq in question %} > {% if dreq.headline %} > {{ dreq.headline }} > {% endif %} > {{ dreq.req_num }}: {{ dreq.desc}} > {% if dreq.needs_answer %} > {{ saq_form.answer }} > {{ saq_form.note }} > {% endif %} > {% endfor %} > > > > > ... > > models.py > ... > # This is where the desc text comes from > class DReq(models.Model): > req_num = models.CharField(max_length=5, blank=False) > headline = models.CharField(max_length=200, blank=True) > description = models.CharField(max_length=400, blank=False) > needs_answer = models.BooleanField(blank=False) > s_types = models.ManyToManyField(SType) > > class MSaq(models.Model): > complete = models.BooleanField(blank=True) > d_req = models.ManyToManyField(DReq, through='Saq') > > # This is where the data needs to be stored and related to > class Saq(models.Model): > d_req = models.ForeignKey(DReq) > m_saq = models.ForeignKey(MSaq) > answer = models.NullBooleanField(blank=False) > note = models.CharField(max_length=200, blank=True) > ... > > I have redacted some of the names to protect the innocent, I hope it > is still easy to follow. I feel like I am missing something very > basic, but I just can't wrap my head around what. > > So, I just need to link the descriptions (which get iterated and > displayed just fine) to the form fields that get displayed with them, > so I can write the responses to the db. I hope this isn't info > overkill. > > Thanks in advance. > > Erich -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Easiest way to pass variables between modelforms (genericforms)
I think I found what I was looking for: inlineformsets. Here: http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#inline-formsets On Jul 12, 1:56 pm, Erich wrote: > Derek, > > Cool, thanks for that. I wonder if something similar would work on > passing values to a formset... > > Erich > > On Jul 8, 1:17 am, derek wrote: > > > > > On Jul 7, 12:44 am, Erich wrote: > > > > I am using create_update.create_object to handle my forms (generic > > > forms both use modelforms). I have two forms. The second relies on the > > > pk of the first as a fk. I can't figure out what is the best practice > > > to A: save the pk as a variable or into the session, then B: pull that > > > variable either out of the session or another place, such as a global > > > variable. > > > > I could write the forms manually, but this does not seem to be the > > > most efficient way, unless create_object was meant for very simple > > > forms. I have tried using extra_context to call another function, but > > > I dont know if that is the best way either. > > > Maybe have a look > > at:http://www.petersanchez.com/2008/09/26/django-formwizard-passing-data... -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Mass Hosting on mod_wsgi?
Thank you -- can't tell you how much I appreciate your taking the time to help me out with this! The slides were extremely helpful, too, although I'll need to do some research in order to understand some of the details and figure out which of the options you presented we should use. I'm feeling confident about at least getting this running now. On Jul 13, 7:11 pm, Graham Dumpleton wrote: > On Jul 14, 3:05 am, ringemup wrote: > > > So it would work to just create a standard deployment for each > > VirtualHost, just specifying a different DJANGO_SETTINGS_MODULE in > > each WSGI script? I should be able to get that working, as a fallback > > at worst. > > > I've read the Django integration and Application Issues pages from the > > mod_wsgi docs, and feel like I got the gist but won't claim to have > > understood every word; also read the virtualenv docs and was mostly > > lost. I do have someone lined up to handle the actual installation of > > mod_wsgi, but he has no experience with Django and very little with > > Python. My server administration skills are pretty basic (navigating > > the filesystem, configuring a plain-vanilla virtual host, etc), and > > I'm sure there are things I don't understand about the Python and > > Django operating environment -- I'm a little more familiar with the > > PHP model where everything is set up and torn down for each request. > > If you are just getting started, then would very much recommend going > with the basic approach of separate VirtualHost for each with standard > configuration, but where delegate each Django instance to a daemon > process group. > > To get a better understanding of how to do it and the problems watch > my Sydney PyCon talk. For details see: > > http://blog.dscpl.com.au/2010/06/sydney-pycon-modwsgi-talk-slides.html > > > I figured there might be some solution using mod_rewrite or routing in > > the WSGI script to avoid having to create separate Virtual Hosts and > > WSGI scripts for each instance, but it is crucial that the correct > > "current site" be identified by the Sites contrib module for every > > request, and I have no idea whether that would be derailed by any sort > > of internal routing. > > VirtualHost is better to start with because then you can have a > separate Apache access/error log for each site. If you use other > mechanisms then cant have separate log files. > > > Each settings file is named based on the domain it's associated with. > > So example.com andwww.example.comwouldboth be served using > > user_settings.example_com. example.co.uk andwww.example.co.ukwould > > be served using user_settings.example_co_uk. The domain-specific > > settings files basically just import all the settings from a global > > settings file and then override the SITE_ID. > > > All media will be served from a single separate domain / virtual host, > > so there's no need to configure media serving for each site. > > The one thing you should be aware of given suggestion to use > VirtualHost and mod_wsgi daemon process groups, is that you will need > to restart Apache each time you add a new site. If that isn't very > often, then quite acceptable. > > Graham > > > Thanks for your help! > > Nan > > > On Jul 12, 7:13 pm, Graham Dumpleton > > wrote: > > > > How much of the documentation on the official mod_wsgi site have you > > > read? > > > > Your use case is basically the standard deployment method, duplicated > > > for each VirtualHost. > > > > I could suggest some alternatives to that to support a common WSGI > > > script file, but still allow a way of restarting a single daemon > > > process by touching a file specific to each site, eg., that sites > > > settings file. > > > > Before doing that though would like to see that you have the standard > > > deployment method working first and understand that else if I start > > > talking about improvements to that without you have actually got the > > > standard method working first, then may just confuse you. > > > > Also would need to know what naming strategy you are going to use for > > > the site specific settings files. If know that can describe > > > alternative in a way that makes sense to you rather than you having to > > > translate it. > > > > Graham > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Mass Hosting on mod_wsgi?
On Jul 14, 9:41 am, ringemup wrote: > Thank you -- can't tell you how much I appreciate your taking the time > to help me out with this! The slides were extremely helpful, too, > although I'll need to do some research in order to understand some of > the details and figure out which of the options you presented we > should use. I'm feeling confident about at least getting this running > now. Ensure you watch the video as well as that will explain slides better. Graham > On Jul 13, 7:11 pm, Graham Dumpleton > wrote: > > > > > On Jul 14, 3:05 am, ringemup wrote: > > > > So it would work to just create a standard deployment for each > > > VirtualHost, just specifying a different DJANGO_SETTINGS_MODULE in > > > each WSGI script? I should be able to get that working, as a fallback > > > at worst. > > > > I've read the Django integration and Application Issues pages from the > > > mod_wsgi docs, and feel like I got the gist but won't claim to have > > > understood every word; also read the virtualenv docs and was mostly > > > lost. I do have someone lined up to handle the actual installation of > > > mod_wsgi, but he has no experience with Django and very little with > > > Python. My server administration skills are pretty basic (navigating > > > the filesystem, configuring a plain-vanilla virtual host, etc), and > > > I'm sure there are things I don't understand about the Python and > > > Django operating environment -- I'm a little more familiar with the > > > PHP model where everything is set up and torn down for each request. > > > If you are just getting started, then would very much recommend going > > with the basic approach of separate VirtualHost for each with standard > > configuration, but where delegate each Django instance to a daemon > > process group. > > > To get a better understanding of how to do it and the problems watch > > my Sydney PyCon talk. For details see: > > > http://blog.dscpl.com.au/2010/06/sydney-pycon-modwsgi-talk-slides.html > > > > I figured there might be some solution using mod_rewrite or routing in > > > the WSGI script to avoid having to create separate Virtual Hosts and > > > WSGI scripts for each instance, but it is crucial that the correct > > > "current site" be identified by the Sites contrib module for every > > > request, and I have no idea whether that would be derailed by any sort > > > of internal routing. > > > VirtualHost is better to start with because then you can have a > > separate Apache access/error log for each site. If you use other > > mechanisms then cant have separate log files. > > > > Each settings file is named based on the domain it's associated with. > > > So example.com andwww.example.comwouldbothbe served using > > > user_settings.example_com. example.co.uk andwww.example.co.ukwould > > > be served using user_settings.example_co_uk. The domain-specific > > > settings files basically just import all the settings from a global > > > settings file and then override the SITE_ID. > > > > All media will be served from a single separate domain / virtual host, > > > so there's no need to configure media serving for each site. > > > The one thing you should be aware of given suggestion to use > > VirtualHost and mod_wsgi daemon process groups, is that you will need > > to restart Apache each time you add a new site. If that isn't very > > often, then quite acceptable. > > > Graham > > > > Thanks for your help! > > > Nan > > > > On Jul 12, 7:13 pm, Graham Dumpleton > > > wrote: > > > > > How much of the documentation on the official mod_wsgi site have you > > > > read? > > > > > Your use case is basically the standard deployment method, duplicated > > > > for each VirtualHost. > > > > > I could suggest some alternatives to that to support a common WSGI > > > > script file, but still allow a way of restarting a single daemon > > > > process by touching a file specific to each site, eg., that sites > > > > settings file. > > > > > Before doing that though would like to see that you have the standard > > > > deployment method working first and understand that else if I start > > > > talking about improvements to that without you have actually got the > > > > standard method working first, then may just confuse you. > > > > > Also would need to know what naming strategy you are going to use for > > > > the site specific settings files. If know that can describe > > > > alternative in a way that makes sense to you rather than you having to > > > > translate it. > > > > > Graham -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Odd Issue Updating Model Values -- They get wrapped in parenthesis and quotes
Awesome, thanks! On Jul 13, 11:02 am, "m...@nipltd.com" wrote: > You have a trailing comma on each of your assignment lines which will > turn the right hand value into a tuple :) > > > > > if len(line['Youth - First Name']) > 0: > > youth.name_first=line['Youth - First Name'].title().strip(), > > if len(line['Youth - Middle Name']) > 0: > > youth.name_middle=line['Youth - Middle Name'].title().strip(), > > if len(line['Youth - Last Name']) > 0: youth.name_last=line['Youth > > - Last Name'].title().strip(), -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
allow users who are not logged in to submit data first and then log in or register
I have a data submission form that is visible to everyone, but a user must be registered & logged in before the data can be submitted I want to allow users who are not logged in to submit data through the form first, and then ask him to either register or log in. After the registration/login process is finished, the data submitted by that user would then be saved to the DB. What's the best way to achieve that? It doesn't seem like the @login_required decorator would work because the initial data submitted by the user wouldn't be preserved by @login_required. Is there a decorator similar to @login_required but would do what I want? Thanks. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Filtering a List
Example: http://dpaste.com/217886/ Line 6 is what I have a question about. Should I use javascript to deal with that? If so, can the javascript access the django boolean? Is there a way for Django to make runtime changes like this (filter / unfilter checkbox or button)? How would I go about this task by refreshing the page when the user presses the checkbox or button, post data I am assuming but how would I have Django access that? In case it isn't obvious, I am relatively new to Django so a point in the right direction may suffice. I have Googled a bit for a solution but couldn't find anything, though it's possible I am just using the wrong terms. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Existing sites using Django
On Tuesday 13 July 2010 19:01:12 Adam Auckland wrote: > Hi, > > I've discussed using Django to my MD and he's asked for some example > large sites that were built using Django. > > Does anyone maintain or know of any neat URLs I can point him to to > see how great it is. I'm not looking for front-end features, rather > speed of page request or volume of data. http://bitbucket.org -- Regards Kenneth Gonsalves Senior Associate NRC-FOSS at AU-KBC -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.