Re: Django compressor
Thanks a lot, exactly what I needed. Sent from my iPhone On Jan 15, 2011, at 11:38 PM, "Casey S. Greene"wrote: > Assuming you mean this: > https://github.com/mintchaos/django_compressor > > From their example: > > {% load compress %} > {% compress css %} > charset="utf-8"> > p { border:5px solid green;} > charset="utf-8"> > {% endcompress %} > > This goes in your template. Make the CSS for that page a separate file and > only include it on the pages where you actually want it. > > Hope this helps! > -- Casey > > On 01/15/2011 03:13 PM, Mo J. Al-Mughrabi wrote: >> Hi, >> >> Am using django compressor to compress n include my CSS files. There >> are some CSS I would like to render only in certain pages, any idea >> how will I include more CSS files dynamically at run time? >> >> Sent from my iPhone >> > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Converting from Wordpress, upgrading users.
On 16/01/2011 3:03am, Sean Brant wrote: I am migrating a site from Wordpress to Django and I need the old username and passwords to keep working. Maybe you can write an auth backend to continue using the Wordpress auth? http://docs.djangoproject.com/en/dev/topics/auth/#writing-an-authentication-backend If so, you could duplicate the userids and passwords in the django auth backend in parallel as each user logs in. I first create auth.User objects for all Wordpress users. Wordpress' login username does not conform to Django's so I need to fix some of the usernames during migration. If you can figure out the name rules you might be able to fix them on the fly and notify the users that their userid has now been adjusted. Just a thought Mike I then store Wordpress Credentials wp_user_login, wp_user_pass, fixed_username (True is i need to fix there username during migration) and a FK to the new auth.User in a separate table. My custom auth backend will look up the Credentials by wp_user_login, then check the password (hashing it with the same algorithm that Wordpress uses) against wp_user_pass. If the password hashes match and and fixed_username is False I can update the auth.User's password and the upgrade is complete. If fixed_username is True I need to provide an additional step of having the User verify they like there new username, or provide a new one. And then the upgrade is complete. I would like to not have to recreate all of django.contrib.auth.views.login to get this workflow working, but i can figure out how to redirect to the "verify fixed username" page. Anyone solve this before? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
TestCase.urls with templates that have url to other apps
class EmailNotificationTest(BaseTestCase): """ Test Class for testing email notification """ urls = 'notification.urls' def test_create_notification(self): res = self.client.get('email/create/) # will fail self.assertEquals(res.status_code, 200) If I try to render a template that has {% url other-app-view %} I get a error. I am doing something wrong or is this by design? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Django compressor
Assuming you mean this: https://github.com/mintchaos/django_compressor From their example: {% load compress %} {% compress css %} charset="utf-8"> p { border:5px solid green;} charset="utf-8"> {% endcompress %} This goes in your template. Make the CSS for that page a separate file and only include it on the pages where you actually want it. Hope this helps! -- Casey On 01/15/2011 03:13 PM, Mo J. Al-Mughrabi wrote: Hi, Am using django compressor to compress n include my CSS files. There are some CSS I would like to render only in certain pages, any idea how will I include more CSS files dynamically at run time? Sent from my iPhone -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
newbie
I have been reading django forms with media. But I would like to use the latest jquery (1.4.4) + jquery-ui (1.8.7) with a django (v1.2.4) based web-application for forms and ui-design in general. 1) does the latest jquery installed under MEDIA_ROOT conflict with the default jquery library(v1.4.2) ? 2) jquery-ui provides widgets otherthan those act on form elements. for example most jquery widgets manipulate elements to make tabs or accordion appear. In that case does the ui-design have to be manually designed and restricted to the templates ? pls let me know. thank you regards, KM -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Django compressor
Hi, Am using django compressor to compress n include my CSS files. There are some CSS I would like to render only in certain pages, any idea how will I include more CSS files dynamically at run time? Sent from my iPhone -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Should namespaces be used to clean up url names
On Saturday, January 15, 2011 11:23:02 am Vitaly Babiy wrote: > The url docs talks about naming urls like this: myapp-comment, does it make > sense to do this still when we have namespaces? With a namespace we could > do myapp:comment this way the url name only describes the view and has no > reference to the application name that its in. Personally I don't use named urls that way, I give each a unique name that is relevant to the view it's going to, like index, gallery-index, etc While my naming convention may mimic the app-view that namespaces would use. It doesn't have to be. The rule of thumb for me is "a unique name that fits the purpose of url". But last time I used django, I had started to use namespaces more than named urls. Mike -- Fights between cats and dogs are prohibited by statute in Barber, North Carolina. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Should namespaces be used to clean up url names
The url docs talks about naming urls like this: myapp-comment, does it make sense to do this still when we have namespaces? With a namespace we could do myapp:comment this way the url name only describes the view and has no reference to the application name that its in. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: booleanfield filter not working
And after I posted this...I figured out the issue. The problem lies in the design of the class and how I was calling it...forgive me. On Jan 15, 2:07 pm, deecodameekowrote: > Hi, > > I have the following model: > > class MerchantFormFields(models.Model): > > merchant_form = models.ForeignKey(MerchantForms) > label = models.CharField(max_length=50) > field_type = models.ForeignKey(FieldTypes) > required = models.BooleanField() > dependency = models.BooleanField() > order = models.IntegerField() > attributes = JSONField() > > and use the following method to query: > > def get_form_fields(self, dependency=None, order='order'): > > self.get_merchant_form() > > filter = {} > filter['merchant_form'] = self.merchant_form > > if dependency is not None: > filter['dependency'] = dependency > > return > MerchantFormFields.objects.filter(**filter).order_by(order) > > No matter if I specify False/True/0/1 I always get all the fields > associated with the merchant_form and not the dependency field. If I > print the filter before the query I can see the dependency filter is > set: > > When dependency is False: > filter: {'merchant_form': , > 'dependancy': False} > > When dependency is True > filter: {'merchant_form': , > 'dependancy': True} > > Even if I look at the query formulated: > > { > 'time': '0.109', > 'sql': u'SELECT `merchant_merchantformfields`.`id`, > `merchant_merchantformfields`.`merchant_form_id`, > `merchant_merchantformfields`.`label`, > `merchant_merchantformfields`.`field_type_id`, > `merchant_merchantformfields`.`required`, > `merchant_merchantformfields`.`dependancy`, > `merchant_merchantformfields`.`order`, > `merchant_merchantformfields`.`attributes` FROM > `merchant_merchantformfields` WHERE > (`merchant_merchantformfields`.`merchant_form_id` = 3 AND > `merchant_merchantformfields`.`dependancy` = 1 ) ORDER BY > `merchant_merchantformfields`.`order` ASC' > > } > > I can see the filter is correct. I've even run this query and have > seen the result I'm looking for but when I run it in my code, I get > all fields for the specified merchant_form... > > I really don't know why this is. > > Any help is greatly appreciated. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
booleanfield filter not working
Hi, I have the following model: class MerchantFormFields(models.Model): merchant_form = models.ForeignKey(MerchantForms) label = models.CharField(max_length=50) field_type = models.ForeignKey(FieldTypes) required = models.BooleanField() dependency = models.BooleanField() order = models.IntegerField() attributes = JSONField() and use the following method to query: def get_form_fields(self, dependency=None, order='order'): self.get_merchant_form() filter = {} filter['merchant_form'] = self.merchant_form if dependency is not None: filter['dependency'] = dependency return MerchantFormFields.objects.filter(**filter).order_by(order) No matter if I specify False/True/0/1 I always get all the fields associated with the merchant_form and not the dependency field. If I print the filter before the query I can see the dependency filter is set: When dependency is False: filter: {'merchant_form': , 'dependancy': False} When dependency is True filter: {'merchant_form': , 'dependancy': True} Even if I look at the query formulated: { 'time': '0.109', 'sql': u'SELECT `merchant_merchantformfields`.`id`, `merchant_merchantformfields`.`merchant_form_id`, `merchant_merchantformfields`.`label`, `merchant_merchantformfields`.`field_type_id`, `merchant_merchantformfields`.`required`, `merchant_merchantformfields`.`dependancy`, `merchant_merchantformfields`.`order`, `merchant_merchantformfields`.`attributes` FROM `merchant_merchantformfields` WHERE (`merchant_merchantformfields`.`merchant_form_id` = 3 AND `merchant_merchantformfields`.`dependancy` = 1 ) ORDER BY `merchant_merchantformfields`.`order` ASC' } I can see the filter is correct. I've even run this query and have seen the result I'm looking for but when I run it in my code, I get all fields for the specified merchant_form... I really don't know why this is. Any help is greatly appreciated. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Handling huge fixtures
I use this exact dataset. Instead of using a fixture called initial_data.json for that whole dataset, call it something else like zip_code.json. You can use loaddata to load it whenever you are setting up a new environment. For your tests, have a minimal subset of zips in initial_data, or in another fixture that you specifically load for the test cases that need it. Makes test running much easier. If you think zip codes are bad, wait until you get to postal codes. :) On Jan 14, 5:02 pm, mack the fingerwrote: > We have a feature of our django application where the user will enter a > zipcode, and out site will lookup that zipcode against a database table and > return the city and state. In order for us to do this, we have a ZipCode > model, and a 22 thousand line initial_data.json fixture. > > The problem is that whenever we try to run *any* test, we have to wait about > 60 seconds for that fixture to load, which is really annoying. Does anyone > have any tips for handling situations like these? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django-admin.py not working?
OMG THAT WORKED! Thank you so much but I don't understand why NONE of the documentation mentioned anything about putting a python in front of it. URGH!! Thanks again! On Jan 15, 6:19 pm, Acornwrote: > You will have to specially run the script with python.. so: > > python FULLPATH\django-admin.py startproject webapp1 > > I'm not sure why it behaves like this. > > On 15 January 2011 18:00, nai wrote: > > > > > > > > > I'm running Windows Vista and Im trying to create a project. > > > When I try to run FULLPATH\django-admin.py startproject webapp1, I get > > back the help list. This happens no matter what subcommand I use. I > > took a screen shot an posted a similar question on SO here > >http://stackoverflow.com/questions/4696831/help-with-django-installation > > > Any help would be much appreciated. > > > Nai > > > -- > > You received this message because you are subscribed to the Google Groups > > "Django users" group. > > To post to this group, send email to django-users@googlegroups.com. > > To unsubscribe from this group, send email to > > django-users+unsubscr...@googlegroups.com. > > For more options, visit this group > > athttp://groups.google.com/group/django-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django-admin.py not working?
You will have to specially run the script with python.. so: python FULLPATH\django-admin.py startproject webapp1 I'm not sure why it behaves like this. On 15 January 2011 18:00, naiwrote: > I'm running Windows Vista and Im trying to create a project. > > When I try to run FULLPATH\django-admin.py startproject webapp1, I get > back the help list. This happens no matter what subcommand I use. I > took a screen shot an posted a similar question on SO here > http://stackoverflow.com/questions/4696831/help-with-django-installation > > Any help would be much appreciated. > > Nai > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
django-admin.py not working?
I'm running Windows Vista and Im trying to create a project. When I try to run FULLPATH\django-admin.py startproject webapp1, I get back the help list. This happens no matter what subcommand I use. I took a screen shot an posted a similar question on SO here http://stackoverflow.com/questions/4696831/help-with-django-installation Any help would be much appreciated. Nai -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Problem with DJANGO_SETTINGS_MODULE is undefined
The normal way to do it is with manage.py. The whole point of the script is to set up your environment so that Django can run your project. Shawn On Jan 15, 2011, at 12:40 PM, Chen Xuwrote: > py manage.py runserver works fine, but I kinda want to make django-admin.py > runserver work too. > Could anyone help? > > > Thanks > > > On Sat, Jan 15, 2011 at 3:22 AM, Praveen Krishna R > wrote: > try > manage.py runserver > > On Sat, Jan 15, 2011 at 10:58 AM, Chen Xu wrote: > Hi, Django developers: > I am very new here, trying to set up my Django > I have a project called 'mysite' > when I run: > $ django-admin.py runserver > > the terminal gives: > Error: Settings cannot be imported, because environment variable > DJANGO_SETTINGS_MODULE is undefined > > then I tried this: > $ export DJANGO_SETTINGS_MODULE=mysite.settings > > the terminal then gives me: > django-admin.py runserverError: Could not import settings 'mysite.settings' > (Is it on sys.path? Does it have syntax errors?): No module named > mysite.settings > > > can anyone help me with this? > > Thanks very much > > > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > > > -- > Praveen Krishna R > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Problem with DJANGO_SETTINGS_MODULE is undefined
py manage.py runserver works fine, but I kinda want to make django-admin.py runserver work too. Could anyone help? Thanks On Sat, Jan 15, 2011 at 3:22 AM, Praveen Krishna R < rpraveenkris...@gmail.com> wrote: > *try * > *manage.py runserver > * > On Sat, Jan 15, 2011 at 10:58 AM, Chen Xuwrote: > >> Hi, Django developers: >> I am very new here, trying to set up my Django >> I have a project called 'mysite' >> when I run: >> $ django-admin.py runserver >> >> the terminal gives: >> Error: Settings cannot be imported, because environment variable >> DJANGO_SETTINGS_MODULE is undefined >> >> then I tried this: >> $ export DJANGO_SETTINGS_MODULE=mysite.settings >> >> the terminal then gives me: >> django-admin.py runserverError: Could not import settings >> 'mysite.settings' (Is it on sys.path? Does it have syntax errors?): No >> module named mysite.settings >> >> >> can anyone help me with this? >> >> Thanks very much >> >> >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To post to this group, send email to django-users@googlegroups.com. >> To unsubscribe from this group, send email to >> django-users+unsubscr...@googlegroups.com >> . >> For more options, visit this group at >> http://groups.google.com/group/django-users?hl=en. >> > > > > -- > *Praveen Krishna R* > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Localisation
Despite reading round and round in circles in the documentation, I am completely baffled about localisation and how it works. I am not trying to do any translation yet, but want to code money and date formats right so that I don't have to rewrite things later. It isn't even clear to me which locale things are being localised to. I had presumed that everything would be localised to the browser's locale, using the language setting, however it seems to be localised to the LANGUAGE_CODE setting from settings.py. Am I doing something wrong? Any help would be gratefully received. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django-admin.py startproject myproject - problem
sudo apt-get install python-django > will install django in kubuntu (10.10 at least, and I think earlier). > Hi, You should be also able to do: sudo pip install Django --upgrade which would do a system-wide installation or upgrade of newest Django available in PyPI (ie. 1.2.4). I prefer pip over other ways of installation when it comes to Python packages, as easy as apt-get install Regards, Piotr -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Converting from Wordpress, upgrading users.
I am migrating a site from Wordpress to Django and I need the old username and passwords to keep working. I first create auth.User objects for all Wordpress users. Wordpress' login username does not conform to Django's so I need to fix some of the usernames during migration. I then store Wordpress Credentials wp_user_login, wp_user_pass, fixed_username (True is i need to fix there username during migration) and a FK to the new auth.User in a separate table. My custom auth backend will look up the Credentials by wp_user_login, then check the password (hashing it with the same algorithm that Wordpress uses) against wp_user_pass. If the password hashes match and and fixed_username is False I can update the auth.User's password and the upgrade is complete. If fixed_username is True I need to provide an additional step of having the User verify they like there new username, or provide a new one. And then the upgrade is complete. I would like to not have to recreate all of django.contrib.auth.views.login to get this workflow working, but i can figure out how to redirect to the "verify fixed username" page. Anyone solve this before? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Generate a unique username for django.contrib.auth
> I cannot simply copy the email to the username because the username must be > less than 30 characters and, after looking into my database, many email > addresses go over that. Note that you can fix that quite easily by putting something like this for f in User._meta.fields: if f.name == "username": f.max_length=75 somewhere in your code. Easiest in your models.py. mjl -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: django-admin.py startproject myproject - problem
It looks like django is not in your site packages directory. Did you specifically want to install the development version (that is what you linked to)? If not, then a simple: sudo apt-get install python-django will install django in kubuntu (10.10 at least, and I think earlier). Hope this helps, Casey On 01/15/2011 10:07 AM, dev.demi wrote: When I run in my console django-admin.py startproject myproject I get next messages Traceback (most recent call last): File "/usr/local/bin/django-admin.py", line 2, in from django.core import management ImportError: No module named django.core I followed steps in docs: http://docs.djangoproject.com/en/1.2/topics/install/#installing-development-version I use Kubuntu, Django 1.2 Please help me to find out reason of this error. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Django/Comet?
Ethan, Thanks for the reply. Since this isn't something a lot of people are doing I'm going to make my own way and report back. I just wanted to ensure I wasn't straying from what the community at large was doing, but since there's no consensus I'll just do whatever. In my research yesterday, including a friendly chat in the #orbited IRC (freenode), here are the things I found: Hookbox does more, but is heavier. Orbited is once again under active development. It's possible to use Orbited with Celery and RabbitMQ. Hookbox replicates some functionality of Celery and RabbitMQ. Based on this, and the fact that I'm already using django-celery and RabbitMQ, I'm leaning towards Orbited. I'm going to put together a little test project this weekend. If all goes well I'll probably stop there and just use Orbited. I'll put up a blog post with relevant code snippets. If something goes horribly wrong, or I get tremendously motivated, I'll do the same with Hookbox and have a better understanding of the differences. Shawn -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Signals and foreign key
Hey, Im trying to get the signal pre_save to work on my model but there seems to be some problem with a foreign key or something. My model is like this: class BlogEntry(models.Model): headline = models.CharField(max_length=100) content = models.CharField(max_length=2000) written_by = models.ForeignKey(User) date = models.DateTimeField(auto_now=True) project = models.ForeignKey(Project) And here is where the form is processed and saved: def form_valid(self, blogform): # post a blogentry blog_entry = blogform.save(commit=False) blog_entry.written_by = self.request.user blog_entry.project = blog_entry.project #debugging shows that this is a valid instance of the Project model blog_entry.save() return TemplateResponseMixin.render_to_response(self, self.get_context_data()) And here's my signal reciever function @receiver(post_save, sender=BlogEntry) def project_blog_entry_signal(sender, **kwargs): log = Log() log.project = sender.project.field log.content_type = Log.content_new_blogentry log.save() And here's the exception: Cannot assign "": "Log.project" must be a "Project" instance. @the line -> log.project = sender.project.field in project_blog_entry_signal() funktion The sender object doesn't seem to pass the project as a model instance? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
django-admin.py startproject myproject - problem
When I run in my console django-admin.py startproject myproject I get next messages Traceback (most recent call last): File "/usr/local/bin/django-admin.py", line 2, in from django.core import management ImportError: No module named django.core I followed steps in docs: http://docs.djangoproject.com/en/1.2/topics/install/#installing-development-version I use Kubuntu, Django 1.2 Please help me to find out reason of this error. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Django/Comet?
On Fri, Jan 14, 2011 at 6:28 AM, Shawn Milochikwrote: > I asked about this back in October but nobody replied. I think it's been > long enough for a bump. ;o) > > I searched the list online and haven't seen any recent discussions about > this, so I figured I'd check in. Last I heard, Orbited was the way to go, > but it seems that both it and django-orbited haven't seen any development in > quite a while. The developer of Orbited is working on something called * > Hookbox* to supersede Comet. > > So, is anyone using a Comet implementation in production with Django? I'd > rather use what the majority of the community is using (or moving toward). > > I'm not using Comet in production with Django, but I'm just starting to look into this too and would also love to hear if and how people are doing it. My impressions match yours -- I thought Orbited was the popular solution, but when I looked into it recently the project seemed stalled, and perhaps superceded by Hookbox. Hookbox looks very nice -- the backend messaging server is designed to integrate into your project with REST APIs, so it calls URLs in your application to figure out how to respond to connections, subscriptions, publications, etc. And its frontend Javascript library is easy to use. I've never done Comet stuff before but I was able to install Hookbox and get a simple prototype of persistent, multi-user, real-time draggable divs running in a few hours. The documentation is a bit outdated, though, and it's also worth reading this recent thread: http://groups.google.com/group/hookbox/browse_thread/thread/9ffa12884025a890 So I'm cautiously optimistic about Hookbox, but I'd love to hear what other people are using. -Ethan > Thanks, > Shawn > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Dynamic nested forms
Hello, I had to make a page with some dynamically added nested formset (all in a page), for example: Blog title: Blog info: --Entry title: --Entry text: Tags: Add new Tag -- Add New Entry ... Add new Blog Which is the cleanest way to do it with django? I did it using 3 formset (blog, entry and tags), but code looks like a mess. Is there some easier way, as there is for Rails [1], for this quite common task? Lorenzo [1]http://ryandaigle.com/articles/2009/2/1/what-s-new-in-edge-rails-nested-attributes signature.asc Description: OpenPGP digital signature
Re: i18n issue with compilemessages
The problem seems to come from your python path, that is not well defined. Try to define path in an absolute (not realtive) fashion. import os os.environ['PYTHONPATH'] = '/path/to/myproject' os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings' and then, apache should be able to execute compile messages Greetings, Isaac On Fri, Jan 14, 2011 at 7:48 AM, Akashwrote: > Following are the environment I am working on: > 1. Django 1.2.3 > 2. Python 2.4 > 3. wsgi > 4. Centos 5.4 > > From apache, I can run makemessage command, and it works. It creates > the *.po files. > I use the following statement for this. > os.system("django-admin.py makemessages -l hi") > > But I am unable to do compilemessages from apache. Following are the > steps which I tried out: > > os.system("django-admin.py compilemessages") AND > subprocess.Popen(["django-admin.py", "compilemessages"]) > > The command works fine from command line though, when run from project > location. > $django-admin.py compilemessages. > > but when I do python manage.py shell and then try to run it using > os.system, I get the following error: > > File "/usr/lib/python2.4/site-packages/django/core/management/ > commands/compilemessages.py", line 52, in handle >compile_messages(locale) > File "/usr/lib/python2.4/site-packages/django/core/management/ > commands/compilemessages.py", line 10, in compile_messages >basedirs.extend(settings.LOCALE_PATHS) > File "/usr/lib/python2.4/site-packages/django/utils/functional.py", > line 276, in __getattr__ >self._setup() > File "/usr/lib/python2.4/site-packages/django/conf/__init__.py", > line 40, in _setup >self._wrapped = Settings(settings_module) > File "/usr/lib/python2.4/site-packages/django/conf/__init__.py", > line 74, in __init__ >raise ImportError("Could not import settings '%s' (Is it on > sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE, > e)) > ImportError: Could not import settings > 'igp_distribution_manager.settings' (Is it on sys.path? Does it have > syntax errors?): No module named igp_distribution_manager.settings > 256 > > So I am not sure If I should be using os.system for this, or if there > is another way to run it from apache. > > I am sure I am doing something wrong out here. > If someone have faced this before and have got some solution, then > please guide me to get through it. > > Regards, > Akash > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Problem with DJANGO_SETTINGS_MODULE is undefined
*try * *manage.py runserver * On Sat, Jan 15, 2011 at 10:58 AM, Chen Xuwrote: > Hi, Django developers: > I am very new here, trying to set up my Django > I have a project called 'mysite' > when I run: > $ django-admin.py runserver > > the terminal gives: > Error: Settings cannot be imported, because environment variable > DJANGO_SETTINGS_MODULE is undefined > > then I tried this: > $ export DJANGO_SETTINGS_MODULE=mysite.settings > > the terminal then gives me: > django-admin.py runserverError: Could not import settings 'mysite.settings' > (Is it on sys.path? Does it have syntax errors?): No module named > mysite.settings > > > can anyone help me with this? > > Thanks very much > > > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- *Praveen Krishna R* -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.