Re: any open source complete django app to use as start
Might as well pile on with Satchmo: http://www.satchmoproject.com -Chris On Mon, Oct 12, 2009 at 10:52 AM, Ben Rousch <brou...@gmail.com> wrote: > > On Mon, Oct 12, 2009 at 11:50 AM, Daniel Hilton <daniel.hil...@gmail.com> > wrote: > > > > 2009/10/12 shreko <shreku...@gmail.com>: > >> > >> I've been looking all day yesterday to find a complete django open > >> source project that is non trivial. Using it as a base for my app > >> would greatly speed up my learning and give me a fast start. To give > >> you an example, for kohana framework in php you can find > >> http://www.argentuminvoice.com/ as a full app. I would think that > >> Django has been out long enough that these apps would exist. If you > >> know of any, could you please let me know? > > > > You might take a look at Pinax: http://pinaxproject.com/ > > > -- > Ben Rousch > brou...@gmail.com > http://ishmilok.blogspot.com/ > http://tech-ishmilok.blogspot.com/ > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Current Django tests fail?
Tim Chase wrote: > Is there something obvious I missed? Hi Tim, I do wonder if you might get more help with these problems on the Django developers list? cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
FlatPage.objects.filter method: content_icontains attribute does not exist
Hello, I am trying to work my way through Practical Django Projects (a book by James Bennett 1st edition 2008). I'm on chapter 3 page 28 where a search function is being added to the 'cms' project. The results=FlatPage.objects.filter(content_icontains=query) does not work; it looks like the content_icontains attribute isn't recognize by the 'filter' method. I've tried looking through the django api but don't understand how it's set up. What is the fix required here? Chris --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: newbie , need some help
danin wrote: > I am just learning django from last 2 weeks. while learning i get > confused in validation. Can anyone plese provide me reference to some > material so that i can read and underatand it from ther. http://lmgtfy.com/?q=django+validation How about getting and reading the Django book while you're at it? ;-) Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
required fields during object instantiation
Hi All, Assuming this model: class Month(models.Model): month = models.DateField( db_index=True, verbose_name='Month' ) def __unicode__(self): return unicode(self.month.strftime('%B %Y')) Now, I could have sworn this used to throw an error if I did: m = Month() ...because I haven't supplied a required field. But it no longer seems to do so until .save() is called. Am I imagining things? This behaviour is suboptimal, here's an example why using the above model: >>> Month() Traceback (most recent call last): File "models.py", line 65, in __unicode__ return unicode(self.month.strftime('%B %Y')) AttributeError: 'NoneType' object has no attribute 'strftime' :-( Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Templating wart
british.assassin wrote: > You could do this: > > > {% for cell in row %} > > {% if forloop.first and row.url %}{{cell}} > {% else %} > {{cell}} > {% endif %} Then you're violating DRY on {{cell}}, which of course may be a lot mroe complicated than {{cell}}... cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: problems subclassing models
Daniel Roseman wrote: > If your base model doesn't contain any fields, you should probably > mark it as abstract. > http://docs.djangoproject.com/en/dev/topics/db/models/#id6 Thanks, knew there'd be some magic I needed to invoke ;-) Chris --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: efficiently deleting content based on how old it is
Streamweaver wrote: > You could set this up as a custom manage.py command and run a cron on > that. Gives the advantage of both initiating from outside the app and > using Django's DB abstraction layer. That's prettymuch what I was planning to do :-) > Then just iterate over the month names more than 6 back from the > current position and delete the records. I'm keen to use "real dates" as Tim suggested. Perhaps just using the 1st day in each month as the "month"? Chris --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Templating wart
Hi All, I have a piece of template that looks like this: > >{% for cell in row %} > >{% if forloop.first and row.url %}{% endif %} >{{cell}} >{% if forloop.first and row.url %}{% endif %} > >{% endfor %} > How can I structure this such that I don't have to repeat the condition? DRY and all that... Chris --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
problems subclassing models
Hi All, I have a set of models that all have the same implementation for a method, so I thought I'd create a base class for these: class UrlModel(models.Model): def get_absolute_url(self): return reverse(index,kwargs=dict(fk=self.pk)) ...and then have the relevant models subclass that. However, as soon as I did this, I started getting bizarre SQL errors, things like: ProgrammingError at /some/path relation "myapp_urlmodel" does not exist LINE 1: ...somefield1"."somefield2" FROM "myapp_modelname" INNER JOIN "myapp_urlm... Why is this? Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: efficiently deleting content based on how old it is
Tim Chase wrote: > I wouldn't try to do it from within the web app itself -- > I'd schedule some wee-hours cron job to do the deletion. I plan to, don't worry ;-) But, I would like to do it from within the Django environment to make it immune to changes of database... > 6mo boundary. Your Month is defined as a string, and I > don't see any actual date information in it. Yeah, an unfortunate artifact of the legacy system I'm replacing. Months are of the form "September 2009", "August 2009", etc. How would you represent those in a Django ORM sensible way? > In all, I'd just skip Django completely and do something > like create a quick shell-script to execute the raw SQL and > schedule it to run monthly You guessed right about the database, but that's a luxury I don't have. The database used may change, so I'd like to do this through the Django ORM. Does the Django ORM have a sql abstraction layer like sqlalchemy where I can do the kind of thing you're proposing, or do I need to work with models? cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: iphone to website
grant neale wrote: > Does anyone have a hint on where I should start, re: making the > website ready to receive this information? Doesn't the iPhone have a web browser? Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
efficiently deleting content based on how old it is
Hi All, I have a set of models structured roughly as follows: class Month(models.Model): monthname = models.CharField( max_length=14, db_index=True, verbose_name='Month' ) ... class Service(models.Model): month = models.ForeignKey(Month) service = models.CharField( max_length=255, db_index=True, ) ... class Page(models.Model): service = models.ForeignKey(Service) ... I only want to keep 6 months worth of data. How can I efficiently delete a month and all it's associated services and those services associated pages? (in this app, there could be about 3 million pages that are associated with each month though a bunch of service objects) cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
bulk import limits?
Hi All, I need to import data from a legacy app (non-relational database). I was planning to do an xml dump from the old app (which is now done and working) but turns out that the app has rather more data in it than I realised ;-) I need to import about 40 million rows into one table. I take it I'll need to chunk the data up into reasonable-sized xml files. My questions is: what limits the size of the xml file that can be imported with djangoadmin's loaddata command? What would people recommend as a maximum size of xml file to use with this command? cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Switching from MySQL to PostgreSQL
We've been running our Django app with mod_python and Apache to serve static files, along with MySQL as the database of choice. We're in the process of making a few changes because we've had some stability and performance issues, so we're moving to mod_wsgi/nginx, but we also want to switch from MySQL to PostgreSQL. Is there an easy way for us to take all of our data from our MySQL and move it over to PostgreSQL? Chris --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Is Django thread safe?
Torsten Bronger wrote: >> Why are you asking? > > Can it be safely used with Apache's Worker MPM? I guess that would depend on a lot of things, not least of all whether you use mod_python or mod_wsgi to deploy. Certainly if it's the latter, you're likely to get better help on the mod_wsgi list: http://googlegroups.com/group/modwsgi Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: developing and deploying django with zc.buildout
andreas schmid wrote: > then i wanted to try my apps which i have on my subversion repository > and i added a [site-packages] section to the buildout.cfg using Why not turn your apps into python packages and serve them from a private egg server? > to the [django] section. now i have my project in my buildout directory > under parts/site-packages/myapp > > if i add the app to the projects INSTALLED_APPS and run ./bin/django > syncdb it doesnt create my apps tables but it gives no error. if i run > ./bin/django shell i can import my apps module... so... where is the error? > > can anyone help me to understand why this doesnt work? what am i missing? I'd suggest inserting print statements or some such in your app code's __init__.py to see if it's being imported. Also have a look through the contents of the bin/django script to see if your code is really ending up on the python path. cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Is Django thread safe?
Pythoni wrote: > Is Django thread safe?If so, from which version? > Thanks for reply The answer is most likely "no, but it doesn't matter". Why are you asking? Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: is this a sane way to show total number of objects in pagination?
Jani Tiainen wrote: > Chris Withers kirjoitti: >> Brian McKeever wrote: >>> .count is definitely the way to go. Although, I would probably pass it >>> to your template instead of determining it there. >> What difference does it make? > > len(qs) evaluates queryset - thus pulling in _every_ object from DB to > Python - which you might not want specially if queryset is large. > > .count() executes count query on DB side returing only single scalar > value to Python. > > Figure out which one is faster... Er, I was asking what the difference was between calling .count in the view and in the template. I can't think why it would make a difference, but Brian suggested it did... Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: re-using field definitions
Ethan Jucovy wrote: > What happens if you wrap the definition in a function? > {{{ > def signins(): return models.IntegerField(...) > > class User(models.Model): > name = models.IntegerField(...) > signins = signins() > }}} Yeah, this is sort of what I ended up with: from django.db import models from functools import partial signins = partial(models.IntegerField, default=0, db_index=True, verbose_name='Total Signins' ) class User(models.Model): name = models.CharField( max_length=50, primary_key=True, verbose_name='Username' ) signins = signins() class Month(models.Model): user = models.ForeignKey(User) monthname = models.CharField( max_length=14, db_index=True, verbose_name='Month' ) signins = signins() Partials rock :-) (I could also set all the common bits in the partial and only have the bits that are different in the field definition - DRY to the max :-P) Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: is this a sane way to show total number of objects in pagination?
Brian McKeever wrote: > .count is definitely the way to go. Although, I would probably pass it > to your template instead of determining it there. What difference does it make? Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: is this a sane way to show total number of objects in pagination?
Chris Withers wrote: > objects = model.objects.all() > paginator = Paginator(objects,10) > return render_to_response( > 'index.html',dict( > objects = paginator.page(page), > total_objects = len(objects), > ) > ) I'm guessing the correct answer is not to pass total_objects at all but just to use {{objects.paginator.count}} in my template? cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
is this a sane way to show total number of objects in pagination?
Hi All, I have the following in a view: objects = model.objects.all() paginator = Paginator(objects,10) return render_to_response( 'index.html',dict( objects = paginator.page(page), total_objects = len(objects), ) ) Is that the best way to get the total number of objects returned or is there a way I can do that which means the database does as little work as possible? cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: equivalent of getattr in a django template
Daniel Roseman wrote: > It's an intentional limitation of the template language that you can't > do that. You'll need to write a custom tag or filter - luckily it can > be done very trivially as a filter: > > @register.filter > def get_attr(obj, val) > return getattr(obj, val) > > Now in the template: > > {{ object|getattr:name }} I agree that it doesn't belong in the template language, but it's surprising that there's no standard filter to do this... Is there an open issue for this or should I raise one? Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: equivalent of getattr in a django template
Maksymus007 wrote: > {{object.name}} ? no, that is the equivalent of: getattr(object,'name') I want: getattr(object,name) Subtle, but rather important, difference... Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
equivalent of getattr in a django template
Hi All, I have this view function: def index(request,model,pk=None): return list_detail.object_list( request, queryset=model.objects.all(), paginate_by=10, template_name='index.html', extra_context=dict( column_titles = [f.name for f in model._meta.fields], ) ) Where index.html is: {% for title in column_titles %} {{title}} {% endfor %} {% for object in object_list %} {% for name in column_titles %} {{*what goes here*}} {% endfor %} {% endfor %} What do I put in the marked spot to be the equivalent of getattr(object,name)? cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
serialization formats?
Hi All, Where can I find docs on the actual serialisation formats used by Django's serialisation support? http://docs.djangoproject.com/en/dev/topics/serialization/#id1 ...lists them, but doesn't actually describe them :-S cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
specifying test-only dependencies with djangorecipe
Hi Jeroen, I use two libraries a lot of the time when I'm testing: http://pypi.python.org/pypi/testfixtures http://pypi.python.org/pypi/mock However, I only use these in testing and don't really want them deployed for bin/django, only for bin/test. How would I go about doing this? cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
composite primary keys?
Hi All, Is it really the case that the Django ORM doesn't support composite primary keys? I'm looking to do the equivalent of the following sqlalchemy model: Base = declarative_base(...) class Month(Base): __tablename__ = 'months' username = Column( String,ForeignKey('users.name'),primary_key=True ) monthname = Column(String,primary_key=True,index=True) signins = Column(Integer,index=True) signouts = Column(Integer,index=True) total_pages = Column(Integer,index=True) last_viewed = Column(DateTime,index=True) cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
IndexError: list index out of range
I am trying to write to CSV, I was able to do so before, not sure what the problem is... When my query returns results, I get this error http://dpaste.com/96399/ Here's my view http://dpaste.com/96398/ If the query is empty it opens the CSV with only the header row... What am I doing wrong? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Editable sitemap priority
I'm curious if anyone has done any work in making certain aspects of the sitemap framework editable via the admin. For instance, someone might want their marketing folks to tweak the various priorities or changrefreq's of specific urls. I know it can be done by editing code and subclassing Sitemap but it's not easy for a non-technical person to maintain this going forward. Before I go down the path of creating this, I thought I'd reach out to the group and see if anyone has already solved this problem. Or, if you haven't solved it but have a great idea about how you would, I'd be interested in learning. Thanks for any input, Chris --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: djangorecipe questions
James Bennett wrote: > On Thu, Sep 17, 2009 at 6:01 AM, Chris Withers <ch...@simplistix.co.uk> wrote: >> All of your problems seem to center on zipped eggs. These are evil >> things anyway, and can be avoided by simply putting zip_safe=False as a >> parameter to setuptools (whether it actually comes from setuptools, or >> if it comes from the maintained fork, distribute). Buildout event has a >> config options to say "I don't care whether the egg thinks it's zip safe >> or not, unzip it!" ;-) > > They are indeed evil, and what's more evil is the fact that opting out > of setuptools' overzealous zip behavior... requires you to switch to > using setuptools and buy into its way of doing things. I don't follow this, but then maybe that's 'cos I use buildout and never setuptools directly. Still, I know that this has been solved by flipping the default for zip_safe to False in distribute. "What's distribute?" I hear you ask. Well, enough people got fed up with Phil Eby's stubborn refusal to either do any maintenance of setuptools, or let anyone else do any, and so they forked it. Primarily led by Tarek Ziadé, it provides a setuptools package but in a distribution named "distribute" (yes, the name sucks, yes I complained about this, yes I was shouted down). I'm not 100% on the "future" of distribute, but the 0.6 release branch promises to be 100% backwards compatible with setuptools, and seems to achieve this pretty well. Tarek is responsive to bug reports and is also doing a lot of work surrounding packaging in the python core... > perhaps it is paranoia, but it's *justified* paranoia: I don't trust > setuptools as far as I can throw it, and I can't understand why anyone > else does. Well, virtualenv and buildout both use setuptools, and a *lot* of packages use it, so it's not all bad, promise ;-) It's currently, and will be for the forseable future, the *only* way to specify what packages your package depends on. Specifying dependencies is a good thing. Packaging things as python packages is a good thing. Using good tools to package project setups (buildout or virtualenv, whichever fits your brain) are good things. I hope you won't argue with any of those three ;-) > When I need that I use pip with requirements files, and I'm already > doing everything in virtualenv :) I don't know anything about pip and precious little about virtualenv, but this strikes me as having to worry about making sure you haven't forgotten some dependency of one of your project's dependencies. What if your project has different dependencies depending on what python version and/or platform it's deployed on? cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: where to put tests?
Javier Guerra wrote: > reasonable-sized apps aren't too big; reasonably-factored projects > have lots of apps > > but, yeah, you're right that using a 'test' directory with an empty > __ini__.py and the tests files inside that should work... Nope, only finds them if you have a suite() function in the __init__ of your tests that returns all yours tests, which is a little bit limiting compared to other python test runners... Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
where to put tests?
Hi All, Will the Django testrunner really only find tests in a file called test.py? It strikes me that if a reasonable-sized app is fully tested, that tests.py is going to be unpleasantly long. How come the testrunner doesn't look for a package called tests like most of the other python testing frameworks? cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: djangorecipe questions
James Bennett wrote: > On Thu, Sep 17, 2009 at 5:23 AM, Chris Withers <ch...@simplistix.co.uk> wrote: >> Well, I'm certainly not setuptools-happy, but Django appears to be >> wrapped up as a standard distribution on PyPI (sorry, should have said >> distro, not egg), so it would make sense to use that... > > Putting on my release-manager hat for a moment, I'll note that we > currently *only* provide a source package and not an egg, and that's > likely to remain the case for the foreseeable future, because Django > is flat-out not zip-safe and probably never will be. zip-safe != egg. Using zipped eggs is something I hate and tell buildout not to do. That said, if in doubt, buildout/setuptools/etc always unzip eggs anyway. I feel I should point out that buildout/setuptools/etc work fine with source distributions, provided they play the game properly (ie: "python setup.py install" does) and don't do anything too outlandish. Having had a read of Django's setup.py, I can't see anything that would cause problems... > As such, I'd > strongly recommend against ever trying to install Django as an egg. ...even as an egg ;-) > Django *applications* also are not normally safe to install as eggs. I think you have an overly paranoid view of eggs. It's just a packaging mechanism. I'd be pretty surprised to find at application that couldn't be packaged as an egg. What makes you feel this wouldn't work or be safe to do? > Some parts of Django can handle the bizarre alternate reality > setuptools creates (e.g., there's a template loader which knows how to > look for templates inside eggs), but other parts can't (custom > management commands will completely break, for example). All of your problems seem to center on zipped eggs. These are evil things anyway, and can be avoided by simply putting zip_safe=False as a parameter to setuptools (whether it actually comes from setuptools, or if it comes from the maintained fork, distribute). Buildout event has a config options to say "I don't care whether the egg thinks it's zip safe or not, unzip it!" ;-) The real benefits come in being able to specify what versions of what other packages your package depends on, whether any of them use setuptools or distutils to create their packages, and being able to manage those dependencies with tools like buildout, so you get simple, easy and sane ways to reproduce whole project or even machine setups... I find the need to only do: python bootstrap.py && ./bin/buildout ..to get a completely set up and rigidly controlled environment pretty powerful. cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: djangorecipe questions
Jeroen Vloothuis wrote: > Afaik there is no proper list. I don't follow dango-users but I'm fine > with also discussing it there. Yeah, this list is pretty busy! I'll try and keep an eye out for djangorecipe related posts and forward them your way ;-) > I'm curious as to why djangorecipe does its own thing with respect > to downloading Django rather than relying on it as an egg? > > When I started with the recipe Django 1.0 was not released (svn trunk > was the way to go). Another reason was that the Django community was not > that egg happy. Well, I'm certainly not setuptools-happy, but Django appears to be wrapped up as a standard distribution on PyPI (sorry, should have said distro, not egg), so it would make sense to use that... For me, djangorecipe should be some kind of subclass of zc.recipe.egg that just does the extra stuff for Django and creates a (package based) project if one isn't there... > I guess another way of solving this would be console_scripts entry > points. If these are specified in setup.py's of eggs specified in > either the projectegg or eggs options, will they be created by > djangorecipe? > > I'm not sure if that will work with the current code. Since it seems > like a nice feature I would welcome a patch. OK, I'll have a play. > Another solution that has been suggested in the past was to run setup.py > from the download like zc.recipe.egg does. This would make buildout know > about the version that djangorecipe fetched (either from svn or tgz). Yes, this is what I suggested above :-) > Also, is it common practice to have two djangorecipe sections, once > for development and one for production, or is it more common to have > a buildout.cfg and dev.cfg, with dev.cfg extending buildout.cfg? > > The way I use it is with a base.cfg (common stuff for both production > and development), a buildout.cfg which extends base.cfg for development > and then a production.cfg which extends base.cfg (which enables > production settings etc.). Ah, okay, what things do you set in production.cfg and buildout.cfg? (sorry if this is obvious stuff, I'm new to Django) > Finally, it's a shame that the projects generated by the project > option are not eggs :-S Is there any reason for this? > > This would be that I wanted to keep close to the way Django did projects > at that time. I see no reason at this time tho for not having a setup.py > file in the generated project (patches are appreciated :-) I'll see what I can do, but don't hold your breath ;-) (I'm currently following http://jacobian.org/writing/django-apps-with-buildout/ and on a bit of a tight deadline, so don't know when I'll be able to get to this) cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Multiple implementations of django's authentication/authorization system
On Wed, 16 Sep 2009 10:26:15 -0700 (PDT) Dan06 <dan.king...@yahoo.com> wrote: > Is there a way to have multiple implementations of django's > authentication/authorization system? In my practice blog-type site, > I've implemented django's auth/auth system as is. I'd like to use the > default implementation solely for administrators of the site. For > users of the site, on the other hand, I'd like to have a derivation of > django's auth/auth system - which will have the same functionality as > the default implementation, but have a separate set of user tables and > different fields. > > Anyone know how to do what I've described? Thanks. Is there any particular reason to maintain two distinct authentication databases? You could sub-class the Django auth models and deploy your subclass in parallel, but that is not a trivial deployment task. It would be easier to just authorize the users you want for administrative tasks. The two legitimate use cases I see for wanting truly separate databases for users and administrators would be want admins to be able to function without interacting with users and actually forbidding employees that administer the site from 'wasting time' performing non-administrative functions. Hiding presence information for admins and/or creating an adminstrative class that doesn't have access to site features is better design and likely easier to implement. Chris Babcock signature.asc Description: PGP signature
djangorecipe questions
Hi Jeroen, What's the best mailing list to ask questions about djangorecipe on? I'm CC'ing django-users in the meantime, let me know if there's a better list... I'm just coming to Django myself but I've been a heavy buildout user for a year or so now... I'm curious as to why djangorecipe does its own thing with respect to downloading Django rather than relying on it as an egg? The reason I ask is that I often have other sections, mainly that just use zc.recipe.egg, to do certain bits of a project. For Django, I guess they'll need to use the Django egg, which, of course, will have to be separately downloaded :-S I guess another way of solving this would be console_scripts entry points. If these are specified in setup.py's of eggs specified in either the projectegg or eggs options, will they be created by djangorecipe? Also, is it common practice to have two djangorecipe sections, once for development and one for production, or is it more common to have a buildout.cfg and dev.cfg, with dev.cfg extending buildout.cfg? Finally, it's a shame that the projects generated by the project option are not eggs :-S Is there any reason for this? cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: PyFacebook and python-twitter
On Sun, 13 Sep 2009 10:21:41 -0600 Adam Olsen <arol...@gmail.com> wrote: > On Sun, Sep 13, 2009 at 9:54 AM, simba <judemwe...@gmail.com> wrote: > > > > > I am looking for hosting that supports both of the above library. i > > have no idea on how to have these two libraries on shared hosting. > > Please Help!! > > > > I've got python-twitter installed on my webfaction account. I'm sure > it would be no trouble at all to install PyFacebook as well. Right, those are just libraries that provide API access over the existing HTTP connection. If python hosting is enabled then there will be no problems with those specific libraries. Asking customer service about support for such will only confuse them because it's an application level that's completely irrelevant to their service. Chris Babcock signature.asc Description: PGP signature
Re: Django ORM - Table Changes
That is a short-coming of the Django ORM, unfortunately solving the problem of iterative schema changes is pretty difficult. There are some projects around that attempt to fix this issue, in varying stages of completion: http://south.aeracode.org/wiki/Alternatives is a decent list. As for your specific question of changing the column name - eep :) It's slightly tedious to do that sort of thing seamlessly with the stock ORM. Here's the workflow I'd suggest for changing a column name: 1) Manually create a column named after what you want the new name to be, with the same data type, following the Django ORM's naming scheme 2) Copy the data from the old column for all rows into the newly created column 3) Update the code and change the property name in the model code 4) Ensure the application seems to be working 5) Drop the old-named column Note: These instructions may not apply directly, depending on what your property is - in the case of a many-to-many relationship, for example, a join table is used. I'm sure you can figure out how to go from here, though. -Chris On Thu, Sep 10, 2009 at 1:31 PM, Thomas <thomas.e.rectenw...@gmail.com> wrote: > > I've been teaching myself Django over the past couple of days. Thus > far, everything has been going smoothly, as I typically do a lot of > non-web based Python coding, so am familiar with the language. > However, Django's DB API is my first look into ORM and how it works. > > I understand the basics; how to create models and run a syncdb to > generate tables. I understand how to query, update/insert, etc. the > data by instantiating the class model and using the API methods > against it. All nice and well. > > Where I get lost fast is when I need to make changes to a table. For > example, say I want to change the name of a column from 'foo' to > 'bar'. I can run an ALTER TABLE in SQL and do this easily, but I > thought the idea of ORM was that you weren't supposed to be using SQL > directly. I.e. is there a way to change a column name (or a table > name, or a attribute type, etc.) from within ORM, i.e. from within the > model class; or do I have to run the SQL, then change the model to > 'match' that SQL, and then run a syncdb. > > I love the concept of being able to access data through objects, but > am just confused as what 'workflow' I should be following when doing > something like changing a column name. > > Sorry for the basic question. Google hasn't been much help when > getting into these details. I can sort of 'figure it out' by running > the SQL, matching the model class and going from there... but wasn't > sure if that was the best, or only way. > > Thanks, > Thomas > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: How to invoke hasNoProfanities?
Brandon Taylor wrote: > I would like to do some obscenity filtering on posts, and I see there > is a setting: PROFANITIES_LIST > > But, how to I invoke the hasNoProfanities validator? I searched the > django source code for this, but the only thing I could find was the > setting in conf > global_settings.py > > I'd appreciate some pointers. It's in the book, which is free to read online at http://djangobook.com/ cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Embedd VIM in Django Application
On Mon, 7 Sep 2009 13:08:47 -0600 Dj Gilcreasewrote: > >> How can i embedd vim in my django application? > > http://gpl.internetconnection.net/vi/ maybe? Where's the syntax highlighting? :-) signature.asc Description: PGP signature
Re: Embedd VIM in Django Application
> How can i embedd vim in my django application? It might be possible to create a vim-like Java applet to provide syntax coloring and edit commands for a web application, but there is no way to embed vim in a web page or to imbue equivalent functionality to the contents of a textarea tag. This is a limitation of HTML, JavaScript and CSS; not a limitation of Django itself. > Is there any template available for this? In as much as Django is a Python application and Vim is an Open Source program written in C, you could use SWIG bindings to embed Vim in a Django application. Whether the Vim source code exposes any useful functions for your application, however, is academic as there is no way to expose this functionality in a web page or service. Chris Babcock signature.asc Description: PGP signature
cache.set could be more functional
Hi *, I always find myself using this idiom: cache.get(key, set_cached(key, KeyValue.objects.get(user=request.user, key=key))) Which basically sets the key upon fetching it. It requires me to define set_cached to be something like this though: def set_cached(key, value): """ Functional version of cache.set which returns the value """ cache.set(key, value, 300) return value It would be nice if cache.set returned the value by default, or even better if something like this existed: cache.get_and_set(key, default) Which would set the key to the default and return the default if the key isn't in the cache, or return the value if it is. Chris. --- http://mccormick.cx --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: some teory help (sorry i couldnt find title for that question)
On Fri, 28 Aug 2009 18:03:15 +0300 Mirat Bayrak <miratcanbay...@gmail.com> wrote: > Hi, i am trying to build a site thats like twitter (but not same). > Users can delete or edit their entries in my site but i coulndt find > how can i show options. > > I want to list entries and if an entry is users (logged user i mean) > i want to show edit end delete options. How can i do that? You might be doing more work than you need to do: http://pinaxproject.com/docs/dev/search.html?q=tweets_keywords=yes=default ( or http://bit.ly/Yg7qb ) Chris signature.asc Description: PGP signature
Re: Single sign-in
Hi All, My workmate just pointed out that somebody has now done this. Hooray! <http://github.com/uswaretech/Django-Socialauth/tree/master> Chris. On Tue, May 05, 2009 at 05:15:16PM +0100, Chris McCormick wrote: > > Hi All, > > I am sensing a need for a library which allows for a user to sign into Django > apps using any of their existing credentials with another site, and I wanted > to > start a library project for providing this to Django programmers. I thought I > would ask here first and see if there is something existing before I start. > Essentially this will give the Django site creator the ability to let their > users sign in with Facebook Connect, Google Friend Connect, Yahoo sign-in, > Twitter Sign-in, Open ID, or generic OAuth. The module will automatically > create a local Django user linked to whatever the Profile module is after the > user signs in to the Django driven site. > > I'd like it to be as simple to use as possible, and use as much existing code > as possible. For example, the Open ID sign in would use the existing Open ID > Django code which is out there. The Facebook Connect sign in would use all the > great exising Django Facebook code that's out there. I'd also like it to be as > modular and fail-proof as possible, so that if someone hasn't yet (for > example) > set up their Facebook API key or whatever, they can still support some of the > other login methods on their site. > > I guess this will be a package consisting of mostly some different > authentication backends, but probably a bunch of other glue code and templates > to support the myriad of different sign-on methods which are out there. > > Will this be useful to others? Does anyone want to help me by integrating > their > existing external-sign-in-code into this library? > > Best, > > Chris. > > --- > http://mccormick.cx > > > --- http://mccormick.cx --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: duplicate primary key problem
I had this identical problem. Thanks for the help. Chris On Jul 10, 8:12 pm, adelaide_mike <mike.ro...@internode.on.net> wrote: > Very cool, Rajesh D. Thanks. > > Mike > > On Jul 11, 12:31 am, Rajesh D <rajesh.dha...@gmail.com> wrote: > > > On Jul 10, 11:06 am, adelaide_mike <mike.ro...@internode.on.net> > > wrote: > > > > I suspect this is a question more for a PostgreSQL list, but please > > > bear with me. > > > > In Django 1.0.2 working with PostgreSQL 8.3 I have a model with an > > > implied pkey. PostgreSQL syas this: > > > > CREATE TABLE wha_property > > > ( > > > id serial NOT NULL, > > > propnum character varying(16) NOT NULL, > > > beds integer, > > > baths integer, > > > rooms integer, > > > garage character varying(8), > > > frontage integer, > > > is_corner boolean, > > > street_id integer NOT NULL, > > > land_area numeric(10,2), > > > year_built integer, > > > valuation_nr character varying(16), > > > CONSTRAINT wha_property_pkey PRIMARY KEY (id), > > > CONSTRAINT wha_property_street_id_fkey FOREIGN KEY (street_id) > > > REFERENCES wha_street (id) MATCH SIMPLE > > > ON UPDATE NO ACTION ON DELETE NO ACTION DEFERRABLE INITIALLY > > > DEFERRED, > > > CONSTRAINT wha_property_street_id_key UNIQUE (street_id, propnum) > > > > The wha_property table is populated with 500,000 rows from another > > > database. There are gaps in the series of used id numbers. > > > > If I attempt to insert a new row Django mostly reports an integrity > > > violation at wha_property_pkey, though a couple of times with > > > different parent rows it has worked. My very newbie view for > > > inserting or updating a row is here: > > > >http://dpaste.com/65435/ > > > > I would be very happy if someone can spot where I have an error. If > > > anyone cares to criticise my view, please be gentle. I am new at this > > > Django/PostgreSQL magic. > > > The sequence for the id column might be out of sync. That would cause > > your inserts to pick an id that already exists. > > > Try the following command: > > > python manage.py sqlsequencereset wha > > > That will print out the SQL that you need to run to get your sequences > > back in sync with your data. Run that SQL. Then try inserting new data > > through your view again. > > > -RD --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Backend Neutral DictCursor
Note the normal method of creating a PG DictCursor doesn't seem to work through Django's db module. Is anyone aware of a workaround? import psycopg2.extras from django.db import connection connection.cursor(cursor_factory=psycopg2.extras.DictCursor) TypeError: cursor() got an unexpected keyword argument 'cursor_factory' On Aug 24, 9:55 pm, Chris <chriss...@gmail.com> wrote: > There's no way to do this? > > On Aug 10, 8:47 am, Chris <chriss...@gmail.com> wrote: > > > You can get a backend neutral database cursor with > > django.db.connection.cursor(). However, any results executed are > > returned as nameless lists. Is there a way to get results returned as > > dictionaries, via DictCursor? > > > MySQL uses MySQLdb.cursors.DictCursor and PostgreSQL uses > > psycopg2.extras.DictCursor, but I'd rather avoid having to code around > > each specific backend. > > > Regards, > > Chris --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Backend Neutral DictCursor
There's no way to do this? On Aug 10, 8:47 am, Chris <chriss...@gmail.com> wrote: > You can get a backend neutral database cursor with > django.db.connection.cursor(). However, any results executed are > returned as nameless lists. Is there a way to get results returned as > dictionaries, via DictCursor? > > MySQL uses MySQLdb.cursors.DictCursor and PostgreSQL uses > psycopg2.extras.DictCursor, but I'd rather avoid having to code around > each specific backend. > > Regards, > Chris --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: String aggregator
hyuen wrote: > When I use aggregators, I do something like > > T.aggregate(Max('LastName')) > > but the problem is that for aggregators, it expects a float, not a > string. Is it possible to use strings as maximum/minimum values? Where are you importing Max from? What is the error and traceback you get when you try to do the above? Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Reusable/plugable apps integrations best practices
So I'm trying to get my head around making my small, tightly focused apps reusable. I've done this, but right now still have "dependencies" between one another, that I'd like to remove. For simplicity sake, I have an Articles, Events, and Photos app. Right now each Article has a photos.photo and events.event foreign key relationship and each event has a photos.photo_set fk relationship. Thus, as currently written all three apps are required. I'd like to rework this such that the installation of each application is not required, and I'd think that additional functionality should live in the newer app. That is, when Photos gets "installed" it looks for Articles, if that is installed it hooks into the Photos model to supply the photo relationship. And if Events is installed, it'll provide the photoset relationship. If neither is installed, that's okay too, it just provides it's base functionality. When Events gets installed, it looks for Articles, and if so allows you to relate an article to an event. Surely, this has done before, right? Or am I approaching it wrong? My google foo fails me...what do I need to be searching for?? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Displaying username on every page
On Wed, Aug 19, 2009 at 09:39:23PM -0700, John Barham wrote: > > On Aug 19, 9:27 pm, Kenneth Gonsalves wrote: > > > > Yes, I'd read about RequestContext but from what I understand you have > > > to pass it explicitly to render_to_response(). Is that the case? > > > > yes > > Thanks for the confirmation. In that case I'll have to write my own > render_to_response() wrapper. Or you can use direct_to_template(). Best, Chris. --- http://mccormick.cx --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Get results from query depending on another query
I have a model that has a FK to django.contrib.auth.models Group. I run a query that gets all the groups that a user is a member of: groups = Group.objects.filter(user=request.user) Then I want to run a query for that model that gets and entries in that model where the group FK is one of the groups in the groups query. So like: course = Course.objects.filter(group=groups) 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-users@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: OT: Drawing lines in the browser
On Tue, Aug 18, 2009 at 07:40:00AM -0700, Ian McDowall wrote: > On Aug 18, 8:53 am, Thomas Guettler <h...@tbz-pariv.de> wrote: > > Hi, > > > > this is offtopic: How can you draw lines in a (django) web application? > > > > I think you need to use flash or java to do it. I googled for it, but found > > only beta > > quality projects. > > > > Has anyone experience with this? > > Depends on what type of line. It is technically possible to use SVG. > You can embed an SVG image in HTML and then draw lines (or circles > etc.) in it. The SVG is just XMl and Django's templating works fine > for that. There are some technical catches about the type of the > document and namespaces but I can provide a worked example. The > drawback is that not all browsers support SVG well. This appears to > work well in recent versions of Firefox but not well in IE. Even better is the element and it has good coverage on recent browsers with the help of explorercanvas <http://code.google.com/p/explorercanvas/> for Internet Explorer, although the drawing must be done dynamically with javascript. <http://code.google.com/p/flot/> is an example of a library which uses the element to draw graphs. Chris. --- http://mccormick.cx --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: OT: Drawing lines in the browser
Thomas Guettler wrote: > Hi, > > this is offtopic: How can you draw lines in a (django) web application? > > I think you need to use flash or java to do it. I googled for it, but found > only beta > quality projects. > > Has anyone experience with this? Depends on why you want to draw lines... If it's for graphs and the like, just use matplotlib and generate the graphs on the server as .png or .pdf :-) Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: imitating a spreadsheet (kind of) with formsets
On Aug 10, 10:13 pm, Malcolm Tredinnick <malc...@pointy-stick.com> wrote: > On Mon, 2009-08-10 at 19:07 -0700, Chris Curvey wrote: > > What I want to do is have a series of forms, all next to each other in > > table format, like this: > > > Car Honda Toyota Chevy > > Price $12,000 $14,000 $10,000 > > MPG 30 28 26 > > Color Blue Red Yellow > > > (I'm sure that's going to look like crap in a proportional font.) But > > the point is that Car, Price, MPG and Color are all labels, and > > everything else (Honda, $12,000, 30, Blue, etc) is a form field. > > > I can create the formset and use as_table() to get the forms > > generated, but I seem to either get the label repeated for every form, > > or not at all. Can someone point me in a direction to get the form > > labels listed only once? > > At some point, when you're doing highly customised form layout, you have > to switch from using the convenience methods for the simple cases and > attend to all the little details yourself. This means laying out each > form element appropriately. Maybe you write a template tag to do that, > or maybe you can do it with some for-loops in the form. But as_table() > and friends aren't designed for this kind of thing. > Thanks Malcolm. Not the answer I was hoping for, but good to know that I'm not missing something obvious. So, is there a way for me to get a form field out of a form from within the templating language? I'd like to do something like this: {% for field_name in field_names %} {{ field_name }} {% for form in formset %} {{ form[field_name] %} {% endfor %} {% endfor %} But this does not work -- Django chokes at the opening "[" with a syntax error. My other thought would be that I could try to add something to my formset (a method called as_grid()) that could do the iteration in Python and return what I need...but I could use a pointer on how to get started with that. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Dumping Large Databases
I guess I should have prefixed that by saying my goal is to migrate from MySQL to PostgreSQL. However, I'm having trouble finding a tool to do this, so I thought I'd try Django's backend neutral dumpdata/loaddata feature. Chris On Mon, Aug 10, 2009 at 9:48 PM, Malcolm Tredinnick<malc...@pointy-stick.com> wrote: > > On Mon, 2009-08-10 at 17:02 -0700, Chris wrote: >> I'm trying to dump a 3GB MySQL database using manage.py dumpdata, but >> it's getting killed after 2 hours. Is there any way to get it to use >> less memory/cpu so it doesn't get killed and completes the dump? > > Is there some particular reason you need to use dumpdata for this? At > some point, using the database's native tools is going to be a lot more > efficient and robust. Dumpdata is great for the sweet spot, but it isn't > designed to completely replace all existing database tools. > > Regards, > Malcolm > > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: help with excel exports
Bobby Roberts wrote: > I'm generating the > response in my view as such: > >response = render_to_response("spreadsheet.html", { > 'tms': tms, > }) This is an evil hack, don't be surprised if weird things happen with it. You should be using xlwt to generate your spreadsheets: http://www.python-excel.org > response['Content-Type'] = 'application/vnd.ms-excel' > response['Content-Disposition'] = 'attachment;filename=biblio- > export.xls' ...then you wouldn't be flat out lying here ;-) > This works great with one exception. It saves the file to the > person's last saved location... in my case it's the desktop, in other > cases it's /downloads etc > > Is there a way to force the SAVE option so that when they click SAVE, > the user can determine where to put the file? My testing so far > indicates this is not browser independent Ultimately, your app has no business even trying to tell a browser where to save things. Most browsers nowadays save to a location configured by the user, if they right click and do something like "Save As" they will get dialog box asking them where to save things. cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
imitating a spreadsheet (kind of) with formsets
What I want to do is have a series of forms, all next to each other in table format, like this: Car Honda Toyota Chevy Price $12,000$14,000 $10,000 MPG 30 2826 Color Blue Red Yellow (I'm sure that's going to look like crap in a proportional font.) But the point is that Car, Price, MPG and Color are all labels, and everything else (Honda, $12,000, 30, Blue, etc) is a form field. I can create the formset and use as_table() to get the forms generated, but I seem to either get the label repeated for every form, or not at all. Can someone point me in a direction to get the form labels listed only once? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Backend Neutral DictCursor
You can get a backend neutral database cursor with django.db.connection.cursor(). However, any results executed are returned as nameless lists. Is there a way to get results returned as dictionaries, via DictCursor? MySQL uses MySQLdb.cursors.DictCursor and PostgreSQL uses psycopg2.extras.DictCursor, but I'd rather avoid having to code around each specific backend. Regards, Chris --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Non-intrusive way to authenticate phpBB against Django
Hi All, Just uploaded this: http://code.google.com/p/phpbb-json-auth/ Hope it's useful to someone else. Best, Chris. --- http://mccormick.cx --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Changing domain cookie
On Tue, Aug 04, 2009 at 09:14:42AM +1000, Malcolm Tredinnick wrote: > > On Mon, 2009-08-03 at 17:51 +0100, Chris McCormick wrote: > > I have a strange issue happening with domain cookies. On the site I'm > > working > > Python's Cookie module doesn't handle multiple cookies of the same name > very well, so there might be something going on there. But I'm not going > to spend too much time thinking about this, since there's an easy > solution: In addition to changing the cookie domain, change the session > cookie's name. That way you will no longer be looking for the old cookie > at all (Django won't care about it) and you can just work with the new > name that will only exist with one domain setting. Everybody will appear > to be logged out the next time they use the site, but that shouldn't be > too onerous. Great, thanks for the advice, Malcolm, I think this should work for our use-case. We're pretty keen to not log existing users out since we have a weird "anonymous user" thing happening, which are actually real users who are automatically logged in. I will have to come up with some way of copying their old session cookie to the newly named one, but at least having a differently named one will mean I can tell them apart. Best, Chris. --- http://mccormick.cx --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Changing domain cookie
Hi All, I have a strange issue happening with domain cookies. On the site I'm working on we previously didn't have SESSION_COOKIE_DOMAIN set and so the cookie defaulted to "Host: mysite.com" We have a bunch of users logged in with that cookie set. Then we decided we wanted to share the cookie with our subdomains and so we change SESSION_COOKIE_DOMAIN to be ".mysite.com" which seemed to work at first. We are now getting a weird issue which I have narrowed down to users having two of the same sessionid cookie set, but one has "Host: mysite.com" and one has "Domain: .mysite.com" which seems to be confusing Django. The "confusing Django" behaviour I am experiencing is that when the user logs in, the cookie seems to switch to use the one I don't want and won't log them in. E.g. on the Django side the login seems to work, but the user just gets a logged out screen. Does anyone have any tips on what Django is doing internally, and how I can fix this issue? Oh yeah, in some of my views I am doing request.session.set_expiry(distant_future()) - is there a chance this could be messing with the login process? I have stopped the weirdness by unsetting SESSION_COOKIE_DOMAIN, so people can log in again successfully now, but I'd really like to be able to use the wildcard subdomain thing. Best, Chris. --- http://mccormick.cx --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: URL & DB question
Rob B wrote: > Great I didn't know about that one. I'm curious to what are the > benefits of doing it that are? Less code for you to write and maintain :-) Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: URL & DB question
Rob B (uk) wrote: > Solved it by doing this: > > def profile_detail(request, name): > p = get_object_or_404(Profile, name=name) > return render_to_response('profile_detail.html', {'name': p}) How about using the detail generic view: from django.views.generic.list_detail import object_detail urlpatterns = patterns('', (r'^(?P[\w\._-]+)/$', object_detail, {'queryset':Profile.objects.all()})) cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: user profiles and the admin
Drat. That's not it. I'll keep trying. On Jul 28, 5:01 pm, Asinox <asi...@gmail.com> wrote: > im new , but i think that u need this part: > > class UserProfileAdmin(UserAdmin): > inlines = [UserProfileInline] > list_display = ('user', 'sex','phone') > > regards, > > On Jul 28, 3:01 pm, Chris Curvey <ccur...@gmail.com> wrote: > > > I'm having a bit of a brain cramp here...I'm trying to add some extra > > fields to my user profiles, but I can't seem to get the fields to show > > up in the admin interface. I've added the admin.py directory to my > > application root, but the fields obstinately will not show up in the > > admin interface. > > > The only odd thing that I'm doing is that I don't have a single > > models.py file with lots of classes, instead I have a models directory > > containing an __init__.py file. Anyway, here's my admin.py > > > admin.site.unregister(User) > > > class UserProfileInline(admin.StackedInline): > > model = ClientReviewProfile # this contains my extra fields. > > > class UserProfileAdmin(UserAdmin): > > inlines = [UserProfileInline] > > > admin.site.register(User, UserProfileAdmin) > > > Any ideas what I might be missing? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
user profiles and the admin
I'm having a bit of a brain cramp here...I'm trying to add some extra fields to my user profiles, but I can't seem to get the fields to show up in the admin interface. I've added the admin.py directory to my application root, but the fields obstinately will not show up in the admin interface. The only odd thing that I'm doing is that I don't have a single models.py file with lots of classes, instead I have a models directory containing an __init__.py file. Anyway, here's my admin.py admin.site.unregister(User) class UserProfileInline(admin.StackedInline): model = ClientReviewProfile # this contains my extra fields. class UserProfileAdmin(UserAdmin): inlines = [UserProfileInline] admin.site.register(User, UserProfileAdmin) Any ideas what I might be missing? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: django-tel : telephone URL support for Django
How is this different from the built in phone2numeric filter? http://docs.djangoproject.com/en/dev/ref/templates/builtins/#phone2numeric -Chris On Thu, Jul 9, 2009 at 5:27 PM, Aaron Maxwell <a...@hilomath.com> wrote: > > Hi everyone. > > I've put up a django application providing a template filter, "tel", that > helps format telephone URLs. This is helpful when writing mobile-optimized > web sites, or other contexts you want "click-to-call" to work. > > For example, you can say something like this in your template: > > {{{ > {% load tel %} > Call {{"800-222-CASH"|tel}} now to get free money! > }}} > > This will render into the following HTML: > {{{ > Call 800-222-CASH to get free money! > }}} > > For now, please download from the github page: > http://github.com/hilomath/django-tel/tree/master > > Django-tel is currently in development, and does not even have a release > number set. But it's featurefull enough to be useful and has no known bugs > at > this time (except for non-USA support; see README.txt.) > > Any comments, bug reports, etc. are appreciated, and can be communicated to > myself. Or use the github issue tracker. > > Cheers, > Aaron > > -- > Aaron Maxwell > Hilomath - Mobile Web Development > http://hilomath.com/ > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: PyDev users: how do you manage tabs?
Wayne I can't thank you enough!! As the author notes, the posted code is not cross-platform. I incorporated the fix recommended in the comments and posted here for anyone else that might want it: http://dpaste.com/hold/62468/ works fine on my windows machine, haven't tested on my Linux dev box yet. On Jul 1, 12:38 pm, AmanKowwrote: > > I have the same problem in Komodo Edit - although I the whole filename > > does show up in the window title I never think to look there. Anyway, > > I partially solved it by adding a comment at the top of the file for > > what app the file is for, so I'll see what I'm working on right there > > in the editor window. > > > On Jul 1, 11:41 am, Steve Howell wrote: > > > > On Jun 30, 10:42 pm, Rex wrote: > > > > > Kind of a petty question: > > > > > I've been using PyDev to do my Django work and find it to be great. > > > > However, my only gripe is that it's hard to keep track of tabs, since > > > > they display only the (non-qualified) file name, which is a problem > > > > given Django's very regular naming scheme. So for example I'll often > > > > have 4+ tabs that are all named "views.py", and I have to mouse over > > > > each to find which one is the one I'm looking for. > > > > I definitely feel your pain. > > > > One thing that you can do is put view code into files that are not > > > called "views.py." It's always a little risky to break the convention > > > here, but I have done it in on nontrivial projects without major > > > hangups. > > > > On the other hand I don't think you want to mess with conventions on > > > models.py and certain other files, but I tend to spend less time > > > editing those. > > http://traviscline.com/blog/2008/04/30/komodo-tab-macro-to-ease-djang... > > There are ways to get the behavior you want in Komodo! > > Enjoy, > Wayne --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: PyDev users: how do you manage tabs?
I have the same problem in Komodo Edit - although I the whole filename does show up in the window title I never think to look there. Anyway, I partially solved it by adding a comment at the top of the file for what app the file is for, so I'll see what I'm working on right there in the editor window. On Jul 1, 11:41 am, Steve Howellwrote: > On Jun 30, 10:42 pm, Rex wrote: > > > Kind of a petty question: > > > I've been using PyDev to do my Django work and find it to be great. > > However, my only gripe is that it's hard to keep track of tabs, since > > they display only the (non-qualified) file name, which is a problem > > given Django's very regular naming scheme. So for example I'll often > > have 4+ tabs that are all named "views.py", and I have to mouse over > > each to find which one is the one I'm looking for. > > I definitely feel your pain. > > One thing that you can do is put view code into files that are not > called "views.py." It's always a little risky to break the convention > here, but I have done it in on nontrivial projects without major > hangups. > > On the other hand I don't think you want to mess with conventions on > models.py and certain other files, but I tend to spend less time > editing those. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Setting up TinyMCE with django-grappelli?
I've never used TinyMCE, and would really like to get it working with Grappelli, but the "Using TinyMCE" wiki page on the Grappelli Google Code site doesn't produce any results for me. Could someone who's got it working maybe outline all the steps needed to get TinyMCE working? Do I need django- tinymce installed? Thanks, Chris --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Very bad experience in Django...
steveneo wrote: > BooleanField limits only to CheckBox? But I set > widget=HiddenField It does not report error. HTML renders > correctly, but actually, you can not use like that?! Didn't you hear me: I said go find another framework, Django obviously sucks because one new user can't get his head around it ;-) Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Very bad experience in Django...
steveneo wrote: > I try to use Django in a new project. Honestly, it is very bad > experience. It looks not boosting my development speed. Today, I > almost give up and begin to look up another Python framework Go for it :-) Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
FileField can't re-display invalid form with File upload widget filled-in?
I've got an app that wants a file upload and some other attributes. If the user fills in the file but has problems with the other attributes, it should re-present the form with the attributes filled with his values, including the name of the file that he selects. In use the example below doesn't re-populate the file upload widget. Is this possible? > class FileDemoForm(forms.Form): > """Require another field so we can show populated file0 not > being bound""" > file0 = forms.FileField() > another = forms.CharField() > > def file_demo(request): > """The bound form is *not* populated with request.FILES info for > file0""" > if request.method == "POST": > form = FileDemoForm(request.POST, request.FILES) > print >> stderr, "### file_demo incoming bound POST form=\n > %s" % (form,) > if form.is_valid(): > return HttpResponseRedirect("/") > else: > form = FileDemoForm() > print >> stderr, "### file_demo returning form=\n%s" % (form,) > return render_to_response('filedrop/file_create.html', {'form': > form}) The incoming form bound with request.FILES and request.POST doesn't show any filename in the widget: > ### file_demo incoming bound POST form= > File0: type="file" name="file0" id="id_file0" /> > Another: class="errorlist">This field is required. type="text" name="another" id="id_another" /> The W3C spec suggests that should be able to take a "defaultValue" or "value" attributes but I can't make that work even with hand-written HTML outside of Django. It also suggests browsers should allow multiple file selection in their input widgets but I've not seen this implemented before. So is it possible to re-populate a 'file' input widget with the user's selection on a failed form? 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-users@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 -~--~~~~--~~--~--~---
psycopg2.OperationalError: fe_sendauth: no password supplied
I've just installed postgresql and psycopg2. I supplied a password in the postgres install, but don't know how to supply it to psycopg2: ~/s/sd$ manage.py syncdb Traceback (most recent call last): File "./manage.py", line 11, in execute_manager(settings) File "/users/home/system/lib/djangotrunk/django/core/management/ __init__.py", line 347, in execute_manager utility.execute() File "/users/home/system/lib/djangotrunk/django/core/management/ __init__.py", line 295, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/users/home/system/lib/djangotrunk/django/core/management/ base.py", line 195, in run_from_argv self.execute(*args, **options.__dict__) File "/users/home/system/lib/djangotrunk/django/core/management/ base.py", line 222, in execute output = self.handle(*args, **options) File "/users/home/system/lib/djangotrunk/django/core/management/ base.py", line 351, in handle return self.handle_noargs(**options) File "/users/home/system/lib/djangotrunk/django/core/management/ commands/syncdb.py", line 48, in handle_noargs cursor = connection.cursor() File "/users/home/system/lib/djangotrunk/django/db/backends/ __init__.py", line 62, in cursor cursor = self._cursor(settings) File "/users/home/system/lib/djangotrunk/django/db/backends/ postgresql_psycopg2/base.py", line 84, in _cursor self.connection = Database.connect(conn_string, **self.options) psycopg2.OperationalError: fe_sendauth: no password supplied --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: psycopyg setup error: no build_ext
/opt/local/bin$ sudo port install py26-psycopg2 worked, after an incredible number of (presumably dependent) installs. Now I'm getting a password error, but I'll post that separately as it deserves a different title. thanks Chris On Jun 23, 8:33 pm, James Martin <jmar...@learningobjects.com> wrote: > I was never able to get psycopg2 to compile on osx I recommend > using sqlite for development or another database. If you must use > psycopg2, you may want to try to get it through something like > darwinports. > > On Tue, Jun 23, 2009 at 1:19 PM, Chris Haynes<chay...@indiana.edu> wrote: > > > Using what I believe is the latest version of psycopyg, I get: > > > 509 ~/Desktop/psycopg2-2.0.9$ python setup.py build > > running build > > running build_py > > creating build > > creating build/lib.macosx-10.3-fat-2.6 > > creating build/lib.macosx-10.3-fat-2.6/psycopg2 > > copying lib/__init__.py -> build/lib.macosx-10.3-fat-2.6/psycopg2 > > copying lib/errorcodes.py -> build/lib.macosx-10.3-fat-2.6/psycopg2 > > copying lib/extensions.py -> build/lib.macosx-10.3-fat-2.6/psycopg2 > > copying lib/extras.py -> build/lib.macosx-10.3-fat-2.6/psycopg2 > > copying lib/pool.py -> build/lib.macosx-10.3-fat-2.6/psycopg2 > > copying lib/psycopg1.py -> build/lib.macosx-10.3-fat-2.6/psycopg2 > > copying lib/tz.py -> build/lib.macosx-10.3-fat-2.6/psycopg2 > > running build_ext > > error: No such file or directory > > > and easy_install doesn't work either (seems like the same problem): > > > 510 ~/Desktop/psycopg2-2.0.9$ easy_install . > > Processing . > > Running setup.py -q bdist_egg --dist-dir /Users/home/Desktop/ > > psycopg2-2.0.9/egg-dist-tmp-mYsMSq > > error: Setup script exited with error: No such file or directory --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
psycopyg setup error: no build_ext
Using what I believe is the latest version of psycopyg, I get: 509 ~/Desktop/psycopg2-2.0.9$ python setup.py build running build running build_py creating build creating build/lib.macosx-10.3-fat-2.6 creating build/lib.macosx-10.3-fat-2.6/psycopg2 copying lib/__init__.py -> build/lib.macosx-10.3-fat-2.6/psycopg2 copying lib/errorcodes.py -> build/lib.macosx-10.3-fat-2.6/psycopg2 copying lib/extensions.py -> build/lib.macosx-10.3-fat-2.6/psycopg2 copying lib/extras.py -> build/lib.macosx-10.3-fat-2.6/psycopg2 copying lib/pool.py -> build/lib.macosx-10.3-fat-2.6/psycopg2 copying lib/psycopg1.py -> build/lib.macosx-10.3-fat-2.6/psycopg2 copying lib/tz.py -> build/lib.macosx-10.3-fat-2.6/psycopg2 running build_ext error: No such file or directory and easy_install doesn't work either (seems like the same problem): 510 ~/Desktop/psycopg2-2.0.9$ easy_install . Processing . Running setup.py -q bdist_egg --dist-dir /Users/home/Desktop/ psycopg2-2.0.9/egg-dist-tmp-mYsMSq error: Setup script exited with error: No such file or directory --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Should this be its own app?
Kenneth Gonsalves wrote: > I personally would put everything in one app at the start. If things start to > grow and you want to reuse that part in another project, or release it to the > public (and become famous), then it makes sense to factor it out into a > separate app - maybe a separate project somewhere in your system path so that > all your projects can use it. Over engineering at the start is usually > counter > productive. Interesting, I'm pretty sure I remember Jacob saying almost the exact opposite in his Django tutorial at PyCon... Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Django and CSS
Hi, I'm new to Django. I've read the doc: http://docs.djangoproject.com/en/dev/howto/static-files/?from=olddocs which is about static files but still do not quite understand what to call everything and it isn't working On my development machine, I want to use this hack and not deal with other servers. Please help. here is my file structure: /mysite/ - has all the .py files /mysite/templates/ - has all the html templates /mysite/templates/path_media/ - has the CSS document and pictures Now, how should I modify this: (r'^site_media/(?P.*)$', 'django.views.static.serve', {'document_root': '/path/to/media'}) '/path/to/media' should be changed to what? And is this what I want for my style href? : http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Logging to Database while using @transaction.commit_manually decorator
The only log entries I want committed are the ones that tell me why a roll-back occurred. What you've said below sounds like a good enough solution, thanks for all your input. Cheers, Chris On Mon, Jun 8, 2009 at 11:38 PM, Karen Tracey <kmtra...@gmail.com> wrote: > On Mon, Jun 8, 2009 at 5:39 AM, Chris Stoyles <cstoy...@gmail.com> wrote: > >> Hi Thomas, >> >> The reason I want to be able to rollback (but still commit by log entries) >> is because it is sometimes valid for this particular view to throw an >> exception and fail. If this happens, I need to rollback any model objects >> that have been created and saved up to the point at which the view fails >> (again, except for any logging that has been done). The view contains a big >> try/except statement and the rollback is in the "except" part. >> >> I may have to approach this a different way, because it doesn't look like >> I can easily do a fine-grained commit. >> > > Sounds like the easiest thing to do would be to accumulate (but not call > save() on) LogEntry objects as you do the work, then at the end either after > you have either rolled back the main work or are about to commit it, save() > whatever LogEntry objects you have accumulated. (I'd probably also want to > indicate in the entries associated with work that was ultimately rolled back > that that happened, otherwise it seems the log might be a bit confusing, > containing entries for stuff that ultimately got rolled back...but maybe > that's not an issue for the log you are keeping?) > > Karen > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Bloxsom in Django
Hi, I present for you, a half-implemented, possibly buggy implementation of the text-file based blogging engine PyBloxsom, re-done in Django. Maybe this will be useful to someone else who has a pybloxsom blog and wants to transition to something more manageable/hackable (with no offense to the PyBloxsom developers, and thanks for their software which gave me a year of good service!). <http://mccormick.cx/news/entries/django-bloxsom> Best, Chris. --- http://mccormick.cx --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Problems with view... not sure how to get the data to my template
Hi Mitch, I haven't read through your example in detail, but just glancing over it I think that I can see the mistake you're making The problem is that there is no "number_list" key in your context, there is only a "range" and "range_list" key (take a look at where you call "render_to_response"). I think what you want to do is actually pass your "net" variable into the template. Although your "net" variable doesn't appear to have been defined anywhere in your view, so the code you've sent us probably won't execute. Are all the calls you make to net.append() supposed to be myrange.append() instead? Chris On Mon, Jun 8, 2009 at 11:46 AM, Mitch Anderson <xofre...@gmail.com> wrote: > > Below is what I have currently... it currently displays the numbers in > the range its supposed to, but tying the products and displaying those > where they should be in the number list has become the problem... > One product can have multiple numbers associated, and I didn't want to > fully populate every possible number combination for the range to save > on disk space... as there will be thousands of possible numbers and > maybe only a few hundred actually used... > > Heres what I have... what am I doing wrong? is there a better way to > handle the view? > > Models: > > class Range(models.Model): > lowerNum = models.IntegerField() > upperNum = models.IntegerField() > ... > > class Number(models.Model): > number = models.IntegerField() > range = models.foreignKey(Range) > > class Product(models.Model): > name = models.CharField() > description = models.CharField() > mynumbers = models.ManyToManyField(Number, blank=True, null=True) > ... > > view: > def range_display(request, myrange): > r = get_object_or_404(Range, lowerNum=myrange) > > myrange = [] > range_list = generageRange(str(r.lowerNum), str(r.upperNum)) > used_number_list = Number.objects.filter(range=r) > > for a in range_list: > for b in used_number_list: > if str(b) == str(a): > try: > prod = Product.objects.get(mynumbers__number=a) > net.append({'num': a, 'name': prod.name, > 'description': prod.description }) > except: > badnum = Number.objects.get(number=a) > badnum.delete() > net.append({'num': a }) > break > else: > net.append({'num': a }) > break > continue > return render_to_response('range_display.html', {'range': myrange, > 'range_list': myrange, } ) > > range_display.html template: > > > >number >name >description > > {% for n in number_list %} > > {{ n.num }} > {{ n.name }} > {{ n.description }} > > {% 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-users@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: Logging to Database while using @transaction.commit_manually decorator
Hi Thomas, The reason I want to be able to rollback (but still commit by log entries) is because it is sometimes valid for this particular view to throw an exception and fail. If this happens, I need to rollback any model objects that have been created and saved up to the point at which the view fails (again, except for any logging that has been done). The view contains a big try/except statement and the rollback is in the "except" part. I may have to approach this a different way, because it doesn't look like I can easily do a fine-grained commit. Cheers, Chris On Mon, Jun 8, 2009 at 3:14 PM, Thomas Guettler <h...@tbz-pariv.de> wrote: > > Hi Chris, > > please explain in more depth what you want to do. If you > do rollback, all changes won't be written to the database. Even > all savepoints won't be stored. > > Why do you want to rollback? If you want your changes > to get saved, you need to call transaction.commit() at the end. > > ChrisStoyles schrieb: > > Hi All, > > > > I just wanted to quickly reach out to the group for ideas as to why I > > cannot get this to work: > > > > @transaction.commit_manually > > def some_view(request): > > # some view logic goes here > > > > sid = transaction.savepoint() > > le = models.LogEntry() > > le.message = 'A test log message' > > le.save() > > transaction.savepoint_commit(sid) > > > > transaction.rollback() > > > > My database back end is Postgres 8.3 and the engine I am using is > > postgresql_psycopg2. Any ideas as to why my LogEntry would not be > > committed to the database? I am not getting any exceptions being > > raised, the code executes as though it has all worked perfectly. > > > -- > Thomas Guettler, http://www.thomas-guettler.de/ > E-Mail <http://www.thomas-guettler.de/%0AE-Mail>: guettli (*) > thomas-guettler + de > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Logging to Database while using @transaction.commit_manually decorator
Hi Karen, Yes it does look as though I am using them backwards. I am at a bit of a loss as to how to get around this problem, though it is Monday morning and my brain isn't fully into gear yet. Can anyone think of a way for me to bypass the transaction management? I believe that even if I execute an insert statement via the database cursor the transaction management will still take place, is this correct? Cheers, Chris On Mon, Jun 8, 2009 at 8:11 AM, Karen Tracey <kmtra...@gmail.com> wrote: > On Sun, Jun 7, 2009 at 7:44 PM, ChrisStoyles <cstoy...@gmail.com> wrote: > >> >> Hi All, >> >> I just wanted to quickly reach out to the group for ideas as to why I >> cannot get this to work: >> >> @transaction.commit_manually >> def some_view(request): >># some view logic goes here >> >>sid = transaction.savepoint() >>le = models.LogEntry() >>le.message = 'A test log message' >>le.save() >>transaction.savepoint_commit(sid) >> >>transaction.rollback() >> >> My database back end is Postgres 8.3 and the engine I am using is >> postgresql_psycopg2. Any ideas as to why my LogEntry would not be >> committed to the database? I am not getting any exceptions being >> raised, the code executes as though it has all worked perfectly. >> > > I've not played with savepoints but the behavior you describe matches what > the docs say: > > http://docs.djangoproject.com/en/dev/topics/db/transactions/#savepoints > > Specifically, savepoint_commit updates the savepoint to include operations > since the savepoint was created, but it does not actually commit operations > at that point. After you have done a savepoint_commit, a savepoint_rollback > for that savepoint will not roll back the operations you hae committed for > the savepoint. However, an entire transaction rollback, which is what you > call, will roll back the whole transaction, including your savepoint > "committed" ones. > > As the doc describes it, savepoints are a tool to allow for finer-grained > rollback. You appear to be trying to use them for finer-grained commit, > which I don't think is what they are intended to provide. > > Karen > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Historical Records (as introduced in the Pro Django book)
Hi there, I am struggling with the Historical Records model, which is introduced in Apress' Pro Django book by Marty Alchin. (Apologies if this is off- topic. I tried to contact the author but never got a reply) In a nutshell, this is a very clever approach to keeping track of changes in model instances by copying the whole model over to another table (and also adding some additional metadata). And all of this is done simply by adding a single attribute to the model (implemented as a specialized manager) . I have successfully integrated this into my app, but now running into problems: The first is, that this approach somehow falls flat on its belly with self-referential models. I have somehow worked around this, but thus destroyed the built-in methods to retrieve the history objects. The other problem is, that I in general would like to get an overview over what has changed by retrieving the instances with most recent changes. So my question is, is anybody else using this approach? Have you successfully dealt with these problems? Or, maybe failing that, how can I tie a manager object into djangos QuerySet based retrieval system, so that I can look for instances that satisfy certain conditions? I guess this stuff is a bit over my head, so any pointers are really appreciated, All the best, Chris --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Drill down combo boxes (Country, State, City)
You want a chained select form & will need to use javascript to do it. I prefer jquery and have used the one here - http://www.codeassembly.com/Simple-chained-combobox-plugin-for-jQuery/ The code demos are for PHP but it's simple enough to apply to Django. -Chris On Sun, May 31, 2009 at 12:11 PM, Weiss Blitz <weissbl...@yahoo.com> wrote: > I'm building a website where the user must enter his location information > during user registration. > > I would like to have a combo box for each of the country, state, and city > fields. > The user will drill down their selections by first selecting their country, > > then the state combo box should enable with only the states available for > the selected country, > the user then selects his state/region/province and > then the city combo should be enabled and populated with the cities > available for the previously selected country/state combination. Preferably > this should happen without having to do a page refresh (maybe using AJAX?) > between updates. > > My models look like this: > > class Country(models.Model): > name = models.CharField(max_length=50) > code= models.CharField(max_length=3) > > class State(models.Model): > name = models.CharField(max_length=30) > country = models.ForeignKey(Country) > > class City(models.Model): > name = models.CharField(max_length=60) > state = models.ForeignKey(State) > > I know this might involve some ajax or js incantations, so if somebody > could point me to some examples or a website that explains how to do this > will be greatly appreciated. > > I believe this must be a fairly common thing to do when developing some web > applications but I have not been able to find the solution. > > Thanks in advance! :) > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Obfuscate HTML..?
What reason do you have for this? Security through obfuscation isn't a good strategy, especially with something as intrinsically open as HTML. If your site can be hacked just by being able to view the HTML then you have bigger problems to worry about than obfuscating it. On Mon, May 25, 2009 at 4:36 AM, Andy Mikhailenkowrote: > > Built-in template tag {% spaceless %) can do a part of work for you > (namely, remove the extra whitespace), but to actually obfuscate the > code you should either use middleware or make extensive use of > JavaScript (e.g. open GMail and try to read the source). However, the > idea in general sounds strange: most (or some) browsers let the user > view even JS-generated HTML, nicely formatted and perfectly > inspectable. David is right, this is probably not what you need. I > hate to mention Flash but it can be an option. > > On May 25, 7:40 am, jago wrote: >> Hi, >> >> I want to make the HTML of the website as little human readable as >> possible. For that I would like to add some layer to Django 0.96 which >> when writing out the page takes the HTML and adds some processing. >> >> 1. How would I obfuscate the HTML as much as possible (remove all line >> breaks, etc.) >> 2. How would I best add the layer which does this obfuscation > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: runserver fails
No. I get the same error. I tried that on 3 versions of python with the same result. On May 24, 8:03 pm, David Zhou <da...@nodnod.net> wrote: > Does the following worth in the interactive prompt? > > >>> import socket > >>> socket.getaddrinfo("www.google.com", 80) > > -- dz > > On Sun, May 24, 2009 at 10:59 PM, Chris DPS <jasonyf...@gmail.com> wrote: > > > When I execute runserver, I get the following message: > > > Validating models... > > 0 errors found > > > Django version 1.0.2 final, using settings 'mysite.settings' > > Development server is running athttp://127.0.0.1:8000/ > > Quit the server with CTRL-BREAK. > > Error: [Errno 10104] getaddrinfo failed > > > And the server quits immediately. > > I have been trying to solve this for quite some time now and am really > > desperate for some help. > > I have already tried running it using different ports and running it > > on 0.0.0.0 > > According to Windows, I do not have any Firewalls running, nor do I > > believe there to be any running. > > I can ping localhost fine. > > ping to port 8000 does not get a response > > > What is going on? > > > I have done the exact same python and django installation on two other > > computers (both running Windows) and they worked fine. > > I need this to work on my computer. > > > Please help! > > > 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-users@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 -~--~~~~--~~--~--~---
runserver fails
When I execute runserver, I get the following message: Validating models... 0 errors found Django version 1.0.2 final, using settings 'mysite.settings' Development server is running at http://127.0.0.1:8000/ Quit the server with CTRL-BREAK. Error: [Errno 10104] getaddrinfo failed And the server quits immediately. I have been trying to solve this for quite some time now and am really desperate for some help. I have already tried running it using different ports and running it on 0.0.0.0 According to Windows, I do not have any Firewalls running, nor do I believe there to be any running. I can ping localhost fine. ping to port 8000 does not get a response What is going on? I have done the exact same python and django installation on two other computers (both running Windows) and they worked fine. I need this to work on my computer. Please help! 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-users@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: Single sign-in
Hi Lakshman, I haven't yet started or made any progress on this library. I was a bit put off by the underwhelming response on this mailing list. Maybe I'll set up a Google Code repository this week, and import the working Facebook code I have, and then start integrating some of the other systems. There's a chance that I might be able to convince my client to let me do this work on a paid basis - will report back here if and when I get this off the ground. Best, Chris. On Fri, May 22, 2009 at 11:57:59AM -0700, Lakshman wrote: > > Hi, > > I now have this exact same requirement. > > Is there any development and/or any existing code/module/app that > implements sign-in using Google/Facebook/Twitter/OpenID/EmailID/UserID > something that friendfeed did just recently. > > On May 5, 9:15 pm, Chris McCormick <ch...@mccormick.cx> wrote: > > Hi All, > > > > I am sensing a need for a library which allows for a user to sign into > > Django > > apps using any of their existing credentials with another site, and I > > wanted to > > start a library project for providing this to Django programmers. I thought > > I > > would ask here first and see if there is something existing before I start. > > Essentially this will give the Django site creator the ability to let their > > users sign in with Facebook Connect, Google Friend Connect, Yahoo sign-in, > > Twitter Sign-in, Open ID, or generic OAuth. The module will automatically > > create a local Django user linked to whatever the Profile module is after > > the > > user signs in to the Django driven site. > > > > I'd like it to be as simple to use as possible, and use as much existing > > code > > as possible. For example, the Open ID sign in would use the existing Open ID > > Django code which is out there. The Facebook Connect sign in would use all > > the > > great exising Django Facebook code that's out there. I'd also like it to be > > as > > modular and fail-proof as possible, so that if someone hasn't yet (for > > example) > > set up their Facebook API key or whatever, they can still support some of > > the > > other login methods on their site. > > > > I guess this will be a package consisting of mostly some different > > authentication backends, but probably a bunch of other glue code and > > templates > > to support the myriad of different sign-on methods which are out there. > > > > Will this be useful to others? Does anyone want to help me by integrating > > their > > existing external-sign-in-code into this library? > > > > Best, > > > > Chris. > > > > ---http://mccormick.cx > > --- http://mccormick.cx --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Installing django
Just to see what all the fuss is about, most of that video is the guy configuring his particular application. The actual Django install is very straightforward. On May 21, 1:53 am, Kenneth Gonsalveswrote: > On Thursday 21 May 2009 11:15:29 LeonTheCleaner wrote: > > > @sdc, yeah I plan to try webfaction. The only thing is I just quickly > > checked out their demo video to setup django and itès 21 mins. I am > > blown away to see how complicated just setting this up, and I am an > > experienced windows programmer. Just expected a lot less steps. > > why follow their steps? just follow the steps in the django tutorial. > -- > regards > kghttp://lawgon.livejournal.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: perfomance question
Rodrigo Aliste P. wrote: > OH! It does it alone! Another awesome thing to my awesomeness list of > django. What was your solution in the end? I'm always interested this kind of batching of results, and I'm very new to Django... Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: help on outlook integration
kam wrote: > We have to integrate of web outlook using HTTP protocol. We are > trying to connect outlook with form based authentication to connect > using HTTP protocol. We are able to connect outlook using HTTPS and > COM object but this is not work on Linux & using COM object we are > able to access only outlook’s data. We are expecting header cookie and > response data from inbox page of outlook. I don't really understand how posting the same vague requirements once every 10-15 minutes is supposed to help other than by annoying everyone on this list... Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: parsing data from fileupload
Oh, make sure your upload form specifies the 'enctype' attribute so it will actually send a file object, like: {% block content %} Upload a file... {{ form.as_p }} {% endblock %} --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: parsing data from fileupload
On May 18, 2009, at 12:12 PM, Patrick wrote: > > Well, I guess what I'm confused about is adding data that doesn't come > directly from forms. > I ended up doing this and it seemed to work. > > for line in file: >b=Book() >b.title=line >b.save() Here is how I do it, Model, Form, View. The Django file form can process a bunch of this but I am capturing some metadata that is NOT on the forms so have to do that after form processing then do a separate save(). Note that my models are inheriting from some abstract base classes which provide tracking and hierarchy relationships, but you can see what the upload part is doing fairly clearly. The model: class File(FileDropContent): file= models.FileField(upload_to=FILEDROP_ROOT) mime_type = models.CharField(_('mime_type'), max_length=127) downloaded = models.DateTimeField(_('last download date'), null=True) expiration = models.DateTimeField(_('expiration date'),) parent = models.ForeignKey(Container, related_name='files', null=True) def is_expired(self): return self.expiration < datetime.datetime.now() The form: class FileForm(forms.ModelForm): """ Upload File, select file from filesystem browser, get expriation description from user. """ def __init__(self, *args, **kwargs): """ Fix field order here too. """ super(FileForm, self).__init__(*args, **kwargs) description = self.fields.pop('description') new_pos = len(self.fields) self.fields.insert(new_pos, 'description', description) class Meta: model = File fields = ['file', 'expiration', 'description'] And the view: def file_create(request, parent_id): """ Get upload file and metadata (e.g. true name), save file to disk. """ parent = Container.objects.get(pk=parent_id) if not _is_writable(request.user, parent): return HttpResponse("You don't have permission to upload a file into parent '%s'" % parent) if request.method == "POST": form = FileForm(request.POST, request.FILES) if form.is_valid(): uploadobj = form.save(commit=False) uploadobj.parent= parent uploadobj.title = request.FILES['file'].name uploadobj.mime_type = request.FILES['file'].content_type uploadobj.creator = request.user uploadobj.ip= request.META.get('REMOTE_ADDR', "0.0.0.0") uploadobj.save() return HttpResponseRedirect(reverse("file_detail", args=[uploadobj.pk])) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: modelling question / many-to-many / intermediary
Hi, I solved it that way: class PersonCollaboration(models.Model): person1 = models.ForeignKey('Person', related_name='person1') person2 = models.ForeignKey('Person', related_name='person2') timestamp_created = models.DateTimeField(default=datetime.now) class Person (models.Model): name = models.CharField(max_length=250, unique=True) collaborate_with = models.ManyToManyField('self', through='PersonCollaboration', symmetrical=False) This way, I get a table with person1_id, person2_id and I can add additional fields. I have to take care about the missing symmetrical property for myself, but this is okay. Have a nice day, Chris --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
modelling question / many-to-many / intermediary
Hi, I'm working with Django since a few weeks and I really *love* it! I came across a problem I didn't find any help so I thought it might be a good idea to ask the pros. I need to model persons and each person should have a list of other persons (a 'collaborates-with'-property). I have to save some meta-data about the connection, so I need a intermediary table (let's call it "PersonCollaboration"). In normal SQL I would do it with a simple join table: person1_id | person2_id | meta-stuff... I'm not sure how to handle this in django. How would you do that? I read http://heather.koyuk.net/refractions/?p=151 - is this the only way to go? What about a symmetric approach? Here is what I got so far (inspired from http://heather.koyuk.net/refractions/?p=151): class PersonCollaboration (models.Model): person1 = models.ManyToManyField('Person', related_name='person1') person2 = models.ManyToManyField('Person', related_name='person2) ... class Person (models.Model): name = models.CharField(max_length=250, unique=True) collaborates_with = models.ManyToManyField('self', through='AuthorCollaboration', symmetrical=False This is not symmetric - I could try to create two PersonCollaboration- objects, but this is not really clean... Thanks a lot for your support, chris --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
pos small int, admin and max value errors
Hi All, I've been looking for a simple way to spec a "max_value" limit on a (model) positive small integer field to prevent admin from throwing an "out of range value" error. I realize that the concept "small int" may be db specific so I sought a simple way to trap the error in admin when too large a number is entered. I'm guessing that an argument could be made that such a limit doesn't belong in a model because it is unrelated to the db (the db knows the limit) but how else to prevent the admin error short of implementing a custom form with validation for the limit? Ultimately, is there no (simple) way to prevent admin from throwing and error when a number greater than 65535 (mysql) is entered in a pos small int field? 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-users@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 -~--~~~~--~~--~--~---
Trouble starting up runserver
I am new to Django. When I try to execute: python manage.py runserver, I get the following error Error: [Errno 10104] getaddrinfo failed What is going on and what should I do? I am running Django Version 1.0.2-final and Python 2.6 I have turned off all Firewalls. ping to localhost in the cmd works fine I tried starting runserver on 0.0.0.0:8000, :8000, and other ports with the same results. Please help! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Trouble Starting Up with runserver
ping localhost seemed fine, 4 sent and 4 received, 0ms, 0% loss I have tried 127.0.0.1:8000, :8000, 0.0.0.0:8000, 127.0.0.1:others On May 10, 9:52 pm, Addy Yeow <ayeo...@gmail.com> wrote: > What does 'ping localhost' in command-prompt tells you?Did you try 'python > manage.py runserver 127.0.0.1:8000'? Or 'python manage.py runserver :8000' > > - Addy > > On Mon, May 11, 2009 at 12:40 PM, Chris DPS <jasonyf...@gmail.com> wrote: > > > So I've definitely shut off all Firewalls. > > It still is having the same problem. > > > HELP!!! PLEASE > > > On May 10, 6:37 pm, Chris DPS <jasonyf...@gmail.com> wrote: > > > How to tell if I have a Firewall running? > > > I have turned off Windows firewall. When I go to the Windows Security > > > Center, the Firewall option is Green, as in 'on'. > > > I looked for normal firewall products on my computer such as Symantec > > > and couldn't find any active ones. > > > > How can find which firewall I'm using and shut it off. > > > > ---Chris DPS > > > > On May 8, 8:10 pm, Addy Yeow <ayeo...@gmail.com> wrote: > > > > > Do you have firewall running?It could be blocking incoming local > > connection > > > > to port 8000. > > > > > - Addy > > > > > On Sat, May 9, 2009 at 7:01 AM, Chris DPS <jasonyf...@gmail.com> > > wrote: > > > > > > I am new to Django. > > > > > > When I try to execute: python manage.py runserver, I get the > > following > > > > > error > > > > > > Error: [Errno 10104] getaddrinfo failed > > > > > > What is going on and what should I do? > > > > > > I am running Django Version 1.0.2-final and Python 2.6 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---