Full Time Developer Role (Python/Django) - Brisbane - Australia
Anyone Who may be interested in a developer role in Brisbane Australia could they please contact me ASAP on the below addresses. Do not send your resume. I will reply to your initial email with the job description. Note: I am the Technical Lead, not an agent. I apologize for not being able to post granular details of either the role or the employer here directly but it's simply deemed too sensitive. i will list some key points to gain your interest: * Work with a Proven Stable Development Team. * Contact with view to Permanent Role after an initial review period. * Large Corporate with dedicated development team. * Relocation not out of the question for the right candidates. * Large Django project already in Production. * Scope to move upwards with career path. * Multiple projects on cutting edge applications. Anthony Carmody gmail: carmoda skype : carmoda jabber: carmoda --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
reassessing our Operating System
Hi Everyone. I'm looking at reassessing our Operating System of choice for our Django site, and I really need some background information (popularity & suitability mainly) If you have a minute spare I'd really appreciate some answers to the following questions: (live publicly viewable sites only) 1. What OS are you using to run Django on? 2. What OS do you think is most popular for running Django on? 3. What OS do you think is most suited for running Django on? (non publicly viewable sites) 4. What OS do you think is most suited for developing Django on? Any free form comments on choosing an OS for Django would be much appreciated! ~Love your work in advance. Carmoda --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django Flatpages With Memcache as storage location
OK - fixed it for me, kinda... I was pushing the flatpage content though the textile markup plugin and removing this seemed to fix the 404s. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: using multiple databases
Hi Mike, There is a branch that supports multiple databases in the repository. It's quite out of date in the SVN repo but Koen put in some stirling work over the period of the sprint and produced a patch against trunk at around r6100. Multiple-db support is a feature that is asked for very regularly, unfortunately there have been issues getting the latest changes into the repo so others can use the branch. This is mainly due -as I understand it - to quality of the code, lack of working tests, and the fact that the core devs are busy on other things. I can send you a copy of the patch if you like, or there's an earlier patch attached to ticket 4747 which is the current version I'm using in production. Koen is busy this week I think, but we're probably going to discuss refactoring the multi-db branch to take advantage of recent changes in the backend code in the near future. At present multi-db is usable, and as I said I have it in one of my projects right now. Having said that, it's quite beta and to get the most out of it you're going to have to be pretty happy digging through django's internals. If you are happy doing that we'd love some help with it, as there's still a lot to be done! If you want either patch then send me a mail, and of course if you have any problem/comments/suggestions I'm more than happy to help. Cheers, Ben On 18/09/2007, msoulier <[EMAIL PROTECTED]> wrote: > > > I was hoping to use Django in a web management UI for a server that I > support, where new UIs are added as new applications are installed. > > Due to this plugin requirement, I had planned to model that with one > large Django project, where each new plugin was a Django application. > Unfortunately it would appear that this would not work, as each > application potentially needs its own database, and Django only > permits a single one to be specified. > > In Rails I can specify new dbs at the model level to override the > default. Is there any way to do this in Django? Surely the requirement > for more than one database to drive an entire site's content is > present. > > If not, I could use multiple Django projects, with one project per > plugin, but I would still like to share some common code for inclusion > tags, templates, etc., to ensure that the pages all have the same look > and feel. Is there a recommended way to do this? > > Thank you for any help that you can offer. > > Mike > > > > > -- Regards, Ben Ford [EMAIL PROTECTED] +628111880346 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django Flatpages With Memcache as storage location
I'm having the same problem over here - after checking out the latest svn version (6373), my own middleware flat out broke (response object does not have header instance). When I removed that middleware, all my flat pages are throwing 404's. Super weak. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
notmm-devel-0.2.9p2 now available via Subversion!
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Greetings, I've done some new changes to the notmm toolkit and was thinking to release some new documentation here. [1,2] In a nutshell, the new features are: - The package ``apps.newadmin'' can now be used as a drop-in replacement for ``django.contrib.admin''. [3] - New model implementation upcoming in ``notmm.models'', and possible integration with SQLAlchemy. - New package for Django development and quite useful for unit testing in ``apps.sandbox''. For details, please see the the ``Notes'' section below. Regards, Etienne Notes: 1. The notmm toolkit: http://tools.assembla.com/notmm/ 2. Please don't forget to change ``django.contrib.admin'' to ``apps.newadmin'' in ``INSTALLED_APPS''. 3. It may work according that Django is recent enough.. :] 4. Please reply either on or to -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.5 (FreeBSD) iEYEARECAAYFAkbvPWMACgkQdXKAffkXj4ODrACgwMwrahoveo6F55EpnxSWzbmo NigAn19agTvJ+A3124Su0sW/CcPXq1Ha =4qXL -END PGP SIGNATURE- --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Can't install MySQLdb... any links?
On Sep 17, 9:29 pm, "Austin Govella" <[EMAIL PROTECTED]> wrote: > I tried it again and I get this error: > error: could not create 'build/bdist.macosx-10.3-fat/egg': Permission denied sudo python setup.py install did something, but when I test it (import MySQLdb), I still get an error. Python's help() gives me this error: http://dpaste.com/19934/ Any clues? (Frantically needing to fix his installation... praying to interwebs, imagining minionhood, and beers-owed...) -- Austin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: template inheritance and default text
On Sep 17, 6:12 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > On 9/17/07, bramble <[EMAIL PROTECTED]> wrote: > > > My base.html has this: > > > {% block greeting %}not logged in{% endblock %} > > Personally, I wouldn't use the view for this; I'd do > > {% if user.is_authenticated %}Hello, {{ user.username }}{% else %}Not > logged in{% endif %} > > If you must assign the "greeting" variable in views, I'd do it like so: > > {% if greeting %}{{ greeting }}{% else %}Not logged in{% endif %} > (this way, if the "greeting" variable is not set, you get what you > want Ok. I get it. The variables you set in your view are global to all levels of the template inheritance hierarchy. > -- you could also put "{{ block.super }}" in place of the "Not > logged in" text) Ah. That gets what the parent template had {% block foo %}right here{% endblock %}. Nice. I also now see that the Django "templates" documentation points me to my webapps Admin "Documentation" link which has a tags reference as well. Thanks again. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
using multiple databases
I was hoping to use Django in a web management UI for a server that I support, where new UIs are added as new applications are installed. Due to this plugin requirement, I had planned to model that with one large Django project, where each new plugin was a Django application. Unfortunately it would appear that this would not work, as each application potentially needs its own database, and Django only permits a single one to be specified. In Rails I can specify new dbs at the model level to override the default. Is there any way to do this in Django? Surely the requirement for more than one database to drive an entire site's content is present. If not, I could use multiple Django projects, with one project per plugin, but I would still like to share some common code for inclusion tags, templates, etc., to ensure that the pages all have the same look and feel. Is there a recommended way to do this? Thank you for any help that you can offer. Mike --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Can't install MySQLdb... any links?
My Google fails me. I've been using these sites for help: * http://blog.vixiom.com/2006/07/23/how-to-install-django-on-os-x-tiger-104/ * http://toolmantim.com/article/2006/5/31/installing_django_on_osx * http://www.rhonabwy.com/wp/2006/07/20/installing-django-on-macos-x-development-version/ I ran Tooman Tim's instructions and thought everything was ok. I didn't *see* an error statement, but then again, it was a screen FULL of STUFF... I tried it again and I get this error: error: could not create 'build/bdist.macosx-10.3-fat/egg': Permission denied Any pointers or how-to links? (P.S. Yes, the OS X reinstall totally wiped python, mysql, mysqldb, django, and any other libraries I installed.) Thanks, -- Austin Govella Thinking & Making: http://thinkingandmaking.com Thinking Links: http://thinkingandmaking.com/links --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: uploading to a separate directory
You can not do what you are trying to do, the way you are doing it ;-) The problem is the 'test_name' does not refer to the data on the instance. It just evaluates to the local variable. That means you are constructing that upload_to string at import time. It is the equivalent of doing: foo = models.CharField(maxlength=200) class TestDetail(models.Model): test_name = foo python_file = models.File("Python File", upload_to = 'tests/' + str(foo) + '/') In other words, you can not just have the FileField use data from the particular TestDetail instance. To get around this, you need to create a new type of FileField. An example of doing exactly this can be found here: https://pycon.coderanger.net/browser/django/trunk/pycon/schedule/models.py#L256 NOTE: this is not the best example, and it hard codes using the id of a relation instead of being able to supply a field name, and it also has the limitation of being old-form specific. Hopefully someone else will be able to explain things better than I have. -Doug On Sep 17, 1:17 pm, "Ian Lawrence" <[EMAIL PROTECTED]> wrote: > Hi, > I would like each uploaded test to go into a separate directory in my > media_root. In models.py I have: > > class TestDetail(models.Model): > test_grouping = models.ForeignKey(TestGrouping) > test_name = models.CharField(maxlength=200) > python_file = models.FileField("Python File", > upload_to='tests/%s/' % test_name) > control_file = models.FileField("Control File", > upload_to='tests/%s/' % test_name) > resources = models.FileField("Resource", upload_to='tests/%s/' % > test_name) > def __unicode__(self): > return self.test_name > > class Admin: > list_display = ('test_name',) > > but in the admin this gives me > home/ian/Web/media/tests/ 0x8a3f68c>/fsfuzzer.py > when i try to upload files. This is probably very simple to solve but > i have looked through the docs and googled and nothing seems obvious > yet > thanks > Ian > --http://ianlawrence.info --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: windows vista, localhost server lag (very slow), with zonealarm (even if off...)
Thanks so much for the info. I have been trying to figure it out why it has been taking so long on my local machine. -- Original message -- From: francois <[EMAIL PROTECTED]> > > Oops, forgot to mention this is obviously for the local web sever on > the vista machine ( ie using localhost or 127.0.0.1 urls ) > > On Sep 18, 12:13 am, francois wrote: > > Hello, > > > > This is not a problem coming from Django but it took me some time => > > I post here for other users who would search here for a solution > > > > The problem: > > - few seconds lags on vista for each http request to be considered by > > the server (with the internal server or apache and whatever browser). > > > > A solution found on the net (see link below), works for me: > > - uninstall ZoneAlarm, reboot, choose another firewall > > > > http://www.eggheadcafe.com/software/aspnet/30715202/3-second-lag-when... > > > > francois > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: How to iterate through an int within template ?
On 9/18/07, vincent garonne <[EMAIL PROTECTED]> wrote: > > Hello, > > Does someone knows how to do a loop on a int inside template, e.g. : Well - looping in Django templates is quite similar to looping in Python, so you can't 'loop on an int'. You can loop on a range, though - so if you make pages = range(0,max_page), you will be able to use the template you describe. There was some talk over the sprint weekend about adding a 'repeat' tag, or some equivalent syntax for 'iterate n times'; however, I'm not sure how far that discussion went. Yours, Russ Magee %-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Problem using newforms cleaned_data with Oracle and DateField
Hello I'm a newbie to Django and Python so sorry if this is a dumb mistake on my behalf. I have a model (using an Oracle XE backend): class Survey(models.Model): company = models.ForeignKey(Company, null = False, blank = False) survey_name = models.CharField(max_length = 50, null = False, blank = False) location = models.CharField(max_length = 30, null = False, blank = False) start_date = models.DateField(null = False, blank = False) end_date = models.DateField(null = True, blank = True) and have a view def addEditSurvey(request, id=None): if id is None: SurveyForm = forms.models.form_for_model(Survey) else: survey = Survey.objects.get(id=id) SurveyForm = forms.models.form_for_instance(survey) if request.POST: f = SurveyForm(request.POST) if f.is_valid(): newItem = Survey(company_id=1, survey_name=f.cleaned_data['survey_name'], location=f.cleaned_data['location'],start_date=f.cleaned_data['start_date'], end_date=f.cleaned_data['end_date']) newItem.save() else: f = SurveyForm() return render_to_response('add_survey.html', {'form':f}) The problem is that I am getting "ORA-01722: invalid number" when trying to save the form. Any help would be greatfully appreciated. Catriona --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: windows vista, localhost server lag (very slow), with zonealarm (even if off...)
Oops, forgot to mention this is obviously for the local web sever on the vista machine ( ie using localhost or 127.0.0.1 urls ) On Sep 18, 12:13 am, francois <[EMAIL PROTECTED]> wrote: > Hello, > > This is not a problem coming from Django but it took me some time => > I post here for other users who would search here for a solution > > The problem: > - few seconds lags on vista for each http request to be considered by > the server (with the internal server or apache and whatever browser). > > A solution found on the net (see link below), works for me: > - uninstall ZoneAlarm, reboot, choose another firewall > > http://www.eggheadcafe.com/software/aspnet/30715202/3-second-lag-when... > > francois --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Using a filter with many to many relationship
>> Ok, the query should then be: >> >> Offer.objects.filter(Q(terms__term__exact = 'ThemePark') & >> Q(terms__term__exact = 'London')) > > Still returns an empty query set. Checking some of the other posts I > think this is a failing which is particular to ManyToMany > relationships the problem is that the ORM maps the above to SQL that looks something like SELECT * FROM app_offer o INNER JOIN app_offer_term ot ON o.id = ot.offer_id INNER JOIN app_term t ON ot.term_id = t.id WHERE t.term = 'ThemePark' AND t.term = 'London' That WHERE clause is where the problems originate. You end up asking for "WHERE term = X and term = Y", but X != Y. To get around this, you need to monkey a little under the covers using an extra() call and do something like offers = Offer.objects.all() for term in ('ThemePark', 'London'): offers = offers.extra(where=[""" EXISTS ( SELECT 0 FROM app_offer_term ot ON o.id = ot.offer_id INNER JOIN app_term t ON ot.term_id = t.id WHERE app_offer.id = ot.offer_id AND t.term = %s )"""], params=[term]) You'll have to adjust the table-names and field-names to accomodate your own app/models, but I use this for doing what you describe (AND queries across relations into the same table/row). -tim --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: template inheritance and default text
On 9/17/07, bramble <[EMAIL PROTECTED]> wrote: > My base.html has this: > > {% block greeting %}not logged in{% endblock %} Personally, I wouldn't use the view for this; I'd do {% if user.is_authenticated %}Hello, {{ user.username }}{% else %}Not logged in{% endif %} If you must assign the "greeting" variable in views, I'd do it like so: {% if greeting %}{{ greeting }}{% else %}Not logged in{% endif %} (this way, if the "greeting" variable is not set, you get what you want -- you could also put "{{ block.super }}" in place of the "Not logged in" text) -- "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Directed graph implementations for Django
We use a Tree for the navigation bar (not a true DAG, but there are circular checks): https://pycon.coderanger.net/browser/django/trunk/pycon/navbar/models.py There is a validator IsNotCircular, which does the obvious. There is code to do serialization (currently just a pickle), but there are plans to add json to communicate to the client. The (poor) documentation on using the navbar is here: https://pycon.coderanger.net/wiki/PyCon08/NavBar I have other examples of true DAG's in DB form, but they are very domain specific and take advantage of the limitations in the data. (like the divided room problem where a conference room might have 3 parts which can make a total of 6 'rooms', but have special meaning for room scheduling). But the NavBar is closest to what you are trying to do. On Sep 17, 4:08 pm, "paul.dorman" <[EMAIL PROTECTED]> wrote: > Thanks for your response Julio, > > something similar yes. What I'm after is an Django implementation of > an directed acyclic graph. I understand there's some complexity > involved to ensure no cycles can be created (which I understand is the > graph equivalent of an endless loop). There's plenty of good examples > of DAG out there, but I'm not sure how to implement one that works > with RDMS (or Django for that matter!) > > Paul > > On Sep 17, 4:56 pm, Julio César Carrascal Urquijo > > <[EMAIL PROTECTED]> wrote: > > I'm a newbie on Django my self but maybe this is what you are looking > > for: > > > class Category(models.Model): > > code = models.CharField(maxlength=200, unique=True) > > products = models.ManyToManyField('Product') > > > class Product(models.Model): > > parent = models.ForeignKey('Post') > > code = models.CharField(maxlength=200, unique=True) > > > I've also read that you can specify signals for most operations on a > > model (Like when a model is inserted, updated or deleted from the > > database) though I can't find the URL right now. There's some mention > > of it here: > > >http://www.djangoproject.com/documentation/db-api/ > > > On Sep 16, 9:54 pm, "Paul Dorman" <[EMAIL PROTECTED]> wrote: > > > > Hi all, > > > > definite newbie here. I'd like to implement a category type system in > > > Django. I've looked in the cookbook and Googled a bit, but to no avail. > > > What > > > I'm after should be pretty simple: a directed graph for categories, where > > > objects and perhaps categories can be a member of one or more categories. > > > For example, a 'server' is an 'infrastructure component' (for the > > > techies), > > > as well as an 'asset' (for the financial types). In my grand scheme when > > > an > > > object is associated with one or more categories (one is the minimum), the > > > application will execute method calls stored (with optional parameters) > > > in > > > the database (serialized as JSON or XML). With the 'server' example, it > > > might be that being in the 'infrastructure component' category triggers an > > > email to be sent to the system administrator, and the existence in the > > > 'asset' category would trigger an automated update to the asset register. > > > The methods are stored according to the standard CRUD set of operations, > > > so > > > that a user can create a new category in the view, and then specify > > > actions > > > which occur when an object is created, read, updated, or deleted (provided > > > by the application itself). Actions are triggered for both objects (the > > > things that are categorized) and for child categories (so for example it > > > may > > > be that a parent category can be locked in such a way as to prevent any > > > more > > > child categories from being added). > > > > Note that categories are purely containers with generic actions (for crud > > > operations on objects in the category) and distinct from objects, which I > > > imagine would have a category_id FK. And note also that my objects are all > > > using the same model, with the bulk of data serialized as XML. > > > > Has anyone out there in Djangoland done something like this? The graph's > > > the > > > thing - I'm happy to deal with the CRUD triggers myself. If there's a > > > model > > > out there that would be a good starting point that would be great. > > > > One additional thing I'm wondering about is how Django can work with > > > stored > > > procedures. For example, it might be more efficient if the application can > > > ask the database for the methods to run when an object is created, and > > > have the database return the methods for not only the object's > > > bottom-level > > > category, but for all parent categories as well. > > > > P.S. > > > > Congratulations on the great sprint! > > > > P.P.S. I hope I haven't just embarrassed myself with my naïveté. > > > > -- > > > "Science fiction writers are the only ones who care about the future" > > > -- Kurt Vonnegut --~--~-~--~~~---~--~~ You received this message because you are
[FYI] windows vista, server lag (very slow), with zonealarm (even if off...)
Hello, This is not a problem coming from Django but it took me some time => I post here for other users who would search here for a solution The problem: - few seconds lags on vista for each http request to be considered by the server (with the internal server or apache and whatever browser). A solution found on the net (see link below), works for me: - uninstall ZoneAlarm, reboot, choose another firewall http://www.eggheadcafe.com/software/aspnet/30715202/3-second-lag-when-making.aspx francois --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
template inheritance and default text
I'd like to show a little greeting text on a page that either says either "not logged in", or "hi " (showing the User's name), but am having problems getting the default "not logged in" text show up. My base.html has this: {% block greeting %}not logged in{% endblock %} And the child template contains: {% extends "mysite/base.html" %} {% block greeting %}{{ greeting }}{% endblock %} I figured each view function would check for ``request.user.is_authenticated()`` and then fill in ``greeting`` as required. But the problem is, if I don't set ``greeting`` in the view function, I don't get the default "not logged in" text in the resulting html. What's the customary way to get that default text to show up unless told otherwise? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Directed graph implementations for Django
Thanks for your response Julio, something similar yes. What I'm after is an Django implementation of an directed acyclic graph. I understand there's some complexity involved to ensure no cycles can be created (which I understand is the graph equivalent of an endless loop). There's plenty of good examples of DAG out there, but I'm not sure how to implement one that works with RDMS (or Django for that matter!) Paul On Sep 17, 4:56 pm, Julio César Carrascal Urquijo <[EMAIL PROTECTED]> wrote: > I'm a newbie on Django my self but maybe this is what you are looking > for: > > class Category(models.Model): > code = models.CharField(maxlength=200, unique=True) > products = models.ManyToManyField('Product') > > class Product(models.Model): > parent = models.ForeignKey('Post') > code = models.CharField(maxlength=200, unique=True) > > I've also read that you can specify signals for most operations on a > model (Like when a model is inserted, updated or deleted from the > database) though I can't find the URL right now. There's some mention > of it here: > > http://www.djangoproject.com/documentation/db-api/ > > On Sep 16, 9:54 pm, "Paul Dorman" <[EMAIL PROTECTED]> wrote: > > > Hi all, > > > definite newbie here. I'd like to implement a category type system in > > Django. I've looked in the cookbook and Googled a bit, but to no avail. What > > I'm after should be pretty simple: a directed graph for categories, where > > objects and perhaps categories can be a member of one or more categories. > > For example, a 'server' is an 'infrastructure component' (for the techies), > > as well as an 'asset' (for the financial types). In my grand scheme when an > > object is associated with one or more categories (one is the minimum), the > > application will execute method calls stored (with optional parameters) in > > the database (serialized as JSON or XML). With the 'server' example, it > > might be that being in the 'infrastructure component' category triggers an > > email to be sent to the system administrator, and the existence in the > > 'asset' category would trigger an automated update to the asset register. > > The methods are stored according to the standard CRUD set of operations, so > > that a user can create a new category in the view, and then specify actions > > which occur when an object is created, read, updated, or deleted (provided > > by the application itself). Actions are triggered for both objects (the > > things that are categorized) and for child categories (so for example it may > > be that a parent category can be locked in such a way as to prevent any more > > child categories from being added). > > > Note that categories are purely containers with generic actions (for crud > > operations on objects in the category) and distinct from objects, which I > > imagine would have a category_id FK. And note also that my objects are all > > using the same model, with the bulk of data serialized as XML. > > > Has anyone out there in Djangoland done something like this? The graph's the > > thing - I'm happy to deal with the CRUD triggers myself. If there's a model > > out there that would be a good starting point that would be great. > > > One additional thing I'm wondering about is how Django can work with stored > > procedures. For example, it might be more efficient if the application can > > ask the database for the methods to run when an object is created, and > > have the database return the methods for not only the object's bottom-level > > category, but for all parent categories as well. > > > P.S. > > > Congratulations on the great sprint! > > > P.P.S. I hope I haven't just embarrassed myself with my naïveté. > > > -- > > "Science fiction writers are the only ones who care about the future" > > -- Kurt Vonnegut --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
PyCon-Tech meeting tomorrow!
There will be a PyCon-Tech meeting tomorrow 2pm EST, and we (and by we I mean I) desperately need help getting the proposal system done. I am including the django-users group in hopes that some people from there will be curious and want to help out. Meeting information is here: http://pycon.blogspot.com/2007/09/pycon-tech-meeting-tuesday-september.html A passionate? blog post is here: http://www.dougma.com/archives/47 An overview of the work we need to get done before Oct 1st is here: https://pycon.coderanger.net/milestone/Talk%20Proposal%20Submission -Doug --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: GeoDjango : Error in admin site with geom fields
seems there's a bad trick like this indeed. I'm gonna check this all. Thanks for the clue On 16 sep, 19:38, "Ariel Mauricio Nunez Gomez" <[EMAIL PROTECTED]> wrote: > Did you have a previous geos installation?? > Maybe you have some old .so's that are being linked instead of the new ones. > > Ariel --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
How to iterate through an int within template ?
Hello, Does someone knows how to do a loop on a int inside template, e.g. : ResultPage:: {% for p in pages %} {% ifequal p page %} {{p}} {% else %} {{p}} {% endifequal %} {% endfor %} Where pages is an int. Do i have to use a special filter function ? Cheers, Vincent. -- ---<[EMAIL PROTECTED]> Vincent Garonne http://cern.ch/vincent.garonne CERN PH, CH-1211, Geneva 23, Switzerland Tel. +41 22 76 71181Fax. +41 22 76 78350 --=- --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Using a filter with many to many relationship
What version of django are you using? I am using the latest from svn and this does work for me, however I just looked at your model definitions again and realized that the query I sent you would not work. I didn't notice that in your Offer model the related name is 'searchterms', not 'terms', so if you did not catch that already try: Offer.objects.filter(Q(searchterms__term__exact = 'ThemePark') & Q(searchterms__term__exact = 'London')) , although if it is returning an empty query set and not failing, you probably did catch my error. If this does not work, have you tried instantiating the Terms objects and passing them to the query, (obviously not an efficient way of doing this but may provide some insight into whether or not the m2m query works), i.e. t1 = Terms.objects.get(term__exact = 'ThemePark') t2 = Terms.objects.get(term__exact = 'London') Offer.objects.filter(Q(searchterms = t1) & Q(searchterms = t2)) -richard On 9/17/07, merric <[EMAIL PROTECTED]> wrote: > > > Still returns an empty query set. Checking some of the other posts I > think this is a failing which is particular to ManyToMany > relationships > > > > On Sep 17, 4:33 pm, "Richard Dahl" <[EMAIL PROTECTED]> wrote: > > Ok, the query should then be: > > > > Offer.objects.filter(Q(terms__term__exact = 'ThemePark') & > > Q(terms__term__exact = 'London')) > > > > -richard > > > > On 9/17/07, merric <[EMAIL PROTECTED]> wrote: > > > > > > > > > I only want records that have both the terms, "ThemePark" AND "London" > > > > > The attribute of Terms that contains 'ThemePark' and 'London is simply > > > 'term' > > > > > The full model is: > > > > > class Terms(models.Model): > > > term=models.CharField(maxlength=100,core=True,help_text="search > > > term") > > > def __unicode__(self): > > > return self.search_term > > > > > class Offer(models.Model): > > > searchterms=models.ManyToManyField(Terms,blank=True) > > > > > On Sep 17, 1:52 am, r_f_d <[EMAIL PROTECTED]> wrote: > > > > Couple of things so I understand better, > > > > What is the attribute of term that contains 'ThemePark' and 'London' > ? > > > > What are you trying to end up with, all records with themePark or > only > > > > records with themepark and London ? > > > > -richard > > > > > > On Sep 16, 11:36 am, merric <[EMAIL PROTECTED]> wrote: > > > > > > > I can't get this to work for me. > > > > > > > For example, I have two records which both share the term > 'ThemePark", > > > > > one of these records also has the additional term "London". > > > > > However, when I run your suggestion I get an empty query set. > > > > > > > Cheers > > > > > > > On Sep 15, 2:27 am, r_f_d <[EMAIL PROTECTED]> wrote: > > > > > > > > You are missing Q. > > > > > > > > try > > > > > > from django.db.models import Q (I think that is where it resides > but > > > > > > cannot verify right now, a quick check of the documentation > should > > > > > > confirm) > > > > > > > > Offer.objects.filter(Q(terms__exact = 'term1') & Q(terms__exact > = > > > > > > 'term2') & Q(terms__exact = 'term3)) > > > > > > > > On Sep 14, 6:46 pm, Merric Mercer <[EMAIL PROTECTED]> > wrote: > > > > > > > > > I have a model "OFFER" that has has many to many relationship > with > > > a > > > > > > > model "TERMS". > > > > > > > > > Class OFFER: > > > > > > >terms=models.ManyToMany(Terms) > > > > > > > > > Assuming I have the following value for 3 records in Term > > > > > > > term1=2 > > > > > > > term2=5 > > > > > > > term3=8 > > > > > > > > > I want to return ONLY those offers which have ALL three of > these > > > terms . > > > > > > > I've tried: > > > > > > > > > qs=Offer.objects.all > > > ().filter(terms=term1).filter(terms=term2).filter(terms=term3) > > > > > > > but this doesn't work - I always end up with an empty query > set. > > > > > > > > > What am I missing? > > > > > > > > > Cheers > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Creating link to root
Am Sonntag, 16. September 2007 schrieb Christian Joergensen: > Florian Lindner wrote: > > Hello, > > a common problem I have is that I have references in my main template > > like CSS or an background image: > > > > > > > > This template is used within different paths. Therefore I need to have > > the styles.css availabe in every path the template could be used. > > Couldn't you just do href="/styles.css" ? It works with Konqueror but not with Firefox. Regards, Florian --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Using a filter with many to many relationship
Wouldn't the following code solve the problem without Q objects? Offer.objects.filter(searchterms__term='ThemePark', searchterms__term='London') According to the docs the filter parameters are AND'ed. Admittedly I never used this in combination with ManyToMany fields, so I might be wrong here. peter On 17 Sep., 19:31, "Richard Dahl" <[EMAIL PROTECTED]> wrote: > What version of django are you using? > > I am using the latest from svn and this does work for me, however I just > looked at your model definitions again and realized that the query I sent > you would not work. I didn't notice that in your Offer model the related > name is 'searchterms', not 'terms', so if you did not catch that already > try: > > Offer.objects.filter(Q(searchterms__term__exact = 'ThemePark') & > Q(searchterms__term__exact = 'London')) , although if it is returning an > empty query set and not failing, you probably did catch my error. > > If this does not work, have you tried instantiating the Terms objects and > passing them to the query, (obviously not an efficient way of doing this but > may provide some insight into whether or not the m2m query works), i.e. > > t1 = Terms.objects.get(term__exact = 'ThemePark') > t2 = Terms.objects.get(term__exact = 'London') > Offer.objects.filter(Q(searchterms = t1) & Q(searchterms = t2)) > > -richard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Using a filter with many to many relationship
Still returns an empty query set. Checking some of the other posts I think this is a failing which is particular to ManyToMany relationships On Sep 17, 4:33 pm, "Richard Dahl" <[EMAIL PROTECTED]> wrote: > Ok, the query should then be: > > Offer.objects.filter(Q(terms__term__exact = 'ThemePark') & > Q(terms__term__exact = 'London')) > > -richard > > On 9/17/07, merric <[EMAIL PROTECTED]> wrote: > > > > > I only want records that have both the terms, "ThemePark" AND "London" > > > The attribute of Terms that contains 'ThemePark' and 'London is simply > > 'term' > > > The full model is: > > > class Terms(models.Model): > > term=models.CharField(maxlength=100,core=True,help_text="search > > term") > > def __unicode__(self): > > return self.search_term > > > class Offer(models.Model): > > searchterms=models.ManyToManyField(Terms,blank=True) > > > On Sep 17, 1:52 am, r_f_d <[EMAIL PROTECTED]> wrote: > > > Couple of things so I understand better, > > > What is the attribute of term that contains 'ThemePark' and 'London' ? > > > What are you trying to end up with, all records with themePark or only > > > records with themepark and London ? > > > -richard > > > > On Sep 16, 11:36 am, merric <[EMAIL PROTECTED]> wrote: > > > > > I can't get this to work for me. > > > > > For example, I have two records which both share the term 'ThemePark", > > > > one of these records also has the additional term "London". > > > > However, when I run your suggestion I get an empty query set. > > > > > Cheers > > > > > On Sep 15, 2:27 am, r_f_d <[EMAIL PROTECTED]> wrote: > > > > > > You are missing Q. > > > > > > try > > > > > from django.db.models import Q (I think that is where it resides but > > > > > cannot verify right now, a quick check of the documentation should > > > > > confirm) > > > > > > Offer.objects.filter(Q(terms__exact = 'term1') & Q(terms__exact = > > > > > 'term2') & Q(terms__exact = 'term3)) > > > > > > On Sep 14, 6:46 pm, Merric Mercer <[EMAIL PROTECTED]> wrote: > > > > > > > I have a model "OFFER" that has has many to many relationship with > > a > > > > > > model "TERMS". > > > > > > > Class OFFER: > > > > > >terms=models.ManyToMany(Terms) > > > > > > > Assuming I have the following value for 3 records in Term > > > > > > term1=2 > > > > > > term2=5 > > > > > > term3=8 > > > > > > > I want to return ONLY those offers which have ALL three of these > > terms . > > > > > > I've tried: > > > > > > > qs=Offer.objects.all > > ().filter(terms=term1).filter(terms=term2).filter(terms=term3) > > > > > > but this doesn't work - I always end up with an empty query set. > > > > > > > What am I missing? > > > > > > > Cheers --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: how to put a cookie which is visible from all domains
Found the answer, The session middleware sets a cookie, using this code(http:// code.djangoproject.com/browser/django/trunk/django/contrib/sessions/ middleware.py ) 42 response.set_cookie(settings.SESSION_COOKIE_NAME, request.session.session_key, 43 max_age=max_age, expires=expires, domain=settings.SESSION_COOKIE_DOMAIN, 44 secure=settings.SESSION_COOKIE_SECURE or None) Putting SESSION_COOKIE_DOMAIN = '.example.tld' in settings.py solves the problem. On Sep 17, 6:06 pm, shabda <[EMAIL PROTECTED]> wrote: > If I have my site setup at example.tld and I have used the built in > django authentication system, any page at foo.example.tld (or any > subdomain of example.tld) is not able to access the user. So if the > view is accesed from a subdomain the login_required or other > decorators fail. It looks to me that this could be because the cookies > are set for example.com and not *.example.com. > What can I do so that a logged in user is logged in from all > subdomains? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: ModelChoiceField default value
initial works for me, however, you must set the initial by the id of the record not the instance, i.e. forms.ModelChoiceField(queryset=Bullet.objects.filter(fk_day=day_id), initial = Bullet.objects.get(pk = day_id).id) -richard On 9/17/07, Rufman <[EMAIL PROTECTED]> wrote: > > > how can i make one of the options in a select the default. (i > previously changed the select widget so that it only shows a selection > of options). > > my code: > ModifyComment.base_fields['fk_bullet'] = > forms.ModelChoiceField(queryset=Bullet.objects.filter(fk_day=day_id)) > > i what one of the options in the querset to be the default or initial > value. using initial doesn't work with ModelChoiceFiel. Does anyone > know which other attribute i could use? > > stephane > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Using a filter with many to many relationship
Ok, the query should then be: Offer.objects.filter(Q(terms__term__exact = 'ThemePark') & Q(terms__term__exact = 'London')) -richard On 9/17/07, merric <[EMAIL PROTECTED]> wrote: > > > I only want records that have both the terms, "ThemePark" AND "London" > > The attribute of Terms that contains 'ThemePark' and 'London is simply > 'term' > > The full model is: > > class Terms(models.Model): > term=models.CharField(maxlength=100,core=True,help_text="search > term") > def __unicode__(self): > return self.search_term > > class Offer(models.Model): > searchterms=models.ManyToManyField(Terms,blank=True) > > > > > On Sep 17, 1:52 am, r_f_d <[EMAIL PROTECTED]> wrote: > > Couple of things so I understand better, > > What is the attribute of term that contains 'ThemePark' and 'London' ? > > What are you trying to end up with, all records with themePark or only > > records with themepark and London ? > > -richard > > > > On Sep 16, 11:36 am, merric <[EMAIL PROTECTED]> wrote: > > > > > I can't get this to work for me. > > > > > For example, I have two records which both share the term 'ThemePark", > > > one of these records also has the additional term "London". > > > However, when I run your suggestion I get an empty query set. > > > > > Cheers > > > > > On Sep 15, 2:27 am, r_f_d <[EMAIL PROTECTED]> wrote: > > > > > > You are missing Q. > > > > > > try > > > > from django.db.models import Q (I think that is where it resides but > > > > cannot verify right now, a quick check of the documentation should > > > > confirm) > > > > > > Offer.objects.filter(Q(terms__exact = 'term1') & Q(terms__exact = > > > > 'term2') & Q(terms__exact = 'term3)) > > > > > > On Sep 14, 6:46 pm, Merric Mercer <[EMAIL PROTECTED]> wrote: > > > > > > > I have a model "OFFER" that has has many to many relationship with > a > > > > > model "TERMS". > > > > > > > Class OFFER: > > > > >terms=models.ManyToMany(Terms) > > > > > > > Assuming I have the following value for 3 records in Term > > > > > term1=2 > > > > > term2=5 > > > > > term3=8 > > > > > > > I want to return ONLY those offers which have ALL three of these > terms . > > > > > I've tried: > > > > > > > qs=Offer.objects.all > ().filter(terms=term1).filter(terms=term2).filter(terms=term3) > > > > > but this doesn't work - I always end up with an empty query set. > > > > > > > What am I missing? > > > > > > > Cheers > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: manage.py dumpdata && loaddata -- problem with datetime fields
On 9/17/07, Rob J Goedman <[EMAIL PROTECTED]> wrote: > > Hi Russ, > > Yes, I use Postgres 8.2.3 on Mac OS. Sorry - just to clarify - does this mean you _are_ seeing the problem on Postgres? > I think reverting back to revision 6329 fixes this problem as well. > Date/time stamps are then neatly written with just :SS > (not as HH:MM:SS.123456). I see this with SQLite, but not Postgres 8.1, both on Mac OS. > Hope this helps, thank you (and all other developers) for > such a great framework! You're most welcome. And thanks for being patient when we inadvertently bust something up :-) Yours, Russ Magee %-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: manage.py dumpdata && loaddata -- problem with datetime fields
Hi Russ, Yes, I use Postgres 8.2.3 on Mac OS. I think reverting back to revision 6329 fixes this problem as well. Date/time stamps are then neatly written with just :SS (not as HH:MM:SS.123456). Hope this helps, thank you (and all other developers) for such a great framework! Rob On Sep 17, 2007, at 8:06 AM, Russell Keith-Magee wrote: > > On 9/17/07, Rob J Goedman <[EMAIL PROTECTED]> wrote: >> >> This is the same problem as I found earlier and below steps will >> reproduce it and with an empty project (no log_entries etc, just 1 >> superuser) it is fixed by removing the subseconds. > > Ok - thanks for that. I can reproduce this problem with SQLite, but > not with Postgres. Does this concur with your experience? > > The really strange thing is that I'm not seeing any failures in the > serialization regression tests this will require some digging. > > Yours, > Russ Magee %-) > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Using a filter with many to many relationship
I only want records that have both the terms, "ThemePark" AND "London" The attribute of Terms that contains 'ThemePark' and 'London is simply 'term' The full model is: class Terms(models.Model): term=models.CharField(maxlength=100,core=True,help_text="search term") def __unicode__(self): return self.search_term class Offer(models.Model): searchterms=models.ManyToManyField(Terms,blank=True) On Sep 17, 1:52 am, r_f_d <[EMAIL PROTECTED]> wrote: > Couple of things so I understand better, > What is the attribute of term that contains 'ThemePark' and 'London' ? > What are you trying to end up with, all records with themePark or only > records with themepark and London ? > -richard > > On Sep 16, 11:36 am, merric <[EMAIL PROTECTED]> wrote: > > > I can't get this to work for me. > > > For example, I have two records which both share the term 'ThemePark", > > one of these records also has the additional term "London". > > However, when I run your suggestion I get an empty query set. > > > Cheers > > > On Sep 15, 2:27 am, r_f_d <[EMAIL PROTECTED]> wrote: > > > > You are missing Q. > > > > try > > > from django.db.models import Q (I think that is where it resides but > > > cannot verify right now, a quick check of the documentation should > > > confirm) > > > > Offer.objects.filter(Q(terms__exact = 'term1') & Q(terms__exact = > > > 'term2') & Q(terms__exact = 'term3)) > > > > On Sep 14, 6:46 pm, Merric Mercer <[EMAIL PROTECTED]> wrote: > > > > > I have a model "OFFER" that has has many to many relationship with a > > > > model "TERMS". > > > > > Class OFFER: > > > >terms=models.ManyToMany(Terms) > > > > > Assuming I have the following value for 3 records in Term > > > > term1=2 > > > > term2=5 > > > > term3=8 > > > > > I want to return ONLY those offers which have ALL three of these terms . > > > > I've tried: > > > > > qs=Offer.objects.all().filter(terms=term1).filter(terms=term2).filter(terms=term3) > > > > but this doesn't work - I always end up with an empty query set. > > > > > What am I missing? > > > > > Cheers --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
How to run server after install Django
Hi,every django wizards, Plz allow me to ask a so stupid question. After I install the Django according to the documents,and built the directory by using "django- admin.py startproject MYWEB" . There is something wrong with the command" manage.py runserver". After input this command,the screen shows that "import error:no module named MYWEB" BTW.Alougth I used "setup.py install" to setup the django, django- admin.py cannot be found in system path. I found it in the site- packages,and copy it to a path that I want to mk a myweb dir. operation system:winxp sp2 python:2.51 django:0.96 What's wrong,plz tell me how can I cope with this problem.Thank you very much. kind regards, Han --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: manage.py dumpdata && loaddata -- problem with datetime fields
On 9/17/07, Rob J Goedman <[EMAIL PROTECTED]> wrote: > > This is the same problem as I found earlier and below steps will > reproduce it and with an empty project (no log_entries etc, just 1 > superuser) it is fixed by removing the subseconds. Ok - thanks for that. I can reproduce this problem with SQLite, but not with Postgres. Does this concur with your experience? The really strange thing is that I'm not seeing any failures in the serialization regression tests this will require some digging. Yours, Russ Magee %-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: manage.py dumpdata && loaddata -- problem with datetime fields
On 17 Wrz, 16:45, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > Perhaps I wasn't clear - I need the actual _data_ - that is, your > model, and a fixture file that can't load. I know how to load a > fixture - what I don't know is what fixture contents will make a > fixture fail in the way you describe. The fixture: http://dpaste.com/hold/19856/ I haven't defined any custom models, and the only apps enabled in settings.py are auth and contenttypes. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: manage.py dumpdata && loaddata -- problem with datetime fields
On 9/17/07, Tomasz Melcer <[EMAIL PROTECTED]> wrote: > > On 17 Wrz, 15:16, "Russell Keith-Magee" <[EMAIL PROTECTED]> > wrote: > > We have a fairly extensive unit test suite around serialization > > formats; as a result, I'm not aware of any problems of this sort. > > > > Can you provide a minimal example that reproduces this problem? i.e., > > can you provide an example model and a JSON data fixture that can't be > > loaded? > Sure. ... > My output is at http://dpaste.com/hold/19854/ Perhaps I wasn't clear - I need the actual _data_ - that is, your model, and a fixture file that can't load. I know how to load a fixture - what I don't know is what fixture contents will make a fixture fail in the way you describe. Yours, Russ Magee %-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: manage.py dumpdata && loaddata -- problem with datetime fields
On 17 Wrz, 16:45, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On 9/17/07, Tomasz Melcer <[EMAIL PROTECTED]> wrote: > Perhaps I wasn't clear - I need the actual _data_ - that is, your > model, and a fixture file that can't load. I know how to load a > fixture - what I don't know is what fixture contents will make a > fixture fail in the way you describe. http://dpaste.com/hold/19856/ This is what i get from `./manage.py dumpdata` --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
parent child question
class Category(models.Model): name = models.CharField(maxlength=70) parent = models.ForeignKey('self', blank=True, null=True, limit_choices_to = {'parent__isnull': True}) I dont want to be able to select a parent which is actualy the category currently edited. I tried a custom validator but I dont have access to the category_id. So I tried a custom manipulator but I couldn't fix it to work in admin The only possible solution I have now is the raise an error in the custom save method, which is a terrible ugly solution. Does anyone have a pointer to a simple method to extend the automatic manipulator??? Thanks, Rob --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Today's newform-admin branch, svn version 6364
Reverting to 6329 will fix it. Must have gotten introduced during the merge to 6332. Regards, Rob On Sep 17, 2007, at 6:18 AM, AndyB wrote: > On Sep 16, 8:56 pm, Rob J Goedman <[EMAIL PROTECTED]> wrote: >> Hi, >> >> Today's version shows 2 problems, the first problem is related to >> date/time formats in fixtures, the 2nd to at least add forms, >> e.g. add users. Both using the newform-admin branch. >> >> The 1st problem can be created by installing a brand new project, >> creating an initial_data.json file and run ./manage syncdb again >> (or ./manage loaddata initial_data.json): >> >> Robs-Intel:~/Projects/o2o/mcp rob$ ./manage.py syncdb >> ... >> Installing index for auth.Message model >> Installing index for auth.Permission model >> Installing index for admin.LogEntry model >> Loading 'initial_data' fixtures... >> Installing json fixture 'initial_data' from absolute path. >> Problem installing fixture 'initial_data.json': [u'Enter a valid >> date/ >> time in -MM-DD HH:MM format.'] >> >> Looking at the initial_data.json file I think it complains about >> timestamps such as '2007-09-16 12:34:51.765432'. Removing the sub- >> second parts fixes it, it accepts a :SS component. This happen in >> user and some other fixture json records (e.g. log_entries). >> --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: manage.py dumpdata && loaddata -- problem with datetime fields
This is the same problem as I found earlier and below steps will reproduce it and with an empty project (no log_entries etc, just 1 superuser) it is fixed by removing the subseconds. Regards, Rob On Sep 16, 8:56 pm, Rob J Goedman <[EMAIL PROTECTED]> wrote: > Hi, > > Today's version shows 2 problems, the first problem is related to > date/time formats in fixtures, the 2nd to at least add forms, > e.g. add users. Both using the newform-admin branch. > > The 1st problem can be created by installing a brand new project, > creating an initial_data.json file and run ./manage syncdb again > (or ./manage loaddata initial_data.json): > > Robs-Intel:~/Projects/o2o/mcp rob$ ./manage.py syncdb > ... > Installing index for auth.Message model > Installing index for auth.Permission model > Installing index for admin.LogEntry model > Loading 'initial_data' fixtures... > Installing json fixture 'initial_data' from absolute path. > Problem installing fixture 'initial_data.json': [u'Enter a valid date/ > time in -MM-DD HH:MM format.'] > > Looking at the initial_data.json file I think it complains about > timestamps such as '2007-09-16 12:34:51.765432'. Removing the sub- > second parts fixes it, it accepts a :SS component. This happen in > user and some other fixture json records (e.g. log_entries). ... On Sep 17, 2007, at 7:21 AM, Tomasz Melcer wrote: > > On 17 Wrz, 15:16, "Russell Keith-Magee" <[EMAIL PROTECTED]> > wrote: >> We have a fairly extensive unit test suite around serialization >> formats; as a result, I'm not aware of any problems of this sort. >> >> Can you provide a minimal example that reproduces this problem? i.e., >> can you provide an example model and a JSON data fixture that >> can't be >> loaded? > Sure. > > The testcase (a bash script) is at http://dpaste.com/hold/19852/ > Run it by invoking: > DJANGO_LOC=path-to-django-working-copy ./testcase > And enter some data when asked by manage.py (answering "yes" to first > question). I couldn't make the script answer these questions > automatically, because manage.py is calling ioctls. The script will > make a project from scratch, using a temporary database in /tmp. > > My output is at http://dpaste.com/hold/19854/ > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: manage.py dumpdata && loaddata -- problem with datetime fields
On 17 Wrz, 15:16, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > We have a fairly extensive unit test suite around serialization > formats; as a result, I'm not aware of any problems of this sort. > > Can you provide a minimal example that reproduces this problem? i.e., > can you provide an example model and a JSON data fixture that can't be > loaded? Sure. The testcase (a bash script) is at http://dpaste.com/hold/19852/ Run it by invoking: DJANGO_LOC=path-to-django-working-copy ./testcase And enter some data when asked by manage.py (answering "yes" to first question). I couldn't make the script answer these questions automatically, because manage.py is calling ioctls. The script will make a project from scratch, using a temporary database in /tmp. My output is at http://dpaste.com/hold/19854/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: How to automatically apply a method to all fields in newforms subclass?
Just revisiting this thread... On 9/14/07, Doug B <[EMAIL PROTECTED]> wrote: > > I think you can make a custom form field to do your validation check > for you. > > def StrippedField(forms.CharField): > def clean(self,value): > #do your validation here While the solution above would work and I have been using that as well, I found that there were times that I needed to perform some post-validation stuff on the field data. The fields would be of different types but the post-validation operations would be the same. I did not find it entirely appealing to have to create an entire set of subclasses to do this, i.e.: SpecialCharField(forms.CharField) SpecialBooleanField(forms.BooleanField) etc... or the alternative way by using clean_FIELDNAME() So I was looking for a more generic way of iterating through all or selected fields and applying a method that modifies their contents. After looking around a bit in ASPN, I decided to go with a method factory: class StrippedFieldsForm(forms.Form): stripped_fields = [] def __init__(self, *args, **kwargs): super(StrippedFieldsForm, self).__init__(*args, **kwargs) for name in self.fields: setattr(StrippedFieldsForm, 'clean_%s' % name, self.clean_field_factory(name)) def clean_field_factory(self, name): def _strip_field(self): field = self.fields[name] label = self.fields[name].label or name return self.strip_field(name, label + ' is empty.') return _strip_field def strip_field(self, field, error_message): if (self.clean_data.get(field)): data = self.clean_data[field].strip() if (0 == len(data)): raise forms.ValidationError(error_message) else: return data else: return '' It looks like a lot of work to implement and seems sort of pointless as I'm sure that the subclass way is preferred in most cases. But in my case, I needed to be able to swap out strip_field() with something else on a case-by-case basis. As always, am open to using a better solution, but for the moment this works for me. Hope someone finds this useful. -- _nimrod_a_abing_ http://abing.gotdns.com/ http://www.preownedcar.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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
ModelChoiceField default value
how can i make one of the options in a select the default. (i previously changed the select widget so that it only shows a selection of options). my code: ModifyComment.base_fields['fk_bullet'] = forms.ModelChoiceField(queryset=Bullet.objects.filter(fk_day=day_id)) i what one of the options in the querset to be the default or initial value. using initial doesn't work with ModelChoiceFiel. Does anyone know which other attribute i could use? stephane --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Today's newform-admin branch, svn version 6364
Yep. Spotted your second point. All my admin change pages are broken. Going to revert unless anyone knows a quick fix. On Sep 16, 8:56 pm, Rob J Goedman <[EMAIL PROTECTED]> wrote: > Hi, > > Today's version shows 2 problems, the first problem is related to > date/time formats in fixtures, the 2nd to at least add forms, > e.g. add users. Both using the newform-admin branch. > > The 1st problem can be created by installing a brand new project, > creating an initial_data.json file and run ./manage syncdb again > (or ./manage loaddata initial_data.json): > > Robs-Intel:~/Projects/o2o/mcp rob$ ./manage.py syncdb > ... > Installing index for auth.Message model > Installing index for auth.Permission model > Installing index for admin.LogEntry model > Loading 'initial_data' fixtures... > Installing json fixture 'initial_data' from absolute path. > Problem installing fixture 'initial_data.json': [u'Enter a valid date/ > time in -MM-DD HH:MM format.'] > > Looking at the initial_data.json file I think it complains about > timestamps such as '2007-09-16 12:34:51.765432'. Removing the sub- > second parts fixes it, it accepts a :SS component. This happen in > user and some other fixture json records (e.g. log_entries). > > The 2nd problem, also testable in a brand new project, e.g. trying to > add a user: > > TypeError at /admin/auth/user/add/ > instancemethod expected at least 2 arguments, got 0 > > Request Method: > GET > Request URL:http://localhost:8000/admin/auth/user/add/ > Exception Type: > TypeError > Exception Value: > instancemethod expected at least 2 arguments, got 0 > Exception Location: > /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ > copy_reg.py in __newobj__, line 92 > Python Executable: > /Library/Frameworks/Python.framework/Versions/2.5/Resources/ > Python.app/Contents/MacOS/Python > Python Version: > 2.5.1 > Traceback (innermost last) > > Switch to copy-and-paste view > > /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- > packages/django/core/handlers/base.py in _real_get_response > response = callback(request, *callback_args, > **callback_kwargs) > ... > ▶ Local vars > > Regards, > Rob --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
how to put a cookie which is visible from all domains
If I have my site setup at example.tld and I have used the built in django authentication system, any page at foo.example.tld (or any subdomain of example.tld) is not able to access the user. So if the view is accesed from a subdomain the login_required or other decorators fail. It looks to me that this could be because the cookies are set for example.com and not *.example.com. What can I do so that a logged in user is logged in from all subdomains? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Stale session timings
I have a Django FastCGI setup with 5 processes, backed by Postgres, and I am seeing a problem with stale session data between the processes. This is using the latest SVN checkout (r6369 at the moment), though I've been seeing this for a while now. What happens is that I will set a session value in one process, and when that value is read out of another process, it is using an older, stale value. 2007-09-17 07:00:48,406 577 DEBUG CAPTCHA setting session with [MWOSYF] 2007-09-17 07:00:54,889 577 DEBUG read CAPTCHA from session [MWOSYF] 2007-09-17 07:00:55,151 581 DEBUG CAPTCHA setting session with [ONCLCL] 2007-09-17 07:01:01,313 581 DEBUG read CAPTCHA from session [ONCLCL] 2007-09-17 07:01:01,549 581 DEBUG CAPTCHA setting session with [WDTOZF] 2007-09-17 07:01:07,126 577 DEBUG read CAPTCHA from session [ONCLCL] This is a simple app that is setting a session value using "request.session['captcha'] = captext', and then reading it out equally simply using "captext = request.session['captcha']". As can be seen from the debug output, the first time both the set and read are run from the same PID, about 6 seconds apart, and it works fine. Likewise, the second time both halves are in the same (but new) PID, about 6 seconds apart, and it still works fine. The third time, the set is in one PID and the read in another, again about 6 seconds apart, and the read is getting an old value. Not only is it getting a stale value, but it's getting a stale value from a different PID (as opposed to a stale value which matches the last request in its own PID). So it *is* getting updated session data from the other processes, it just apparently lags behind sometimes, or else fails entirely to recognize that there is new session data available. In my setup, this appears to sometimes work and sometimes not work between PIDs. Rather, it most often works fine, but fails often enough to be annoying. So I guess my questions are 1) Is this expected behavior? i.e. is it expected for session data to lag between processes? 2) If not expected, any thoughts on what would be causing this? Or has anyone else seen similar issues? I checked Trac but did not find anything that looked similar. Thanks... - Keith --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: manage.py dumpdata && loaddata -- problem with datetime fields
On 9/17/07, Tomasz Melcer <[EMAIL PROTECTED]> wrote: > > Hello, > > I am trying to prepare a fixture with testing data. I can export data > from database using: > > ./manage.py dumpdata >initial_data.json > > but when importing the data using: > > ./manage.py syncdb > > I get: > > Loading 'initial_data' fixtures... > Installing json fixture 'initial_data' from absolute path. > Problem installing fixture 'initial_data.json': [u'Enter a valid date/ > time in -MM-DD HH:MM format.'] We have a fairly extensive unit test suite around serialization formats; as a result, I'm not aware of any problems of this sort. Can you provide a minimal example that reproduces this problem? i.e., can you provide an example model and a JSON data fixture that can't be loaded? > And this happens even when no custom applications are used (only the > auth and contenttypes from django.contrib) in settings.py. I am using > django svn-head with python 2.5.1. It would also help to know the exact SVN revision. 'svn-head' could describe many things. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
manage.py dumpdata && loaddata -- problem with datetime fields
Hello, I am trying to prepare a fixture with testing data. I can export data from database using: ./manage.py dumpdata >initial_data.json but when importing the data using: ./manage.py syncdb I get: Loading 'initial_data' fixtures... Installing json fixture 'initial_data' from absolute path. Problem installing fixture 'initial_data.json': [u'Enter a valid date/ time in -MM-DD HH:MM format.'] And this happens even when no custom applications are used (only the auth and contenttypes from django.contrib) in settings.py. I am using django svn-head with python 2.5.1. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Macports Django install - which way?
On 9/17/07, Dave E <[EMAIL PROTECTED]> wrote: > > After reading about other OS X user's Django install problems, I'm > attempting to write up the simplest, clearest possible, completely > unambiguous, instructions for other OS X users here: > http:ecoconsulting.co.uk/python/django-install.txt > but obviously I need to get it right first, and... We're always open to documentation improvements; thanks for offering to help. > ...I've hit problems with Macports, detailed below. But I can't find > anywhere how to install Django from within Python (like Perl's CPAN), > and Macports is actually suggested on the Django site. If you're installing from a downloaded version of Django (rather than macports) The standard 'python setup.py install' will work, and will install Django into the site-packages of whichever python install is on the path at the time. Macports is listed as one of the 'prepackaged installations' that may be helpful if you're on a Mac. However, its not the only way to go. Personally, I find Macports to be a very useful way of getting the support libraries in place - in particular, Postgres, which doesn't provide native Mac installers. I use an svn checkout of Django rather than the ports version. The instructions you provide will depend on how you satisfy your dependencies. Ultimately, you will need to install: 1) Python 2) A database 3) A database Python library 4) Django code. Macports can be used to provide any of these; personally, I use Macports to provide 1-3. As a guideline, this is what is in my .profile: export PATH=/opt/local/bin:/opt/local/sbin:$PATH export PATH=/opt/local/lib/pgsql8/bin:$PATH export PATH=/opt/local/lib/python2.4/site-packages/django/bin:$PATH export PATH=/opt/local/Library/Frameworks/Python.framework/Versions/2.4/bin:$PATH > I know OS X needs Python elswhere (and I now appear to have 2 Pythons) > but the running one doesn't have Django in its 'site-packages' dir. Define 'needs'. OS X provides Python, but doesn't really use it at a core level. It's not tightly bound to the OS or anything - it's just there to fill the promise that OSX is 'based on Unix'. > Looks like I might have to forget Macports and install Django manually > under the OS X Python (or copy it across), but will this risk being > mangled by OS X updates? And is there an easy Python 'install django' > command? As before - yes; python setup.py install in the Django directory. The bigger problem is coming up with an easy answer for 'how to install Postgres' (or any other database). The Apple knowledge base on setting Postgres starts with 'download the Postgres source tarball', which isn't a particularly attractive option to me. Then you need to deal with compiling the psycopg backends, etc. For my money, 'port install py-psycopg2' and setting up a few paths is much easier. If you find (or know of) a good set of Postgres/MySQL binaries for OSX (including Python bindings), this problem goes away. However, I haven't been able to find such a beast. > --- > About Macports: > > Macports is a good idea (easy installs and updates, preserves Apple > stuff, keeps new stuff separate from getting mashed by Apple updates) > but the Python it installs isn't in the place OS X expects it to be, > so can't be used easily. Depends on your definition of easily. I can't say I had much difficulty setting up my .profile, but I'm coming from a unix background, so I'm used to that sort of thing. Yours, Russ Magee %-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django + Twitter?
Thanks for your reply. Indeed, there is a nice Twitter API and I've already managed to connect to twitter and get some meaningful output. Twitter does indeed have an ID for each entry, so that part should be trivial. So I suppose I'll do something like this: get latest entry id from database for entry in twitter_entries: if entry id == latest entry id stop otherwise, add entry to list/dictionary add entries from list, if any, to database to preserve chronological order. all done! Hm, seems too easy. I really needed a nudge in the right direction as although I understand parts of what I'm about to do, I wasn't very clear about how to put the pieces together. I might report later to get confirmation that I'm really doing this the right way, and for reference for others who might not know where to start. Thanks again Björn On Sep 17, 11:47 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Mon, 2007-09-17 at 09:41 +, bjornkri wrote: > > [...] > > > My initial guess would be to create a model for twitter entries, and > > then run a cron job that checks twitter every now and then, adding > > entries into the django database when they are found. > > Seems reasonable. > > > In theory, I understand this (or at least I think I do), but in > > practice I'm completely lost. How do I make sure I'm not getting > > duplicate entries? > > The usual answer to questions like this is another question: "what > constitutes a duplicate entry?" Once you know how to determine that two > messages are duplicates, you can work out what you need to check to > ensure you aren't processing any duplicates. Do messages come with some > kind of twitter-supplied unique id? Is the text of the message plus its > timestamp all you've got? In the latter case, you could make those two > fields unique_together, or you could compute a hash based on this unique > information and use that as the primary key or some other unique field. > > > How often should I sync? How do I do that? > > That's not really Django related. Twitter might have something in their > API docs about recommended or maxium allowable frequency. As to how, why > isn't it as simple as making a network connection and using the standard > Twitter developer's API, which is documented on the twitter site? If you > don't yet know how to do network interaction like that, it's essentially > the equivalent of retrieving a web page using Python's network libraries > (although at the socket level, rather than using urllib2). So look for > tutorials on, say, the socket library, or look at how urllib2 or urllib > retrieves HTTP data for examples. > > Regards, > Malcolm > > -- > Honk if you love peace and quiet.http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Macports Django install - which way?
On 17-Sep-07, at 4:12 PM, Dave E wrote: > After reading about other OS X user's Django install problems, I'm > attempting to write up the simplest, clearest possible, completely > unambiguous, instructions for other OS X users here: > http:ecoconsulting.co.uk/python/django-install.txt > but obviously I need to get it right first, and... first comment: please do something with wordwrap - in firefox on a mac, I have to keep scrolling left and right > > ...I've hit problems with Macports, detailed below. But I can't find > anywhere how to install Django from within Python (like Perl's CPAN), > and Macports is actually suggested on the Django site. second comment: MacOS is just a BSD - so the installation is just as straightforward as an installation on Linux except that some paths are slightly different. third: you havent touched the database installation part. and, finally, it is best to run django from the latest svn, so just following the basic linux installation instructions for django from the tutorial would be the ideal way of installing django on a Mac. If you *do* install django from Macports, you have no control over the version you are using. So for the django part - just an svn co and a symlink to the python site-packages directory is all you need. -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Macports Django install - which way?
After reading about other OS X user's Django install problems, I'm attempting to write up the simplest, clearest possible, completely unambiguous, instructions for other OS X users here: http:ecoconsulting.co.uk/python/django-install.txt but obviously I need to get it right first, and... ...I've hit problems with Macports, detailed below. But I can't find anywhere how to install Django from within Python (like Perl's CPAN), and Macports is actually suggested on the Django site. - The steps I took: 1. Install Python 2.5 from the OS X binary at: http://www.python.org/ftp/python/2.5.1/python-2.5.1-macosx.dmg End up with the following - good so far: python -V:Python 2.5.1 which python:/Library/Frameworks/Python.framework/Versions/Current/bin/ python The OS X package appears to have replaced Apple's Python 2.3 with 2.5.1 successfully. 2. Use Macports to install Django 0.96: sudo port install py25-django-devel Add the Macports path to my .bash_login (and remove .profile): export PATH=/opt/local/bin:/opt/local/sbin:$PATH End up with the following: django-admin.py gives: (the expected screen of stuff) but >>> import django gives: ImportError: No module named django. The problem: While installing Django, the Macports dependency thing also installs Python 2.5 under /opt/local/lib/python2.5/ I know OS X needs Python elswhere (and I now appear to have 2 Pythons) but the running one doesn't have Django in its 'site-packages' dir. Looks like I might have to forget Macports and install Django manually under the OS X Python (or copy it across), but will this risk being mangled by OS X updates? And is there an easy Python 'install django' command? --- About Macports: Macports is a good idea (easy installs and updates, preserves Apple stuff, keeps new stuff separate from getting mashed by Apple updates) but the Python it installs isn't in the place OS X expects it to be, so can't be used easily. The Django site itself suggests Macports, but fails to say that the install won't be where the OS X Python expects it to be. Dave Everitt --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django + Twitter?
On Mon, 2007-09-17 at 09:41 +, bjornkri wrote: [...] > My initial guess would be to create a model for twitter entries, and > then run a cron job that checks twitter every now and then, adding > entries into the django database when they are found. Seems reasonable. > In theory, I understand this (or at least I think I do), but in > practice I'm completely lost. How do I make sure I'm not getting > duplicate entries? The usual answer to questions like this is another question: "what constitutes a duplicate entry?" Once you know how to determine that two messages are duplicates, you can work out what you need to check to ensure you aren't processing any duplicates. Do messages come with some kind of twitter-supplied unique id? Is the text of the message plus its timestamp all you've got? In the latter case, you could make those two fields unique_together, or you could compute a hash based on this unique information and use that as the primary key or some other unique field. > How often should I sync? How do I do that? That's not really Django related. Twitter might have something in their API docs about recommended or maxium allowable frequency. As to how, why isn't it as simple as making a network connection and using the standard Twitter developer's API, which is documented on the twitter site? If you don't yet know how to do network interaction like that, it's essentially the equivalent of retrieving a web page using Python's network libraries (although at the socket level, rather than using urllib2). So look for tutorials on, say, the socket library, or look at how urllib2 or urllib retrieves HTTP data for examples. Regards, Malcolm -- Honk if you love peace and quiet. http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: compensation for dictfetchone
On Mon, 2007-09-17 at 10:14 +0200, Michal Konvalinka wrote: > Hi, > I have upgraded my django from 0.96 to trunk and found out that Adrian > had removed dictfetchone() with reason that "it wasn't being used > anywhere". That's not true, I was using it :-) > > http://code.djangoproject.com/changeset/5968 > > Is there any similar function to this one? I found this function really > useful. Copy the code from the old dictfetchone into one of your own common library files. It's only a few lines, after all. You'll have to tweak it slightly to get the cursor from the right place, but you have access to all the facilities you need to construct the dictionary yourself. Regards, Malcolm -- Many are called, few volunteer. http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Django + Twitter?
Hey all, One thing I can't really get my head around is how to sync a django model with another service like, say Flickr. I thought I'd try something simple first though, namely twitter. My initial guess would be to create a model for twitter entries, and then run a cron job that checks twitter every now and then, adding entries into the django database when they are found. In theory, I understand this (or at least I think I do), but in practice I'm completely lost. How do I make sure I'm not getting duplicate entries? How often should I sync? How do I do that? I really can't get my head around this, so if anyone has a tutorial for django + twitter specifically, or guidelines for making something similar, it would be very much appreciated. Thanks! Björn --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: sending email with cc
On Sun, 2007-09-16 at 23:32 -0700, medhat wrote: > Hi, > > I am trying to send an email from one of my views. I found > http://www.djangoproject.com/documentation/email/ but I need to > include people in the cc list of the message, and that page does not > mention anything about cc! > I tried the following: > > msg = EmailMessage(subject, body, frm, to, headers={'Cc':cc}) > > but that still did not work... The people on the to kist will get the > message, and it will be showing the cc list correctly, but the people > on the cc list will never get it. > > Any ideas? Subclass EmailMessage and override the recipients() method as well to include the cc'd people. Then adding the 'CC' header will work. We don't have explicit 'cc' support since you just put them all in the "to" list, but if you want it, it's only four or five lines of code away in this fashion. Regards, Malcolm -- The only substitute for good manners is fast reflexes. http://www.pointy-stick.com/blog/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
compensation for dictfetchone
Hi, I have upgraded my django from 0.96 to trunk and found out that Adrian had removed dictfetchone() with reason that "it wasn't being used anywhere". That's not true, I was using it :-) http://code.djangoproject.com/changeset/5968 Is there any similar function to this one? I found this function really useful. Thanks, Michal --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: "online/offline status" on user profile
johnny napisał(a): > What I want to do is display "online/offline status" on user profile? > > anybody have an idea how to get information about user is logged > in(active session) or not? If you have auth combo enabled (middleware + context processor for templates), you can examine output of request.user.is_authenticated(). -- Jarek Zgoda Skype: jzgoda | GTalk: [EMAIL PROTECTED] | voice: +48228430101 "We read Knuth so you don't have to." (Tim Peters) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django Flatpages With Memcache as storage location
Try creating a template called '404.html' (Even if it's empty for starters; but you should put a useful message in there before go-live) and see if your flatpages work with Debug turned off. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
sending email with cc
Hi, I am trying to send an email from one of my views. I found http://www.djangoproject.com/documentation/email/ but I need to include people in the cc list of the message, and that page does not mention anything about cc! I tried the following: msg = EmailMessage(subject, body, frm, to, headers={'Cc':cc}) but that still did not work... The people on the to kist will get the message, and it will be showing the cc list correctly, but the people on the cc list will never get it. Any ideas? -- Thanks in advance, Medhat --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---