many to many and different requests - Strange behavior?

2010-07-08 Thread zweb
I am seeing unexpected strange behaviour. I have two tables: student and study_class which have many to many relationship. 1. when user A (student a) logs in, in run time he does, student_a.study_classs = [class_physics] #in DB, this student does not have class_physics #does not Save. 2. U

Re: Is Django admin's "delete confirmation" considered RESTful?

2010-07-08 Thread Massimiliano della Rovere
I did not read the sources of the admin module devoted to deleting an item, but I think the problem is not in the admin interface but in html forms. Html forms allow only GET and POST, but no DELETE and PUT. Given the REST common-sense rule "whenever you POST, ask the user" the admin interface - a

Re: filtering admin data

2010-07-08 Thread derek
On Jul 4, 3:06 pm, djnubbio wrote: > hi all; sorry for wasting your preciouse tume. > > I'm trouble with the following: > > class A(models.Model): > . > . > . > > class B(models.Model): > . > . > . > a= models.ForeignKey(A) > > class C(models.Model): > . > . > . > b= models.ForeignKey(B) > > How c

Re: Easiest way to pass variables between modelforms (genericforms)

2010-07-08 Thread derek
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 sessi

Question about django admin customization

2010-07-08 Thread 玉东
Hi all, Now I am trying to do a simple admin customization: I have a model called 'host', and I have a corresponding admin class called hostAdmin and got registered. I put some fields of the 'host' model into the list_display of hostAdmin so that we can get it shown in the admin site. And it is

Re: Question about django admin customization

2010-07-08 Thread ankit rai
you just need to add one function in your models.py def somename(self): return "click here"%(self.id) somename.allow_tags = True somename.short_description = "My field" in you admin.py list_display=['somename',] i think t

Re: get_model()

2010-07-08 Thread euan.godd...@googlemail.com
I've never found any documentation. It's pretty useful if you're having import issues. On Jul 8, 7:25 am, Kenneth Gonsalves wrote: > hi, > > any reason why get_model() in django.db.models is not documented? Or is it > just that I cannot find it? > -- > Regards > Kenneth Gonsalves > Senior Associa

Re: Log errors to file

2010-07-08 Thread euan.godd...@googlemail.com
I have created a decorator for Django views which handles AJAX tracebacks and sends the traceback back to the AJAX application as JSON, e.g. {'status':'error', 'message': } It uses the traceback module to output the full traceback. Obviously you need to have a handler that receives this data and

Re: context porcessors request.context media_url breaks admin

2010-07-08 Thread justin jools
Thanks for that. I did read something about having to add services back in to the context processors. The reason I am doing this way is because I could not pass the {media url} with generic views. I did a search for trying to do this and hit a couple of posts saying it is not possible to use {media

Re: context porcessors request.context media_url breaks admin

2010-07-08 Thread Daniel Roseman
On Jul 8, 11:40 am, justin jools wrote: > Thanks for that. I did read something about having to add services > back in to the context processors. > The reason I am doing this way is because I could not pass the {media > url} with generic views. > I did a search for trying to do this and hit a coup

Re: get_model()

2010-07-08 Thread Russell Keith-Magee
> On Jul 8, 7:25 am, Kenneth Gonsalves wrote: >> >> any reason why get_model() in django.db.models is not documented? Or is it >> just that I cannot find it? No - it isn't documented. The app/model loading APIs are in the same category as _meta -- API that is fairly important for meta-programming

Re: context porcessors request.context media_url breaks admin

2010-07-08 Thread justin jools
Thank for your quick response Daniel. I'm just confused about using media_url with generic views, I have done it previously with: from django.conf import settings# for media_url media_url = settings.MEDIA_URL def dblist(request): obj_list_menu = dbModel1.objects.all() return rende

Re: Tutorial Help

2010-07-08 Thread David Ally
Hi, I need some help on part2 of the Django tutorial, I know python is particular about spaces and the fieldsets composition; Class PollAdmin(admin.ModelAdmin): fieldsets = [ (None, {'fields': ['question']}), ('Date information', {'fields': ['pub_date']}), ] admin.site.register(P

Django admin modelForms, not getting the add model plus sign

2010-07-08 Thread Dushyant
Hi I have a form being generated in admin with modelForms. Now what I want is that whenever there is a foreignkey field, there should be a add new model field sign next to it, as there is in the form generated using fieldset in admin. I was able to get the Date widget, but I am not able to get th

Re: context porcessors request.context media_url breaks admin

2010-07-08 Thread Daniel Roseman
On Jul 8, 12:57 pm, justin jools wrote: > Thank for your quick response Daniel. > I'm just confused about using media_url with generic views, I have > done it previously with: > > from django.conf import settings        # for media_url > media_url = settings.MEDIA_URL > > def dblist(request): >  

Re: Query raises a DoesNotExist error

2010-07-08 Thread Tom Evans
On Wed, Jul 7, 2010 at 6:22 PM, Nick wrote: > I am working on a form to resend an account activation email for newly > registered users who did not receive their first email. > > The form is currently raising a DoesNotExist error and I can't figure > out why: > > Here is the activation code: > > c

Re: context porcessors request.context media_url breaks admin

2010-07-08 Thread justin jools
The 2 methods of using media_url with generic views I have tried: 1. http://www.b-list.org/weblog/2006/jun/14/django-tips-template-context-processors/ This knocked out my admin, but media_url did work 2. using templatetags yourApp/templatetags/media_url.py: from django.template import Library f

Re: context porcessors request.context media_url breaks admin

2010-07-08 Thread justin jools
Wow... django docs can be so confusing... I could not believe it worked just by using upper case MEDIA_URL Thanks so much :) :) I spent a day trying figure this out... On 8 July, 13:14, Daniel Roseman wrote: > On Jul 8, 12:57 pm, justin jools wrote: > > > > > > > Thank for your quick response

Re: Tutorial Help

2010-07-08 Thread Karen Tracey
On Thu, Jul 8, 2010 at 3:09 AM, David Ally wrote: > > And the subsequent similar composition gave me syntax error, the traceback said something about "None", Please help me to get past this stage It will help people help you if you post the actual code you are trying to get to work (not something

Re: Tutorial Help

2010-07-08 Thread Venkatraman S
On Thu, Jul 8, 2010 at 12:39 PM, David Ally wrote: > Hi, > > I need some help on part2 of the Django tutorial, I know python is > particular about spaces and the fieldsets composition; > > Class PollAdmin(admin.ModelAdmin): > fieldsets = [ > (None, {'fields': ['question'

Re: www.djangoproject.com

2010-07-08 Thread eon
Same for me. The problem is in the firefox profile (maybe due to the switch from 3.5 to 3.6 ?) Start-up with a new profile (backport plugins, bookmarks argh...) resolves the issue On 5 juil, 20:52, Andi wrote: > On Jul 2, 10:44 pm, Bill Freeman wrote: > > > What might be of help is adding the I

Accessing settings from mysite from registration module

2010-07-08 Thread reduxdj
Hello Django helpers, So, I am using the django registration module, and I have it in it's own project, when I go to send an activation e-mail, apparently the settings are not configured properly to be found from other projects, and it can't load mysite variable - so it throws an error. >From the

Re: v1.2 message framework - messages created outside of the request cycle

2010-07-08 Thread Mick
I've encountered same issue. My solution is simple model and middleware: class OfflineNotification(models.Model): user = models.ForeignKey(User) message = models.TextField() level = models.PositiveSmallIntegerField(default=20) created = models.DateTimeField(auto_now_add=True) clas

Re: list display based on logged-in user

2010-07-08 Thread derek
On Jul 7, 11:40 pm, rahul jain wrote: > Hi there ! > > I would like to display model fields based on the logged-in user. > > If user is restricted user > > list_display = (field1, field2) > > else > > list_display = (field1, field2, field3, field4) > > How is it possible ? > Also see: http://stac

[Offtopic] Design introduction

2010-07-08 Thread Matias
Sorry for this completely offtopic question. I'm a systems administrator with programming experience (mostly python and C) and I love web applications design/programming and I'm pretty good with html, javascript, css, etc... but I have a really weak point when it comes to "images" desing. I me

Re: [Offtopic] Design introduction

2010-07-08 Thread Chris Czub
Much like programming, it will come from experience. Practice a lot. You'll make a lot of things you aren't happy with, probably like your first bits of code :) Try to imitate things you like, and see the techniques they use to create cool designs. It, like anything else worth doing, will be easier

Re: www.djangoproject.com

2010-07-08 Thread Nick Raptis
Hey, haven't read the whole thread but I spend a whole day last month troubleshooting something like this. In firefox, check your preffered language settings, in the content tab. If there is a non-standard value there (perhaps "/etc/locale/prefs.conf" or something) instead of a locale like en-

Re: www.djangoproject.com

2010-07-08 Thread Nick Raptis
Hey, haven't read the whole thread but I spend a whole day last month troubleshooting something like this. In firefox, check your preffered language settings, in the content tab. If there is a non-standard value there (perhaps "/etc/locale/prefs.conf" or something) instead of a locale like en-

Re: www.djangoproject.com

2010-07-08 Thread Andi
On Jul 8, 5:12 pm, Nick Raptis wrote: > If there is a non-standard value there (perhaps "/etc/locale/prefs.conf" > or something) instead of a locale like en-US, > some django pages won't ever display. That's it. You have to *remove* this non-standard value, it's not sufficient to add another loc

News on every page

2010-07-08 Thread Martin Tiršel
Hello, I am programming a small CMS on Django, I have editable pages, now I want to add news. I have a website where I want to display these news on every page in right/left column. I have following questions: 1.) Where is the right place to place news loader? TEMPLATE_CONTEXT_PROCESSORS

Re: News on every page

2010-07-08 Thread Andy McKay
On 2010-07-08, at 9:07 AM, Martin Tiršel wrote: > 1.) Where is the right place to place news loader? > TEMPLATE_CONTEXT_PROCESSORS seems to be a good place and easy to implement. > Another possibility is a middleware, I feel, that it should go there instead > of TEMPLATE_CONTEXT_PROCESSORS. Mi

Creating an admin for with a list of foreign key

2010-07-08 Thread glacasse
Hi, Let's say I create an entity named foo and an entity name bar. Bar has a ForeignKey relationship to Foo (in model.py). Now, I want to create many bars that are associated to a foo. Is it possible to create an admin form for foo that will allow to create many bar entities (which will be automat

Re: www.djangoproject.com

2010-07-08 Thread Nick Raptis
Sorry for the rant but I can finally express my delayed frustration on this bug.. I first I spent some 2-3 hours trying to find out if this problem came from a broken ipv6 configuration. Then, I actually had to delete all my profile files (delete half, find out if it solves it, restore, delete

FormWizard

2010-07-08 Thread rupert
Can you register a formwizard app in the admin tool for editing? -- 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+unsu

Re: Tutorial Help

2010-07-08 Thread david
Bradley, I think there's a typing error somewhere there, search for where you have pollsdjango within your script, you might have mistakenly join some text together. David On Jul 6, 4:56 pm, Bradley Hintze wrote: > Hi all, > > I am following the tutorial part 2 > (http://docs.djangoproject.com

Re: models.py import from other models.py

2010-07-08 Thread Nuno Maltez
What error do you get when you execute 'manage.py syncDB'? Could you paste it here? Nuno On Thu, Jul 8, 2010 at 2:28 AM, yugori wrote: > Hi, I'm beginner. > > I tried to execute 'manage.py syncDB' command, > but it's not work. -- You received this message because you are subscribed to the Goo

Overwhelmed by File upload instructions

2010-07-08 Thread Rodion Raskolnikiv
Good morning! I have been wanting to design a model (to be administered via the admin area) which would allow for file uploads. I have not been able to grasp a singular, simple approach to this. Perhaps things are complicated by Django's preference for serving media files under a different domain,

Maintain separate i18n translation (.po) for different applications

2010-07-08 Thread Behrooz Nobakht
Hi, Consider the following sample: mysite --app1 locale --app2 locale --locale What I need is to be able to maintain different translation files for each application I have in the site, and finally use makemessages and compilesmessages to merge them together as the django.po/mo translati

Database caching and multi db

2010-07-08 Thread tiemonster
It seems that when running unit tests, the test runner not only creates all tables on both of my connections (which it should not do, if I read the documentation correctly), but also tries to create the cache table twice, causing the error below. Please let me know if I'm missing something here. I

Is Django right for what I am trying to do

2010-07-08 Thread Bradley Hintze
Hi all I did the tutorial and I've spent the last two days in the documentation trying, and failing, to figure out how to tie my model to a view and ultimately a template that is served. The documentation seems to do a lot of things (like write html) automatically which is not what I want (see htt

Re: context porcessors request.context media_url breaks admin

2010-07-08 Thread Rolando Espinoza La Fuente
On Thu, Jul 8, 2010 at 8:21 AM, justin jools wrote: > Wow... django docs can be so confusing... > > I could not believe it worked just by using upper case MEDIA_URL {{ MEDIA_URL }} is already present in the templates because the django.core.context_processors.media context processor which is ena

PostgreSQL 7.4/8.0/8.1 EOL

2010-07-08 Thread Joshua D. Drake
Hello, I wanted to let the Django community know that PostgreSQL has stated an EOL (End of Life) for PostgreSQL versions 7.4, 8.0, and 8.1. If you are running any version of PostgreSQL 7.4, 8.0 or 8.1, it is time to upgrade to 8.3 or 8.4. The versions 7.4 and 8.0 are slated for end of life at the

Re: Overwhelmed by File upload instructions

2010-07-08 Thread Rodion Raskolnikiv
To be more specific, here is what I have tried: # in models.py from django import forms class UploadFileForm(forms.Form): title = forms.CharField(max_length=50) file = forms.FileField() # in admin.py from proj.app.models import UploadFileForm admin.site.register(UploadFileForm) Which

Re: No module named site - error deploying a django-jython war in tomcat

2010-07-08 Thread Rafael Nunes
Same problem here. Any thoughts? On Jun 29, 10:50 am, tobycatlin wrote: > Hello everybody, > > I have followed the install instructions for the latest versions of > the following: jython (version: jython-2.5.2b1), django (1.2.1) and > jython-django (version 1.1.1) and have built a war of my very

Bank Street College is looking for a Senior Agile Web Developer

2010-07-08 Thread Michael
Contact Christina or Arshad: cdaie...@bankstreet.edu, aah...@bankstreet.edu Location: New York City, NY Bank Street is a small college with a big voice in education, one heard and respected far and wide. Bank Street was founded in 1916 in New York City by visionary educator Lucy Sprague Mitchell.

reportlab pdf creation: HTML textarea input formatting doesn't seem to work with Paragraph

2010-07-08 Thread thusjanthan
Hi, I have a user that enters some formatted text in a html textarea. I would like to use reportlab to display that and other fields in a PDF. However when I wrap the text in a Paragraph type it alters the formatting. Can anyone suggest how to keep the formatting that the user enters into the text

Re: list display based on logged-in user

2010-07-08 Thread rahul jain
I am not sure what I am doing wrong but this should work class TestAdmin(admin.ModelAdmin): list_display = (field1, field2, field3, fileld4, field5,field6) class CustomTestAdmin(TestAdmin): custom_list_display = (field1, field2, field3) # showing less number of fields

Re: Database caching and multi db

2010-07-08 Thread tiemonster
I was able to fix the issue using the TEST_MIRROR database setting (http://docs.djangoproject.com/en/1.2/topics/testing/#testing-master- slave-configurations). While this relationship isn't exactly master- slave in our situation, the datastore connection is indeed read-only. Using this setting allo

Re: reportlab pdf creation: HTML textarea input formatting doesn't seem to work with Paragraph

2010-07-08 Thread thusjanthan
Basically what I am doing right now as a workaround is I wrote a function to parse/wrap the value before printing it out. Anyone else have a better solution please do let me know. def preformat_html_textarea(value,endwidth=135): ''' since reportlab doesn't provide a way to keep the of what ev

Re: Overwhelmed by File upload instructions

2010-07-08 Thread Daniel Roseman
On Jul 8, 7:25 pm, Rodion Raskolnikiv wrote: > To be more specific, here is what I have tried: > > # in models.py > from django import forms > > class UploadFileForm(forms.Form): >     title = forms.CharField(max_length=50) >     file  = forms.FileField() > > # in admin.py > from proj.app.models i

Re: Overwhelmed by File upload instructions

2010-07-08 Thread Rodion Raskolnikiv
I was totally on the wrong trail! Hopefully this post can serve others who were in my dilemma: If you are looking to have a file as part of your model definition, look here: http://docs.djangoproject.com/en/dev/topics/files/ Looking in these locations did not supply what I was after: http://doc

Re: Overwhelmed by File upload instructions

2010-07-08 Thread Daniel Roseman
On Jul 8, 6:28 pm, Rodion Raskolnikiv wrote: > Good morning! > I have been wanting to design a model (to be administered via the > admin area) which would allow for file uploads. I have not been able > to grasp a singular, simple approach to this. Perhaps things are > complicated by Django's prefe

translation for variables

2010-07-08 Thread Börni
Hello together, i'm using the trans tpl tag for translation a value from database. If i'm adding this value to my django.po file and run makemessages afterwards, my changes got lost. I wonder how it's possible to handle such situations? Thank you very much, Börni -- You received this message be

Re: Is Django right for what I am trying to do

2010-07-08 Thread Daniel Roseman
On Jul 8, 6:43 pm, Bradley Hintze wrote: > Hi all > > I did the tutorial and I've spent the last two days in the > documentation trying, and failing, to figure out how to tie my model > to a view and ultimately a template that is served. The documentation > seems to do a lot of things (like write

Django X Media Temple (dedicated Virtual Server) How To?

2010-07-08 Thread heru
Hi, I just got access to my DVS through Media Temple and I am lost as to how to configure the database in django based on Media Temple's plesk-8 interface. Note, I am first time user of Django. Thank You! -- You received this message because you are subscribed to the Google Groups "Django users

Re: Maintain separate i18n translation (.po) for different applications

2010-07-08 Thread Baurzhan Ismagulov
On Thu, Jul 08, 2010 at 10:39:25AM -0700, Behrooz Nobakht wrote: > I am not an expert in Django/Python, so what I have at the moment is > only mysite/locale/xx/django.po for both app1 and app2. But, actually > I need to separately have mysite/app1/locale/xx/app1.po and mysite/ > app2/locale/xx/app2

Re: Is Django right for what I am trying to do

2010-07-08 Thread Bradley Hintze
I guess I just don't like the model.py, views.py, templates, and url.py. In the tutorial you have to edit all of these and THEN you get something that you can send to the client. It's very confusing! How do they tie together? I probably need to do the tutorial again. It seems to me getting info fro

Re: Get pk before commit

2010-07-08 Thread TheIvIaxx
Lets say for a model i have the following: class Image(models.Model): image = models.ImageField() >>> image = Image() >>> # Somehow get ID >>> destination = open('ID/name.jpg', 'wb+') >>> for chunk in f.chunks(): ...destination.write(chunk) >>> destination.close() >>> image.image = "I

Re: Is Django right for what I am trying to do

2010-07-08 Thread CLIFFORD ILKAY
On 07/08/2010 05:23 PM, Bradley Hintze wrote: I guess I just don't like the model.py, views.py, templates, and url.py. In the tutorial you have to edit all of these and THEN you get something that you can send to the client. It's very confusing! How do they tie together? I probably need to do the

Re: Overwhelmed by File upload instructions

2010-07-08 Thread Rodion Raskolnikiv
Soo easy... Thanks for the tips! I knew that there had to be a simple solution!! On Jul 8, 2:02 pm, Daniel Roseman wrote: > On Jul 8, 6:28 pm, Rodion Raskolnikiv wrote: > > > > > > > Good morning! > > I have been wanting to design a model (to be administered via the > > admin area) which would a

Re: Is Django right for what I am trying to do

2010-07-08 Thread Bradley Hintze
Thanks, that helps but I wish Django had more tutorial than one. I seem to learn by example. I am trying to make an form for uploading files but no matter how many times I read the documentation I cant seem to get the form to the client, let alone how to store the file. Do you know how to get objec

Re: News on every page

2010-07-08 Thread Antoni Aloy
I would use a custom template tag with cache El 08/07/2010 18:17, "Andy McKay" escribió: On 2010-07-08, at 9:07 AM, Martin Tiršel wrote: > 1.) Where is the right place to place news loader?... Middleware is not the appropriate place, a context processor is the appropriate place. -- Andy McKay,

Re: Is Django right for what I am trying to do

2010-07-08 Thread larsendt
Check out djangobook.com. It's a much longer tutorial, and really well written. On Jul 8, 4:07 pm, Bradley Hintze wrote: > Thanks, that helps but I wish Django had more tutorial than one. I > seem to learn by example. I am trying to make an form for uploading > files but no matter how many times

Re: Is Django right for what I am trying to do

2010-07-08 Thread Bradley Hintze
Thanks man!! On Thu, Jul 8, 2010 at 6:11 PM, larsendt wrote: > Check out djangobook.com. It's a much longer tutorial, and really well > written. > > On Jul 8, 4:07 pm, Bradley Hintze wrote: >> Thanks, that helps but I wish Django had more tutorial than one. I >> seem to learn by example. I am tr

Re: Is Django right for what I am trying to do

2010-07-08 Thread Rolando Espinoza La Fuente
On Thu, Jul 8, 2010 at 5:23 PM, Bradley Hintze wrote: > I guess I just don't like the model.py, views.py, templates, and > url.py. In the tutorial you have to edit all of these and THEN you get > something that you can send to the client. It's very confusing! How do > they tie together? I probably

Re: Is Django right for what I am trying to do

2010-07-08 Thread CLIFFORD ILKAY
On 07/08/2010 06:07 PM, Bradley Hintze wrote: Thanks, that helps but I wish Django had more tutorial than one. There is no shortage of Django tutorials and screencasts. Just Google for them. Showmedo.com, Vimeo, Blip.tv, and YouTube all have Django resources. -- Regards, Clifford Ilkay Dina

Re: Django developer opening

2010-07-08 Thread j
What exactly didn't you like about the add? On Jul 6, 6:55 pm, reduxdj wrote: > ew, u lost me at "The visuzlation"... sorry, lame ad. > > On Jul 6, 8:22 pm, j wrote: > > > The Visualization & Reporting Engineer will contribute to the design > > and implementation of Silver Peak’s dynamic report

Re: Is Django right for what I am trying to do

2010-07-08 Thread Martin Tiršel
On Thu, 08 Jul 2010 23:23:53 +0200, Bradley Hintze wrote: I guess I just don't like the model.py, views.py, templates, and url.py. In the tutorial you have to edit all of these and THEN you get something that you can send to the client. It's very confusing! How do they tie together? I probabl

default is_active to true on new users

2010-07-08 Thread Jacob Fenwick
I'm looking for a way to automatically set is_active to true for new users that are added through the admin interface. I tried to subclass the User class and set the is_active default to true but apparently you can't override fields in a parent model: http://docs.djangoproject.com/en/1.2/topics/db

Ignoring fields in deserialization

2010-07-08 Thread lfrodrigues
Hello, I had some copies of a model with 10 fields serialized in a file. I deleted some of the fields (since I don't need them anymore) now I can't deserialize the model. error: raise FieldDoesNotExist, '%s has no field named %r' % (self.object_name, name) Any help, please. Luis -- You recei

Re: Django developer opening

2010-07-08 Thread Kenneth Gonsalves
On Friday 09 July 2010 03:59:50 j wrote: > What exactly didn't you like about the add? > maybe it sounds very corporate and enterprisy - which puts off a lot of people -- Regards Kenneth Gonsalves Senior Associate NRC-FOSS at AU-KBC -- You received this message because you are subscribed to th

Re: Get pk before commit

2010-07-08 Thread Kenneth Gonsalves
On Friday 09 July 2010 03:16:28 TheIvIaxx wrote: > I'd like to save the image file into a folder based on the ID of the > new instance. The only thing i can think of is to create the new > folder mid transaction. I guess another way to do it would be to save > a new instance with a temp file or s

Re: default is_active to true on new users

2010-07-08 Thread Jacob Fenwick
So one method I found is to use the custom validation from a form in the ModelAdmin: http://docs.djangoproject.com/en/1.2/ref/contrib/admin/#adding-custom-validation-to-the-admin However, this only seems to work on edits, not on adds. How can I make this work on adds? Jacob On Thu, Jul 8, 2010

Re: News on every page

2010-07-08 Thread Kenneth Gonsalves
On Thursday 08 July 2010 21:37:58 Martin Tiršel wrote: > I am programming a small CMS on Django, I have editable pages, now I want > to add news. I have a website where I want to display these news on every > page in right/left column. I have following questions: > > 1.) Where is the right pla

Re: default is_active to true on new users

2010-07-08 Thread Jacob Fenwick
I tried something like this: *models.py class MyUser(User): pass *admin.py class MyUserAdminForm(forms.ModelForm): is_staff = models.BooleanField(_('staff status'), default=True, help_text=_("Test.")) class Meta: model = User class MyUserAdmin(UserAdmin): form = Publishe

Re: get_model()

2010-07-08 Thread Kenneth Gonsalves
On Thursday 08 July 2010 17:11:35 Russell Keith-Magee wrote: > get_model() et al are intended utilities for metaprogramming -- for > example, if you want to build an interface that can knows about other > models in the project, get_model() and friends are the tools you use. > thanks - a relief to

Re: PostgreSQL 7.4/8.0/8.1 EOL

2010-07-08 Thread Russell Keith-Magee
On Fri, Jul 9, 2010 at 1:56 AM, Joshua D. Drake wrote: > Hello, > > I wanted to let the Django community know that PostgreSQL has stated an > EOL (End of Life) for PostgreSQL versions 7.4, 8.0, and 8.1. > > If you are running any version of PostgreSQL 7.4, 8.0 or 8.1, it is time > to upgrade to 8.

Re: Ignoring fields in deserialization

2010-07-08 Thread Russell Keith-Magee
On Fri, Jul 9, 2010 at 6:50 AM, lfrodrigues wrote: > Hello, > > I had some copies of a model with 10 fields serialized in a file. > > I deleted some of the fields (since I don't need them anymore) now I > can't deserialize the model. > > error: raise FieldDoesNotExist, '%s has no field named %r' %

How can I Insert multiple records in one statement

2010-07-08 Thread Sells, Fred
I know how to do this in raw MySQLdb and have been trying to find a way to do it with the Django models but with no success. Can it be done and if so, can someone point me to a link in the docs please? Everything looks so elegant with the models, I hate to drop into SQL if I don't have to. -- Y

Re: How can I Insert multiple records in one statement

2010-07-08 Thread Kenneth Gonsalves
On Friday 09 July 2010 06:03:09 Sells, Fred wrote: > I know how to do this in raw MySQLdb and have been trying to find a way > to do it with the Django models but with no success. > how do you do it in MySQLdb? What exactly do you mean by 'insert multiple records in one statement'? -- Regards K

Re: list display based on logged-in user

2010-07-08 Thread rahul jain
anyone on this ? On Thu, Jul 8, 2010 at 11:56 AM, rahul jain wrote: > I am not sure what I am doing wrong but this should work > > class TestAdmin(admin.ModelAdmin): > >        list_display = (field1, field2, field3, fileld4, field5,field6) > > > class CustomTestAdmin(TestAdmin): > >        custo

Re: models.py import from other models.py

2010-07-08 Thread yugori
This problem is resolved. What I did is 1.comment out "models.ManyToManyField" line and execute "manage.py syncDB". 2.Back to code "models.ManyToManyField" line and execute "manage.py evolve --hint --execute" Then appli_master table was auto-generated. I don't know why this way goes right. But,

Error in Admin - can't seem to chain __unicode__'s for ForeignKeys

2010-07-08 Thread Victor Hooi
heya, I have a small Django app that contains a list of Df (disk-free) reports. "DfReport" has a ForeignKey to "Filesystem" model, which has a ForeignKey to "Device". (i.e. Devices has filesystems, each filesystem has a DfReport). I'm getting an error in the admin when I attempt to display the l

RE: How can I Insert multiple records in one statement

2010-07-08 Thread Sells, Fred
In MySQLdb you do something similar to Records = [ (1,2,3), (4,5,6), (7,8,9) , (11,22,33) ] cursor.execute('insert to mytable (a,b,c) VALUES (%s, %s, %s)', Records) #untested. This would insrt 4 rows -Original Message- From: django-users@googlegroups.com [mailto:django-us...@googlegrou

Passing argument to Template loader

2010-07-08 Thread zenWeasel
I have what I think is a common issue, but I have not seen a good solution. I have tried various workarounds and got nowhere. So, here what I would like to do and the problem I run into. I want to have a template loader that looks for templates based upon a user's current "site_profile", which is

Re: v1.2 message framework - messages created outside of the request cycle

2010-07-08 Thread jyunis
Thanks, Mick. This will work well and I think is the "right" way to go about this. On Jul 8, 8:32 am, Mick wrote: > I've encountered same issue. My solution is simple model and > middleware: > > class OfflineNotification(models.Model): >     user = models.ForeignKey(User) >     message = models.T

Re: News on every page

2010-07-08 Thread Venkatraman S
On Fri, Jul 9, 2010 at 3:40 AM, Antoni Aloy wrote: > I would use a custom template tag with cache > I was planning to recommend the same, but i wasnt sure whether this is efficient when compared with context-processor solution. I had used template tags for a similar requirement for one of my clie

Calling remote API

2010-07-08 Thread james_027
hi all, It will be my first time to create django app that requires calling remote API. As far as I know django has no built in support for this. I only way I know is URLLIB2, any good library for this purpose, which easily send your request as get this parameters and also easily parse the return r

Re: How can I Insert multiple records in one statement

2010-07-08 Thread Kenneth Gonsalves
On Friday 09 July 2010 07:18:30 Sells, Fred wrote: > In MySQLdb you do something similar to > > Records = [ (1,2,3), (4,5,6), (7,8,9) , (11,22,33) ] > > cursor.execute('insert to mytable (a,b,c) VALUES (%s, %s, %s)', Records) > #untested. > > This would insrt 4 rows > it is two statements ;-)

Booleans not being set in admin

2010-07-08 Thread Lee Hinde
I have a model, Store: class Store(models.Model): """ Store is use to link users and to provide a target for the weather report. """ name = models.CharField(max_length=50, help_text="Simple Identifier for Store -") zip_code = models.CharField(max_length=20,help_text = "Used to

How to commit ManyToManyField with ModelForm

2010-07-08 Thread yugori
Hi, I'm beginner of Django&Py. Now I try to make Product Management Tool with Django. So I wrote some code. models.py //--- from django import forms from django.db import models # ex('ie8','InternetExplorer8') class Browser(models.Model): id=model.CharField('id',primary_key=True) name=model.C

Re: Passing argument to Template loader

2010-07-08 Thread euan.godd...@googlemail.com
I'm not sure I understand exactly what the problem is. The post you cite seems to have the exact solution you are looking for. I appreciate that you don't want to violate DRY, but pretty much every Django view I've written ends with render_to_response. In your situation you just give the "templates

Re: Error in Admin - can't seem to chain __unicode__'s for ForeignKeys

2010-07-08 Thread euan.godd...@googlemail.com
I think the problem you're facing is that you're trying to concatenate a string and an object together. Before I dive into the explanation, you might want to bear a couple of things in mind: 1) Your unicode method doesn't explicitly return a unicode object which will be a problem if any of the var