On Fri, Aug 31, 2012 at 9:17 PM, Micky Hulse <rgmicky@gmail.com> wrote:
> I'd like to add:
> if objects.status_code != 200:
> return objects
> ... which is found via this code:
> <https://gist.github.com/871954>
Doh! After a bit of trial and error, I given up on trying to merge
those two code snippets.
I'd still like to know what `if isinstance(objects, HttpResponse)` is doing?
I've RTM'd:
<http://docs.python.org/library/functions.html#isinstance>
and
<https://code.djangoproject.com/wiki/HttpResponse>
... but what doe these bits of code accomplish when working together?
Thanks for listening. :)
M
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Friday, August 31, 2012
Re: Syncdb Error With Oracle Database - IntegrityError Exception
On Fri, Aug 31, 2012 at 10:03 PM, Jon Blake <jc.blake3@gmail.com> wrote:
> Querying column timestamp of view user_objects for tables, sequences and
> triggers appears to confirm my understanding of what base.py does. I'll drop
> and recreate my user account, and try again. I'll advise how this goes. Does
> the Django doco have any specific documentation for the Oracle back end? If
> so, I missed it! I'm happy to provide specific doco for the Oracle back end
> if that would assist...
Yes, please see:
https://docs.djangoproject.com/en/1.4/ref/databases/#oracle-notes
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
> Querying column timestamp of view user_objects for tables, sequences and
> triggers appears to confirm my understanding of what base.py does. I'll drop
> and recreate my user account, and try again. I'll advise how this goes. Does
> the Django doco have any specific documentation for the Oracle back end? If
> so, I missed it! I'm happy to provide specific doco for the Oracle back end
> if that would assist...
Yes, please see:
https://docs.djangoproject.com/en/1.4/ref/databases/#oracle-notes
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
What does this code do? Also, testing decorator via terminal?
Hello,
Silly question, but...
What does this code do:
if isinstance(objects, HttpResponse):
return objects
... full code found here:
<https://github.com/julian-amaya/django-decorators/blob/master/django_decorators/decorators.py#L37-38>
I'd like to add:
if objects.status_code != 200:
return objects
... which is found via this code:
<https://gist.github.com/871954>
In other words, the final code would look like so (untested):
<https://gist.github.com/3563671>
I just don't fully understand what the `isinstance()` bit is doing. :(
Also, how can I test decorators via the python shell?
Sorry if noob questions.
Thanks!
M
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Silly question, but...
What does this code do:
if isinstance(objects, HttpResponse):
return objects
... full code found here:
<https://github.com/julian-amaya/django-decorators/blob/master/django_decorators/decorators.py#L37-38>
I'd like to add:
if objects.status_code != 200:
return objects
... which is found via this code:
<https://gist.github.com/871954>
In other words, the final code would look like so (untested):
<https://gist.github.com/3563671>
I just don't fully understand what the `isinstance()` bit is doing. :(
Also, how can I test decorators via the python shell?
Sorry if noob questions.
Thanks!
M
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: admin save_model parameter 'change' is always true
On 31-8-2012 11:16, armagan wrote:
> I'm trying to use admin save_model method. I have a model called 'Project'
> and in admin.py 'Project' has a method save_model. I added a project to my
> admin panel then I try to save again without changing. But the parameter
> 'change' of save_model method is always 'true'. Why?
The change parameter does not mean "has a field changed?" it means "is a
new object added to the database or an existing object changed?".
A form has some methods that can be queried to find out if a form field
itself has changed or if there are any changes in the form. I haven't
used these much, so you'll have to look around django/forms to or the
docs to find them.
--
Melvyn Sopacua
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
> I'm trying to use admin save_model method. I have a model called 'Project'
> and in admin.py 'Project' has a method save_model. I added a project to my
> admin panel then I try to save again without changing. But the parameter
> 'change' of save_model method is always 'true'. Why?
The change parameter does not mean "has a field changed?" it means "is a
new object added to the database or an existing object changed?".
A form has some methods that can be queried to find out if a form field
itself has changed or if there are any changes in the form. I haven't
used these much, so you'll have to look around django/forms to or the
docs to find them.
--
Melvyn Sopacua
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Syncdb Error With Oracle Database - IntegrityError Exception
Thanks, Ian and Amyth, for your responses.
I encountered the CREATE TRIGGER privilege issue early in my trials with Django with the Oracle database back end - Django propagated an Oracle "insufficient privileges" exception. That was quickly sorted by granting the required privilege to my user account.
On looking at ticket #17015 you pointed me to, it looks like I might have stumbled over the same issue as in the reply to ikelly. My user did not have the CREATE TRIGGER privilege the first time I tried to run syncdb, but did have the CREATE_TABLE and CREATE_SEQUENCE privileges. After granting the missing privilege and running syncdb again, I then got the ORA-01400 exception on table auth_permission.
I'm guessing that the first table that oracle back end base.py creates is auth_permission, and that the table and its primary key sequence were successfully created, because the user had the required privileges. Module base.py then terminated on attempting to create the trigger for the table. After granting CREATE TRIGGER and running syncdb again, base.py noted that table auth_permission exists, so nothing more needed to be done for that table. Module base.py then went on and created the remaining tables, sequences and triggers. Missing trigger auth_permission_tr -> no primary key raised from auth_permission_sq -> ORA-01400 on table auth_permission inserts.
Querying column timestamp of view user_objects for tables, sequences and triggers appears to confirm my understanding of what base.py does. I'll drop and recreate my user account, and try again. I'll advise how this goes. Does the Django doco have any specific documentation for the Oracle back end? If so, I missed it! I'm happy to provide specific doco for the Oracle back end if that would assist...
Once again, many thanks
Jon
On Saturday, September 1, 2012 1:23:28 AM UTC+10, Ian wrote:
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/LXuXcxvnlnkJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
I encountered the CREATE TRIGGER privilege issue early in my trials with Django with the Oracle database back end - Django propagated an Oracle "insufficient privileges" exception. That was quickly sorted by granting the required privilege to my user account.
On looking at ticket #17015 you pointed me to, it looks like I might have stumbled over the same issue as in the reply to ikelly. My user did not have the CREATE TRIGGER privilege the first time I tried to run syncdb, but did have the CREATE_TABLE and CREATE_SEQUENCE privileges. After granting the missing privilege and running syncdb again, I then got the ORA-01400 exception on table auth_permission.
I'm guessing that the first table that oracle back end base.py creates is auth_permission, and that the table and its primary key sequence were successfully created, because the user had the required privileges. Module base.py then terminated on attempting to create the trigger for the table. After granting CREATE TRIGGER and running syncdb again, base.py noted that table auth_permission exists, so nothing more needed to be done for that table. Module base.py then went on and created the remaining tables, sequences and triggers. Missing trigger auth_permission_tr -> no primary key raised from auth_permission_sq -> ORA-01400 on table auth_permission inserts.
Querying column timestamp of view user_objects for tables, sequences and triggers appears to confirm my understanding of what base.py does. I'll drop and recreate my user account, and try again. I'll advise how this goes. Does the Django doco have any specific documentation for the Oracle back end? If so, I missed it! I'm happy to provide specific doco for the Oracle back end if that would assist...
Once again, many thanks
Jon
On Saturday, September 1, 2012 1:23:28 AM UTC+10, Ian wrote:
On Friday, August 31, 2012 12:10:54 AM UTC-6, Amyth wrote:--Hey Jon,I guess this is because of a bug in django. Django already has a open ticket for this bug. Check it out here.
As described in that ticket, the reason for the problem is probably just that the Django user does not have the CREATE TRIGGER privilege, which it needs. The bug in Django is just that this condition is not detected and reported at the time the table is created, instead of getting a rather more obscure error message at the time the table is populated.
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/LXuXcxvnlnkJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Provide a single text field (editable through admin panel) w/o using a whole model
On Fri, Aug 31, 2012 at 10:53 PM, RK <romainknezevic@gmail.com> wrote:
> I'd like to have the content of one <p> tag in the homepage editable in
> admin back-office, going through a whole model feels like an overkill, what
> alternatives do I have ?
>
> If there's no alternative, is there a way to properly limit the number of
> elements to 1 in the admin panel ?
>
> Any help appreciated, I'm sure I missed something obvious because it seems
> like a basic need. (I'm new to django if u didn't catch it !)
Think of it this way -- you have a piece of data that you want to be
persistent. You need to persist it somewhere. If you're going to
persist it to the database, you need to put it in a table.
Django doesn't have a built in "table for singleton values". However,
such an app that implemented such a feature wouldn't be hard to write
(after all, it's just a table of key-value pairs). Is it a waste?
Maybe. But the overhead of a single table isn't huge, so it isn't a
*big* waste. You'd have to balance your need to have the feature
against the extra few kB of disk space you'll be using.
Thinking of all the weird ways you could abuse the pieces that are
already in the box -- Django has a database-backed cache backend,
which is effectively just a table that contains key-value pairs. Store
your value with no expiry date, and you've got persistent storage
without explicitly creating a "values for my homepage" table. However,
you won't get a nifty admin interface for free; the cache tables
aren't exposed through the admin interface. However, you could write a
custom admin UI page and hook it in.
Then, you have non-database options -- for example, Redis is a
persistent key-value store; again, with a custom view plugged into the
admin, you could persist configuration values.
I hope that gets some ideas bubbling in your mind :-)
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
> I'd like to have the content of one <p> tag in the homepage editable in
> admin back-office, going through a whole model feels like an overkill, what
> alternatives do I have ?
>
> If there's no alternative, is there a way to properly limit the number of
> elements to 1 in the admin panel ?
>
> Any help appreciated, I'm sure I missed something obvious because it seems
> like a basic need. (I'm new to django if u didn't catch it !)
Think of it this way -- you have a piece of data that you want to be
persistent. You need to persist it somewhere. If you're going to
persist it to the database, you need to put it in a table.
Django doesn't have a built in "table for singleton values". However,
such an app that implemented such a feature wouldn't be hard to write
(after all, it's just a table of key-value pairs). Is it a waste?
Maybe. But the overhead of a single table isn't huge, so it isn't a
*big* waste. You'd have to balance your need to have the feature
against the extra few kB of disk space you'll be using.
Thinking of all the weird ways you could abuse the pieces that are
already in the box -- Django has a database-backed cache backend,
which is effectively just a table that contains key-value pairs. Store
your value with no expiry date, and you've got persistent storage
without explicitly creating a "values for my homepage" table. However,
you won't get a nifty admin interface for free; the cache tables
aren't exposed through the admin interface. However, you could write a
custom admin UI page and hook it in.
Then, you have non-database options -- for example, Redis is a
persistent key-value store; again, with a custom view plugged into the
admin, you could persist configuration values.
I hope that gets some ideas bubbling in your mind :-)
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Using different ports in views?
Well, I guess I will have to have apache proxy the outgoing request then.
On Fri, Aug 31, 2012 at 7:49 PM, Robert Steckroth
<robertsteckroth@gmail.com> wrote:
> Hello gang, I would like to have some of my django views send the
> response to a different ports.
> Is it possible to specify which port to use in the views?
> --
> Bust0ut, Surgemcgee: Systems Engineer ---
> surgemcgee.com
> BudTVNetwork.com
> RadioWeedShow.com
> "Bringing entertainment to Unix"
--
Bust0ut, Surgemcgee: Systems Engineer ---
surgemcgee.com
BudTVNetwork.com
RadioWeedShow.com
"Bringing entertainment to Unix"
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
On Fri, Aug 31, 2012 at 7:49 PM, Robert Steckroth
<robertsteckroth@gmail.com> wrote:
> Hello gang, I would like to have some of my django views send the
> response to a different ports.
> Is it possible to specify which port to use in the views?
> --
> Bust0ut, Surgemcgee: Systems Engineer ---
> surgemcgee.com
> BudTVNetwork.com
> RadioWeedShow.com
> "Bringing entertainment to Unix"
--
Bust0ut, Surgemcgee: Systems Engineer ---
surgemcgee.com
BudTVNetwork.com
RadioWeedShow.com
"Bringing entertainment to Unix"
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Using different ports in views?
Hello gang, I would like to have some of my django views send the
response to a different ports.
Is it possible to specify which port to use in the views?
--
Bust0ut, Surgemcgee: Systems Engineer ---
surgemcgee.com
BudTVNetwork.com
RadioWeedShow.com
"Bringing entertainment to Unix"
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
response to a different ports.
Is it possible to specify which port to use in the views?
--
Bust0ut, Surgemcgee: Systems Engineer ---
surgemcgee.com
BudTVNetwork.com
RadioWeedShow.com
"Bringing entertainment to Unix"
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: ManyToManyField and get_or_create
Bump?
Almost exactly 4 years later, I've ran into this exact same issue in Django 1.4. Attempting to use get_or_create through a ManyToMany field results in an integrity error if the object already exists but is not yet associated with the parent object. To use the OP's example, if a Tag with name "foo" exists but is not yet associated with a given Thing instance, using .tags.get_or_create(name='foo') will indeed raise an IntegrityError:
foo_tag = Tag(name='foo')
foo_tag.save()
a_thing = Thing(name='a')
a_thing.save()
a_thing.tags.get_or_create(name='foo')
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/django/db/models/fields/related.py", line 616, in get_or_create
super(ManyRelatedManager, self.db_manager(db)).get_or_create(**kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py", line 134, in get_or_create
return self.get_query_set().get_or_create(**kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 449, in get_or_create
obj.save(force_insert=True, using=self.db)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 463, in save
self.save_base(using=using, force_insert=force_insert, force_update=force_update)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 551, in save_base
result = manager._insert([self], fields=fields, return_id=update_pk, using=using, raw=raw)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py", line 203, in _insert
return insert_query(self.model, objs, fields, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 1576, in insert_query
return query.get_compiler(using=using).execute_sql(return_id)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 910, in execute_sql
cursor.execute(sql, params)
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/util.py", line 40, in execute
return self.cursor.execute(sql, params)
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/sqlite3/base.py", line 337, in execute
return Database.Cursor.execute(self, query, params)
IntegrityError: column name is not unique
I've traced the problem to being that the ManyRelatedManager includes its core_filters in its get_query_set method. This results in the "get" portion of get_or_create to only return a hit if the Tag exists and is already associated to the calling Thing instance. Given the nature of a many-to-many relationship, it should not be a requirement that a Tag already be linked to the calling Thing for get_or_create to find it; it should be enough that the Tag simply exists. All that should happen in that scenario is that the (existing) Tag's relationship with the calling Thing be created/saved.
On Monday, September 1, 2008 8:04:00 PM UTC-7, Cap wrote:
I'm having problems using get_or_create with a ManyToManyField and I'm--
not sure whether the problem is me or Django.
I have two models:
class Tag(models.Model):
name = models.CharField(max_length=256, unique=True)
class Thing(models.Model):
name = models.CharField(max_length=256)
tags = models.ManyToManyField(Tag)
When I try to add a tag that already exists, as:
a = Thing(name='a')
a.save()
a.tags.get_or_create(name='foo')
I get sqlite3.IntegrityError: column name is not unique.
But when I do it like so:
a = Thing(name='a')
a.save()
foo, created = Tag.objects.get_or_create(name='foo')
a.tags.add(foo)
I have no problems.
I noticed that http://code.djangoproject.com/ticket/3121 seemed to
address something like this, so I pulled the latest Django (8834), but
the problems remains.
Am I doing it wrong?
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/rHntcOgBMAMJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Javascript Image Hollover In Django
When I followed your tutorial, the images were reshaped only and when I place my mouse on any of the thumbnail images it won't display the large image. How can I go about it?
On Friday, 31 August 2012 15:40:56 UTC+1, Amyth wrote:
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/5IGvhvxkSUsJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
On Friday, 31 August 2012 15:40:56 UTC+1, Amyth wrote:
Hey,--dun think this is really Django related, but still i created a jquery example for you, check it http://jsfiddle.net/TjUtq/--
Thanks & Regards
----------------------------
Amyth [Admin - Techstricks]
Email - aroras....@gmail.com, ad...@techstricks.com
Twitter - @a_myth_________
http://techstricks.com/
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/5IGvhvxkSUsJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: settings.py DEBUG crash
http://stackoverflow.com/questions/7241688/django-admin-css-missing
--
Rafael E. Ferrero
Claro: (03562) 15514856
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
2012/8/31 Rafael E. Ferrero <rafael.ferrero@gmail.com>
maybe you are using the development server for serve statics files.
I had the same problem, in google i find the answer (if you copy all css files from contrib.admin in your media directory, django look for that files first)
hope to help you--2012/8/31 Alex Bruno Cáceres <alexbruno.webmaster@gmail.com>
Hello people!I'm learning Django and have a doubt.When I set DEBUG=False in settings.py, Dajngo Admin looses CSS theme, it crashes layout and show only HTML.Why it happens? I did something wrong?--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/QZCqSHkbXDQJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Rafael E. Ferrero
Claro: (03562) 15514856
--
Rafael E. Ferrero
Claro: (03562) 15514856
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: settings.py DEBUG crash
maybe you are using the development server for serve statics files.
I had the same problem, in google i find the answer (if you copy all css files from contrib.admin in your media directory, django look for that files first)
hope to help you
--
Rafael E. Ferrero
Claro: (03562) 15514856
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
I had the same problem, in google i find the answer (if you copy all css files from contrib.admin in your media directory, django look for that files first)
hope to help you
2012/8/31 Alex Bruno Cáceres <alexbruno.webmaster@gmail.com>
Hello people!I'm learning Django and have a doubt.When I set DEBUG=False in settings.py, Dajngo Admin looses CSS theme, it crashes layout and show only HTML.Why it happens? I did something wrong?--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/QZCqSHkbXDQJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
--
Rafael E. Ferrero
Claro: (03562) 15514856
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: How to package a django application
On Fri, 31 Aug 2012 04:49:39 -0700 (PDT), Muhammed Salman
<salmanmanekia@gmail.com> declaimed the following in
gmane.comp.python.django.user:
> Thanks for the reply. Maybe i should have gone into more details on what i
> have to actually do. I am sorry for not being clear and hence you kept
> guessing. The app requirments are simple it requires that the client is
> shown a user id and password field and if the user id and password matches
> a particular criteria i.e (userid : login@login.com and password:
> password), then it shows this as a sucess else it displays login fails.
>
That's all?
Is the "particular criteria" something you can hard-code (that is,
there are only two or three "good" values) or do you have to read from a
database of "users"?
For the rest: I think all you need is an instance of CGIHTTPServer
(go back to the library reference manual), and three "forms" (initial
"login", "success", and "fail" pages). Oh, and the cgi module to get the
values...
Actually, you might not need CGIHTTPServer -- a
SimpleHTTPRequestHandler with some parsing of the request in a do_PUT()
method may be all...
{Note: the module names are Python 2.x, check documentation for
http.server if using 3.x}
... <time passes>
Minimalistic index.html (login form) took 33 lines of HTML
server.py took 9 lines of Python
cgi-bin\login.py (CGI handler for form) took 44 lines of Python
And only about 30-45 minutes to create.
Granted, no use of cookies (so there is no session state -- it JUST
presents a login form, compares (user, password) against a preset list
of valid (user, password) pairs, and returns either "Congratulations" or
"Failure" text. A fully functional system should set a cookie, and any
attempt to access pages other than index.html when not validated should
reset to index.html.
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
<salmanmanekia@gmail.com> declaimed the following in
gmane.comp.python.django.user:
> Thanks for the reply. Maybe i should have gone into more details on what i
> have to actually do. I am sorry for not being clear and hence you kept
> guessing. The app requirments are simple it requires that the client is
> shown a user id and password field and if the user id and password matches
> a particular criteria i.e (userid : login@login.com and password:
> password), then it shows this as a sucess else it displays login fails.
>
That's all?
Is the "particular criteria" something you can hard-code (that is,
there are only two or three "good" values) or do you have to read from a
database of "users"?
For the rest: I think all you need is an instance of CGIHTTPServer
(go back to the library reference manual), and three "forms" (initial
"login", "success", and "fail" pages). Oh, and the cgi module to get the
values...
Actually, you might not need CGIHTTPServer -- a
SimpleHTTPRequestHandler with some parsing of the request in a do_PUT()
method may be all...
{Note: the module names are Python 2.x, check documentation for
http.server if using 3.x}
... <time passes>
Minimalistic index.html (login form) took 33 lines of HTML
server.py took 9 lines of Python
cgi-bin\login.py (CGI handler for form) took 44 lines of Python
And only about 30-45 minutes to create.
Granted, no use of cookies (so there is no session state -- it JUST
presents a login form, compares (user, password) against a preset list
of valid (user, password) pairs, and returns either "Congratulations" or
"Failure" text. A fully functional system should set a cookie, and any
attempt to access pages other than index.html when not validated should
reset to index.html.
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
settings.py DEBUG crash
Hello people!
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/QZCqSHkbXDQJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
I'm learning Django and have a doubt.
When I set DEBUG=False in settings.py, Dajngo Admin looses CSS theme, it crashes layout and show only HTML.
Why it happens? I did something wrong?
-- You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/QZCqSHkbXDQJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Id error
In your CountryForm, calling super(self.__class__)... might not be a
good idea. You should name the class, ie.
super(CountryForm, self).save(*args, **kwargs)
Just did that, had no effect.
I'd also be wary of defining a class called 'Object', since python
already has 'object' as part of its "new style" classes.
I can understand why, but till now it didn't give any problems and I too don't see why it should except for reading. But it greatly enlarges my understanding of what ever I might be doing.
-- You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/xsUkzV2ZVkkJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Hard time debugging an strange problem
Al 31/08/12 18:26, En/na Tomas Neme ha escrit:
> I'd like to see some of your management commands' code.
>
> It smells somewhat like you're running a shell subprocess and not
> waiting for it to be done before going on to the next thing
>
Thanks for taking the time to answer.
I've thought on this. On a prior version the "python setup.py develop"
was executed from the management command, but I've commented it out and
I've added it as a separated command in the script (just in case).
I think that I've found what the problem is. It's explained in other e-mail.
If you're still interested on taking a look at the code drop me a
private mail.
Regards,
Alexis
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
> I'd like to see some of your management commands' code.
>
> It smells somewhat like you're running a shell subprocess and not
> waiting for it to be done before going on to the next thing
>
Thanks for taking the time to answer.
I've thought on this. On a prior version the "python setup.py develop"
was executed from the management command, but I've commented it out and
I've added it as a separated command in the script (just in case).
I think that I've found what the problem is. It's explained in other e-mail.
If you're still interested on taking a look at the code drop me a
private mail.
Regards,
Alexis
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: How to package a django application
I see, your actual problem is not really related either to packaging a django app or to using custom script. are you using django's in built user model ? if yes, then you can do something like this.
--
Thanks & Regards
----------------------------
Amyth [Admin - Techstricks]
Email - aroras.official@gmail.com, admin@techstricks.com
Twitter - @a_myth_________
http://techstricks.com/
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
from django.contrib.auth import authenticate, login
from django.shortcuts import render_to_response
def login(request):
if request.method == 'POST':
username = request.POST['username']
password = request.POST['password']
user = authenticate(username=username, password=password)
if user is not None:
if user.is_active:
return render_to_response('login_succes.html', {'user' : user})
else:
return render_to_response('activate_account.html', {'user': user})
else:
data = {
'error' : 'Username and Password does not match'
}
return render_to_response('login_failed.html', {'data' : data})
On Fri, Aug 31, 2012 at 5:22 PM, Muhammed Salman <salmanmanekia@gmail.com> wrote:
Thanks Amyth, Can you please see my reply to Dennis. I have further explained it there what i am exactly looking for ...
On Friday, August 31, 2012 9:00:06 AM UTC+3, Amyth wrote:Using pure python scripts with django is not all that difficult, as django itself is a python package. So , you can simply have a custom script "mailserver.py" (or whatever name) and you import the script to your views and simply call the functions from your custom script under the respective user request. For Example:Custom Script = mailserver.pydef sendWelcomeEmail(to, from):""" Function to send aWelcome email to First Time Subscribers."""Django App's Views.pyfrom django.http import HttpResponseimport mailserverdef firstTimers(request):usermail = request.POST['email']mailserver.sendWelcome(useremail, 'myn...@mydomain.com')success = '<html><body><h1>Mail Sent.</h1></body></html>'return HttpResponse(success)On Fri, Aug 31, 2012 at 10:51 AM, Dennis Lee Bieber <wlf...@ix.netcom.com> wrote:
On Thu, 30 Aug 2012 19:45:20 -0700 (PDT), Muhammed Salman<salman...@gmail.com> declaimed the following in
gmane.comp.python.django.user:
I'm not sure I understand what you mean by "email based
> Hi,
>
> I am new to python and django development and have developed a simple email
> based authentication form as a part of an exercise. Now, i have two
> questions
authentication form"
Taken literally, to me it implies that you have a template email in
which someone fills out fields and sends it to "you", whereupon you will
take the information in the email, validate it, record it in some user
database, and email back some random account name and password.
Or it could mean you are supposed to have a web-page for users to
register, you record their name, password, and email address in a
database but do not activate it yet, then send an email to them with
instructions that they reply to it if they are really the person who
attempted to register. Then when you receive the reply you match it
against the database and activate the account.
Mistake #1 -- the time spent developing in Django could have been
>
> 1: The requirement from me for this exercise was to create it without any
> frameworks but i started it with django so its easier initially and indeed
spent studying the core Python library, which is what your "without any
frameworks" indicates.
Obviously, by starting over from scratch.
> it was.So, can someone please tell how to move from this point. I mean if
Are you supposed to implement an SMTP daemon to receive/deliver
> the email authentication has to be done purely in Python (so that it works
> like "python server.py") how difficult it is and what could be a few good
> resources to get start with that.
email messages, or only periodically read inbound email from a POP3
mailbox?
I'd suggest you start with the documentation for your version of
Pyhthon... In particular the "Python Standard Library" manual. Try the
chapter on "Internet Protocols and Support" (in my copy, for Python 2.7,
this is chapter 20), SimpleHTTPServer (20.19) and CGIHTTPServer (20.20),
poplib (20.9), smtplib (20.12), maybe smtpd (20.13).
On top of that, the chapter on "Internet Data Handling" (chapter 18
in my copy), email (18.1), mailbox (18.4)
"Data Persistance" (11), sqlite3 (11.13)
If you need a more capable server than the two mentioned above,
check the chapter "Interprocess Communication" (17), asyncore (17.6)
I would think the instructor wouldn't have given you a "no
> 2: I also have a time deadline for this. So if i am not able to do it
> purely with python which packages/files/folders should i send to the
> teacher and what instructions shall i wrote in the readme to make sure that
> my application run on his machine with the least fuss.
frameworks" requirement if they expect assignments to have dependencies
on outside packages.
wlf...@ix.netcom.com HTTP://wlfraed.home.netcom.com/--
Wulfraed Dennis Lee Bieber AF6VN
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.Email - aroras....@gmail.com, ad...@techstricks.com--
Thanks & Regards
----------------------------
Amyth [Admin - Techstricks]--To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/4fZoFKUR0-EJ.
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Thanks & Regards
----------------------------
Amyth [Admin - Techstricks]
Email - aroras.official@gmail.com, admin@techstricks.com
Twitter - @a_myth_________
http://techstricks.com/
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: How sitemaps used in the Django
hi
sitemaps is easy.. last day i implement it in only 2 hours read the documentation in django web.
just follow the documentation ˆ⌣ˆ
Sent from my iPhone
Sent from my iPhone
Please help me in generating site maps for app. which is in django.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/ZLpW-xn_TEYJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Django development running on 127.0.0.1:8000 not accessible from same machine
Chris,
Thank you for your email. I had cleared my cache quite a number of times
before.
What is interesting is that if I start a new Django 1.4.1 the browser
finds the server running at 127.0.0.1:8000 and says it worked.
The application I am working on however still redirects to
www.127.0.0.1:8000 and yes it does do a 301 redirect. The application is
running on Django 1.2.5 but I doubt the version is at fault. I will need
to investigate further.
Cheers,
nav
On Friday 31 August 2012 09:27 PM, Chris Lawlor wrote:
> Oops that should have been addressed to nav, sorry
>
> On Friday, 31 August 2012 11:57:03 UTC-4, Chris Lawlor wrote:
>
> Jirka,
>
> Is your app possibly doing a 301 (Permanent) redirect to www.* ? Or
> possibly some other app you were working on recently? Browsers will
> cache 301 redirects and automatically do the redirect WITHOUT making
> the initial request to 127.0.0.1, so if some project you were
> working on issued that redirect at any point, it will keep doing it,
> even if your current project doesn't issue a redirect. Try clearing
> your browser's cache.
>
> Chris
>
> On Tuesday, 28 August 2012 01:26:20 UTC-4, nav wrote:
>
> Hi Jirka,
>
> That does not seem to be the case. I set rhe proxy server
> settings to no
> proxy and it still prepends a www in front of the IP address. I
> could
> investigate this further but I am little pressed for time at
> present.
>
> Thanks,
> nav
>
> On Tuesday 28 August 2012 10:39 AM, jirka.v...@gmail.com wrote:
> > Hi nav,
> >
> > A long shot - do you happen to have a proxy defined in
> your browser? It is possible to define a proxy for *all* request
> (including localhost) - this would have the same effect.
> >
> > HTH
> >
> > Jirka
> > -----Original Message-----
> > From: nav <navani...@gmail.com>
> > Sender: django...@googlegroups.com
> > Date: Mon, 27 Aug 2012 21:00:12
> > To: Django users<django...@googlegroups.com>
> > Reply-To: django...@googlegroups.com
> > Subject: Re: Django development running on 127.0.0.1:8000
> <http://127.0.0.1:8000> not accessible from
> > same machine
> >
> > Hi Anton,
> >
> > Thank you for your email.
> >
> > I have tried all of the methods you had suggested but to no
> avail.
> >
> > In all my years of Django development the localhost address
> has worked
> > flawlessly. I have also tried with multiple Django projects
> and other
> > Linux installations and the problem persists. This makes me
> think this
> > is a DNS issue that may be due to a network related problem.
> In which
> > case I will have to investigate. I will post once I find a
> work around
> > or solution.
> >
> > Cheers,
> > nav
> >
> > On Aug 27, 5:36 pm, Anton Baklanov <antonbakla...@gmail.com>
> wrote:
> >> oh, i misunderstood your question.
> >>
> >> try to type url with schema into browser's address bar. i
> mean, use 'http://localhost:8000/'instead
> <http://localhost:8000/'instead> of 'localhost:8000'.
> >> also it's possible that some browser extension does this,
> try disabling
> >> them all.
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >> On Mon, Aug 27, 2012 at 10:53 AM, nav
> <navanitach...@gmail.com> wrote:
> >>> Dear Folks,
> >>
> >>> I am running my django development server on 127.0.0.1:8000
> <http://127.0.0.1:8000> and accessing
> >>> this address from my web browser on the same machine. In
> the past few days
> >>> I have found thet the web browsers keep prepending the
> address with "www."
> >>> when using the above address. 127.0.0.1 without the prot
> number works fine
> >>> but the django development server requires a port number.
> >>
> >>> I have not encountered this problem before and am puzzled
> by what is
> >>> happening. I am working on a Kubuntu 12.04 linux box and my
> /etc/hosts/
> >>> file is below if that helps:
> >>
> >>> ====================
> >>> 127.0.0.1 localhost
> >>> 127.0.1.1 <mymachinename>
> >>
> >>> # The following lines are desirable for IPv6 capable hosts
> >>> ::1 ip6-localhost ip6-loopback
> >>> fe00::0 ip6-localnet
> >>> ff00::0 ip6-mcastprefix
> >>> ff02::1 ip6-allnodes
> >>> ff02::2 ip6-allrouters
> >>> ====================
> >>
> >>> TIA
> >>> Cheers,
> >>> nav
> >>
> >>> --
> >>> You received this message because you are subscribed to the
> Google Groups
> >>> "Django users" group.
> >>> To view this discussion on the web visit
> >>> https://groups.google.com/d/msg/django-users/-/EZzlz6iQOGoJ
> <https://groups.google.com/d/msg/django-users/-/EZzlz6iQOGoJ>.>
> To post to this group, send email todjang...@googlegroups.com.
> >>> To unsubscribe from this group, send email
> to>django-users...@googlegroups.com.
> >>> For more options, visit this group at
> >>> http://groups.google.com/group/django-users?hl=en
> <http://groups.google.com/group/django-users?hl=en>.
> >>
> >> --
> >> Regards,
> >> Anton Baklanov
> >
>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/J-wSSpx9UcQJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscribe@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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Thank you for your email. I had cleared my cache quite a number of times
before.
What is interesting is that if I start a new Django 1.4.1 the browser
finds the server running at 127.0.0.1:8000 and says it worked.
The application I am working on however still redirects to
www.127.0.0.1:8000 and yes it does do a 301 redirect. The application is
running on Django 1.2.5 but I doubt the version is at fault. I will need
to investigate further.
Cheers,
nav
On Friday 31 August 2012 09:27 PM, Chris Lawlor wrote:
> Oops that should have been addressed to nav, sorry
>
> On Friday, 31 August 2012 11:57:03 UTC-4, Chris Lawlor wrote:
>
> Jirka,
>
> Is your app possibly doing a 301 (Permanent) redirect to www.* ? Or
> possibly some other app you were working on recently? Browsers will
> cache 301 redirects and automatically do the redirect WITHOUT making
> the initial request to 127.0.0.1, so if some project you were
> working on issued that redirect at any point, it will keep doing it,
> even if your current project doesn't issue a redirect. Try clearing
> your browser's cache.
>
> Chris
>
> On Tuesday, 28 August 2012 01:26:20 UTC-4, nav wrote:
>
> Hi Jirka,
>
> That does not seem to be the case. I set rhe proxy server
> settings to no
> proxy and it still prepends a www in front of the IP address. I
> could
> investigate this further but I am little pressed for time at
> present.
>
> Thanks,
> nav
>
> On Tuesday 28 August 2012 10:39 AM, jirka.v...@gmail.com wrote:
> > Hi nav,
> >
> > A long shot - do you happen to have a proxy defined in
> your browser? It is possible to define a proxy for *all* request
> (including localhost) - this would have the same effect.
> >
> > HTH
> >
> > Jirka
> > -----Original Message-----
> > From: nav <navani...@gmail.com>
> > Sender: django...@googlegroups.com
> > Date: Mon, 27 Aug 2012 21:00:12
> > To: Django users<django...@googlegroups.com>
> > Reply-To: django...@googlegroups.com
> > Subject: Re: Django development running on 127.0.0.1:8000
> <http://127.0.0.1:8000> not accessible from
> > same machine
> >
> > Hi Anton,
> >
> > Thank you for your email.
> >
> > I have tried all of the methods you had suggested but to no
> avail.
> >
> > In all my years of Django development the localhost address
> has worked
> > flawlessly. I have also tried with multiple Django projects
> and other
> > Linux installations and the problem persists. This makes me
> think this
> > is a DNS issue that may be due to a network related problem.
> In which
> > case I will have to investigate. I will post once I find a
> work around
> > or solution.
> >
> > Cheers,
> > nav
> >
> > On Aug 27, 5:36 pm, Anton Baklanov <antonbakla...@gmail.com>
> wrote:
> >> oh, i misunderstood your question.
> >>
> >> try to type url with schema into browser's address bar. i
> mean, use 'http://localhost:8000/'instead
> <http://localhost:8000/'instead> of 'localhost:8000'.
> >> also it's possible that some browser extension does this,
> try disabling
> >> them all.
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >> On Mon, Aug 27, 2012 at 10:53 AM, nav
> <navanitach...@gmail.com> wrote:
> >>> Dear Folks,
> >>
> >>> I am running my django development server on 127.0.0.1:8000
> <http://127.0.0.1:8000> and accessing
> >>> this address from my web browser on the same machine. In
> the past few days
> >>> I have found thet the web browsers keep prepending the
> address with "www."
> >>> when using the above address. 127.0.0.1 without the prot
> number works fine
> >>> but the django development server requires a port number.
> >>
> >>> I have not encountered this problem before and am puzzled
> by what is
> >>> happening. I am working on a Kubuntu 12.04 linux box and my
> /etc/hosts/
> >>> file is below if that helps:
> >>
> >>> ====================
> >>> 127.0.0.1 localhost
> >>> 127.0.1.1 <mymachinename>
> >>
> >>> # The following lines are desirable for IPv6 capable hosts
> >>> ::1 ip6-localhost ip6-loopback
> >>> fe00::0 ip6-localnet
> >>> ff00::0 ip6-mcastprefix
> >>> ff02::1 ip6-allnodes
> >>> ff02::2 ip6-allrouters
> >>> ====================
> >>
> >>> TIA
> >>> Cheers,
> >>> nav
> >>
> >>> --
> >>> You received this message because you are subscribed to the
> Google Groups
> >>> "Django users" group.
> >>> To view this discussion on the web visit
> >>> https://groups.google.com/d/msg/django-users/-/EZzlz6iQOGoJ
> <https://groups.google.com/d/msg/django-users/-/EZzlz6iQOGoJ>.>
> To post to this group, send email todjang...@googlegroups.com.
> >>> To unsubscribe from this group, send email
> to>django-users...@googlegroups.com.
> >>> For more options, visit this group at
> >>> http://groups.google.com/group/django-users?hl=en
> <http://groups.google.com/group/django-users?hl=en>.
> >>
> >> --
> >> Regards,
> >> Anton Baklanov
> >
>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/J-wSSpx9UcQJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscribe@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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Hard time debugging an strange problem
Hi again,
doing some more testing I've realized that the problem happens because
the .py and .pyc files are out of sync. My guess is that the .py files
are modified so quickly that the timestamp does not change and a
recompilation is not triggered. After some research I've found that the
timestamp resolution depends on the filesystem (I'm doing the tests on
ext3 which has a resolution of 1 second).
Regards
Alexis
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
doing some more testing I've realized that the problem happens because
the .py and .pyc files are out of sync. My guess is that the .py files
are modified so quickly that the timestamp does not change and a
recompilation is not triggered. After some research I've found that the
timestamp resolution depends on the filesystem (I'm doing the tests on
ext3 which has a resolution of 1 second).
Regards
Alexis
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Hard time debugging an strange problem
I'd like to see some of your management commands' code.
It smells somewhat like you're running a shell subprocess and not
waiting for it to be done before going on to the next thing
--
"The whole of Japan is pure invention. There is no such country, there
are no such people" --Oscar Wilde
|_|0|_|
|_|_|0|
|0|0|0|
(\__/)
(='.'=)This is Bunny. Copy and paste bunny
(")_(") to help him gain world domination.
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
It smells somewhat like you're running a shell subprocess and not
waiting for it to be done before going on to the next thing
--
"The whole of Japan is pure invention. There is no such country, there
are no such people" --Oscar Wilde
|_|0|_|
|_|_|0|
|0|0|0|
(\__/)
(='.'=)This is Bunny. Copy and paste bunny
(")_(") to help him gain world domination.
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Django development running on 127.0.0.1:8000 not accessible from same machine
Oops that should have been addressed to nav, sorry
On Friday, 31 August 2012 11:57:03 UTC-4, Chris Lawlor wrote:
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/J-wSSpx9UcQJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
On Friday, 31 August 2012 11:57:03 UTC-4, Chris Lawlor wrote:
Jirka,--Is your app possibly doing a 301 (Permanent) redirect to www.* ? Or possibly some other app you were working on recently? Browsers will cache 301 redirects and automatically do the redirect WITHOUT making the initial request to 127.0.0.1, so if some project you were working on issued that redirect at any point, it will keep doing it, even if your current project doesn't issue a redirect. Try clearing your browser's cache.Chris
On Tuesday, 28 August 2012 01:26:20 UTC-4, nav wrote:Hi Jirka,
That does not seem to be the case. I set rhe proxy server settings to no
proxy and it still prepends a www in front of the IP address. I could
investigate this further but I am little pressed for time at present.
Thanks,
nav
On Tuesday 28 August 2012 10:39 AM, jirka.v...@gmail.com wrote:
> Hi nav,
>
> A long shot - do you happen to have a proxy defined in your browser? It is possible to define a proxy for *all* request (including localhost) - this would have the same effect.
>
> HTH
>
> Jirka
> -----Original Message-----
> From: nav <navani...@gmail.com>
> Sender: django...@googlegroups.com
> Date: Mon, 27 Aug 2012 21:00:12
> To: Django users<django...@googlegroups.com >
> Reply-To: django...@googlegroups.com
> Subject: Re: Django development running on 127.0.0.1:8000 not accessible from
> same machine
>
> Hi Anton,
>
> Thank you for your email.
>
> I have tried all of the methods you had suggested but to no avail.
>
> In all my years of Django development the localhost address has worked
> flawlessly. I have also tried with multiple Django projects and other
> Linux installations and the problem persists. This makes me think this
> is a DNS issue that may be due to a network related problem. In which
> case I will have to investigate. I will post once I find a work around
> or solution.
>
> Cheers,
> nav
>
> On Aug 27, 5:36 pm, Anton Baklanov <antonbakla...@gmail.com> wrote:
>> oh, i misunderstood your question.
>>
>> try to type url with schema into browser's address bar. i mean, use 'http://localhost:8000/'instead of 'localhost:8000'.
>> also it's possible that some browser extension does this, try disabling
>> them all.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> On Mon, Aug 27, 2012 at 10:53 AM, nav <navanitach...@gmail.com> wrote:
>>> Dear Folks,
>>
>>> I am running my django development server on 127.0.0.1:8000 and accessing
>>> this address from my web browser on the same machine. In the past few days
>>> I have found thet the web browsers keep prepending the address with "www."
>>> when using the above address. 127.0.0.1 without the prot number works fine
>>> but the django development server requires a port number.
>>
>>> I have not encountered this problem before and am puzzled by what is
>>> happening. I am working on a Kubuntu 12.04 linux box and my /etc/hosts/
>>> file is below if that helps:
>>
>>> ====================
>>> 127.0.0.1 localhost
>>> 127.0.1.1 <mymachinename>
>>
>>> # The following lines are desirable for IPv6 capable hosts
>>> ::1 ip6-localhost ip6-loopback
>>> fe00::0 ip6-localnet
>>> ff00::0 ip6-mcastprefix
>>> ff02::1 ip6-allnodes
>>> ff02::2 ip6-allrouters
>>> ====================
>>
>>> TIA
>>> Cheers,
>>> nav
>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Django users" group.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msg/django-users/-/ .> To post to this group, send email todjang...@googlegroups.com.EZzlz6iQOGoJ
>>> To unsubscribe from this group, send email to>django-users...@googlegroups.com .
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-users?hl=en .
>>
>> --
>> Regards,
>> Anton Baklanov
>
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/J-wSSpx9UcQJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Django development running on 127.0.0.1:8000 not accessible from same machine
Jirka,
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/dRWXRh3NMl0J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Is your app possibly doing a 301 (Permanent) redirect to www.* ? Or possibly some other app you were working on recently? Browsers will cache 301 redirects and automatically do the redirect WITHOUT making the initial request to 127.0.0.1, so if some project you were working on issued that redirect at any point, it will keep doing it, even if your current project doesn't issue a redirect. Try clearing your browser's cache.
Chris
On Tuesday, 28 August 2012 01:26:20 UTC-4, nav wrote:
-- On Tuesday, 28 August 2012 01:26:20 UTC-4, nav wrote:
Hi Jirka,
That does not seem to be the case. I set rhe proxy server settings to no
proxy and it still prepends a www in front of the IP address. I could
investigate this further but I am little pressed for time at present.
Thanks,
nav
On Tuesday 28 August 2012 10:39 AM, jirka.v...@gmail.com wrote:
> Hi nav,
>
> A long shot - do you happen to have a proxy defined in your browser? It is possible to define a proxy for *all* request (including localhost) - this would have the same effect.
>
> HTH
>
> Jirka
> -----Original Message-----
> From: nav <navani...@gmail.com>
> Sender: django...@googlegroups.com
> Date: Mon, 27 Aug 2012 21:00:12
> To: Django users<django...@googlegroups.com >
> Reply-To: django...@googlegroups.com
> Subject: Re: Django development running on 127.0.0.1:8000 not accessible from
> same machine
>
> Hi Anton,
>
> Thank you for your email.
>
> I have tried all of the methods you had suggested but to no avail.
>
> In all my years of Django development the localhost address has worked
> flawlessly. I have also tried with multiple Django projects and other
> Linux installations and the problem persists. This makes me think this
> is a DNS issue that may be due to a network related problem. In which
> case I will have to investigate. I will post once I find a work around
> or solution.
>
> Cheers,
> nav
>
> On Aug 27, 5:36 pm, Anton Baklanov <antonbakla...@gmail.com> wrote:
>> oh, i misunderstood your question.
>>
>> try to type url with schema into browser's address bar. i mean, use 'http://localhost:8000/'instead of 'localhost:8000'.
>> also it's possible that some browser extension does this, try disabling
>> them all.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> On Mon, Aug 27, 2012 at 10:53 AM, nav <navanitach...@gmail.com> wrote:
>>> Dear Folks,
>>
>>> I am running my django development server on 127.0.0.1:8000 and accessing
>>> this address from my web browser on the same machine. In the past few days
>>> I have found thet the web browsers keep prepending the address with "www."
>>> when using the above address. 127.0.0.1 without the prot number works fine
>>> but the django development server requires a port number.
>>
>>> I have not encountered this problem before and am puzzled by what is
>>> happening. I am working on a Kubuntu 12.04 linux box and my /etc/hosts/
>>> file is below if that helps:
>>
>>> ====================
>>> 127.0.0.1 localhost
>>> 127.0.1.1 <mymachinename>
>>
>>> # The following lines are desirable for IPv6 capable hosts
>>> ::1 ip6-localhost ip6-loopback
>>> fe00::0 ip6-localnet
>>> ff00::0 ip6-mcastprefix
>>> ff02::1 ip6-allnodes
>>> ff02::2 ip6-allrouters
>>> ====================
>>
>>> TIA
>>> Cheers,
>>> nav
>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Django users" group.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msg/django-users/-/ .> To post to this group, send email todjang...@googlegroups.EZzlz6iQOGoJ com .
>>> To unsubscribe from this group, send email to>django-users...@googlegroups.com .
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-users?hl=en .
>>
>> --
>> Regards,
>> Anton Baklanov
>
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/dRWXRh3NMl0J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Id error
In your CountryForm, calling super(self.__class__)... might not be a
good idea. You should name the class, ie.
super(CountryForm, self).save(*args, **kwargs)
I'd also be wary of defining a class called 'Object', since python
already has 'object' as part of its "new style" classes.
Paul
On Fri, 2012-08-31 at 07:58 -0700, Drvanon wrote:
> Hello django-ers,
>
>
> Today I had a good dream in which I though I fixed something in my
> bug-magnet.
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
good idea. You should name the class, ie.
super(CountryForm, self).save(*args, **kwargs)
I'd also be wary of defining a class called 'Object', since python
already has 'object' as part of its "new style" classes.
Paul
On Fri, 2012-08-31 at 07:58 -0700, Drvanon wrote:
> Hello django-ers,
>
>
> Today I had a good dream in which I though I fixed something in my
> bug-magnet.
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: How sitemaps used in the Django
nearly forgot, also in urls.py...
(r'^sitemap\.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps}),
On Friday, August 31, 2012 10:04:26 AM UTC+1, Mugdha wrote:
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/yrioUkQZcFAJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
(r'^sitemap\.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps}),
On Friday, August 31, 2012 10:04:26 AM UTC+1, Mugdha wrote:
Please help me in generating site maps for app. which is in django.--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/yrioUkQZcFAJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: How sitemaps used in the Django
Hi Mugdha,
First add 'django.contrib.sitemaps' to your installed apps.
Then create a file "sitemap.py" in your project root with something like....
****************
from django.core.urlresolvers import reverse
from django.contrib.sitemaps import Sitemap
from blog.models import Entry
class ViewSitemap(Sitemap):
"""Reverse static views for XML sitemap."""
def items(self):
# Return list of url names for views to include in sitemap
return ['home']
def location(self, item):
return reverse(item)
class BlogSitemap(Sitemap):
changefreq = "never"
priority = 0.5
def items(self):
return Entry.objects.filter(status=1)
def lastmod(self, obj):
return obj.pub_date
sitemaps = {'views': ViewSitemap,
'blog_posts': BlogSitemap,
}
*******************
in urls.py...
**********************
from project.sitemap import sitemaps
.....
url('^$', home, name='home'),
....etc...
On Friday, August 31, 2012 10:04:26 AM UTC+1, Mugdha wrote:
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/QOnbgyvZ9qAJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
First add 'django.contrib.sitemaps' to your installed apps.
Then create a file "sitemap.py" in your project root with something like....
****************
from django.core.urlresolvers import reverse
from django.contrib.sitemaps import Sitemap
from blog.models import Entry
class ViewSitemap(Sitemap):
"""Reverse static views for XML sitemap."""
def items(self):
# Return list of url names for views to include in sitemap
return ['home']
def location(self, item):
return reverse(item)
class BlogSitemap(Sitemap):
changefreq = "never"
priority = 0.5
def items(self):
return Entry.objects.filter(status=1)
def lastmod(self, obj):
return obj.pub_date
sitemaps = {'views': ViewSitemap,
'blog_posts': BlogSitemap,
}
*******************
in urls.py...
**********************
from project.sitemap import sitemaps
.....
url('^$', home, name='home'),
....etc...
On Friday, August 31, 2012 10:04:26 AM UTC+1, Mugdha wrote:
Please help me in generating site maps for app. which is in django.--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/QOnbgyvZ9qAJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Syncdb Error With Oracle Database - IntegrityError Exception
On Friday, August 31, 2012 12:10:54 AM UTC-6, Amyth wrote:
As described in that ticket, the reason for the problem is probably just that the Django user does not have the CREATE TRIGGER privilege, which it needs. The bug in Django is just that this condition is not detected and reported at the time the table is created, instead of getting a rather more obscure error message at the time the table is populated.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/BKHoqoZkF6oJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Hey Jon,I guess this is because of a bug in django. Django already has a open ticket for this bug. Check it out here.
As described in that ticket, the reason for the problem is probably just that the Django user does not have the CREATE TRIGGER privilege, which it needs. The bug in Django is just that this condition is not detected and reported at the time the table is created, instead of getting a rather more obscure error message at the time the table is populated.
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/BKHoqoZkF6oJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
setting up Django Compressor
Hi,
Django1.4, Python2.7
I am currently trying to get django compressor to work locally, I installed django_compressor via pip install earlier, added it to my installed apps. Here is a copy of my base template....
************************
{% load i18n %}
{% load compress %}
<!doctype html>
<!--[if lt IE 7]> <html class="no-js ie6" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8" lang="en"> <![endif]-->
<!--[if IE 9 ]> <html class="ie9" > <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html> <!--<![endif]-->
<head>
<meta charset="utf-8"/>
{% compress css %}
<link rel="stylesheet" media="all" href="{{ STATIC_URL }}css/style.css" type="text/css" charset="utf-8" />
{% endcompress %}
.....
************************
When I view the source it outputs the following....
**************************
**************************
So it is creating the cached css file, but it doesn't seem to be able to find it(ie page loads with no style applied to it), any ideas what it could be that I am missing?
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/qpwRn4wDPycJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Django1.4, Python2.7
I am currently trying to get django compressor to work locally, I installed django_compressor via pip install earlier, added it to my installed apps. Here is a copy of my base template....
************************
{% load i18n %}
{% load compress %}
<!doctype html>
<!--[if lt IE 7]> <html class="no-js ie6" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8" lang="en"> <![endif]-->
<!--[if IE 9 ]> <html class="ie9" > <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html> <!--<![endif]-->
<head>
<meta charset="utf-8"/>
{% compress css %}
<link rel="stylesheet" media="all" href="{{ STATIC_URL }}css/style.css" type="text/css" charset="utf-8" />
{% endcompress %}
.....
************************
When I view the source it outputs the following....
**************************
<!doctype html> <!--[if lt IE 7]> <html class="no-js ie6" lang="en"> <![endif]--> <!--[if IE 7]> <html class="no-js ie7" lang="en"> <![endif]--> <!--[if IE 8]> <html class="no-js ie8" lang="en"> <![endif]--> <!--[if IE 9 ]> <html class="ie9" > <![endif]--> <!--[if (gt IE 9)|!(IE)]><!--> <html> <!--<![endif]--> <head> <meta charset="utf-8"/> <link rel="stylesheet" href="/media/CACHE/css/fbe3d01c9f33.css" type="text/css" media="all" />
**************************
So it is creating the cached css file, but it doesn't seem to be able to find it(ie page loads with no style applied to it), any ideas what it could be that I am missing?
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/qpwRn4wDPycJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: brute force protection
For my long term plans I want it to be app based. To start with I want to give 3 tries and then lockout. For my use case this will work. Long term I like to add IP and move over to a captcha after 3 tries and a delay like 2^tryNumber.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/g_lZU7WgOQkJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Id error
Hello django-ers,
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/Ye1OKiEEDEsJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Today I had a good dream in which I though I fixed something in my bug-magnet. This was the outcome:
# The Error
# The Error
Environment:
Request Method: POST
Request URL: http://127.0.0.1:8000/main
Django Version: 1.4.1
Python Version: 2.7.3
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'main',
'django.contrib.admin')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware')
Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
111. response = callback(request, *callback_args, **callback_kwargs)
File "/home/rob/b4buy/main/views.py" in main
23. form.save()
File "/home/rob/b4buy/main/forms.py" in save
9. super(self.__class__, self).save(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/forms/models.py" in save
364. fail_message, commit, construct=False)
File "/usr/local/lib/python2.7/dist-packages/django/forms/models.py" in save_instance
86. instance.save()
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py" in save
463. self.save_base(using=using, force_insert=force_insert, force_update=force_update)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py" in save_base
551. result = manager._insert([self], fields=fields, return_id=update_pk, using=using, raw=raw)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py" in _insert
203. return insert_query(self.model, objs, fields, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py" in insert_query
1576. return query.get_compiler(using=using).execute_sql(return_id)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py" in execute_sql
910. cursor.execute(sql, params)
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/util.py" in execute
40. return self.cursor.execute(sql, params)
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/sqlite3/base.py" in execute
337. return Database.Cursor.execute(self, query, params)
Exception Type: IntegrityError at /main
Exception Value: main_country.ruler_id may not be NULL
# the views.py
from django.shortcuts import render_to_response
from django.core.context_processors import csrf
from django.http import HttpResponseRedirect
from main.models import *
from django.forms.models import modelform_factory
from main.forms import CountryForm
def main(request):
c = {}
c.update(csrf(request))
c['title'] = 'Main'
c['NO_COUNTRY'] = False
form = CountryForm()
c['form'] = form
if not request.user.is_authenticated():
return HttpResponseRedirect('/')
if not request.user.country_set.all():
c['NO_COUNTRY'] = True
if request.method == 'POST':
form = CountryForm(request.POST)
form.ruler = request.user
if form.is_valid():
form.save()
return render_to_response("main.html", c)
# the models.py
from django.db import models
from web.models import User
class Space(models.Model):
name = models.CharField(max_length=50)
owner = models.ForeignKey("Object")
def __unicode__(self):
return u'{} of {}'.format(self.name, self.owner)
class Object(models.Model):
name = models.CharField(max_length=100)
container = models.ForeignKey(Space, blank=True, null=True)
def __unicode__(self):
return self.name + u' object'
class Country(Space):
type = models.CharField(choices=(('1', 'farmer'), ('2', 'producer'),
('3', 'traveler')), max_length=1,
default='1')
position = models.CommaSeparatedIntegerField(max_length=2)
ruler = models.ForeignKey(User)
class Material(Object):
mass = models.IntegerField()
quality = models.IntegerField()
class Meta:
abstract = True
def use():
self.delete()
class Tool(Object):
mass = models.IntegerField()
class Meta:
abstract = True
class Hammer(Tool):
def slam(self, object):
object.times_slammed += 1
object.save()
class Room(Space):
max_items = models.IntegerField()
def add(self, obect):
object.container = self
object.save()
class Building(Object):
usable = models.BooleanField(default=False)
def build(self):
for object in container.object_set.all():
if object in self.needed_materials:
self.needed_materials.remove(object)
object.use()
if not needed_materials:
self.usable = True
# the forms.py of course
from django import forms
from django.forms import HiddenInput
from main.models import Country, Object
class CountryForm(forms.ModelForm):
def save(self, *args, **kwargs):
self.position = '1, 1'
self.owner = Object.objects.filter(name='Universe')[0]
super(self.__class__, self).save(*args, **kwargs)
class Meta:
fields = ('name', 'type')
model = Country
I add the Object Universe manually via the admin
If anybody could share a little help, I would gladly receive it.
Drvanon
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/Ye1OKiEEDEsJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Provide a single text field (editable through admin panel) w/o using a whole model
I'd like to have the content of one <p> tag in the homepage editable in admin back-office, going through a whole model feels like an overkill, what alternatives do I have ?
If there's no alternative, is there a way to properly limit the number of elements to 1 in the admin panel ?
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/cuOGukeOYZgJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
If there's no alternative, is there a way to properly limit the number of elements to 1 in the admin panel ?
Any help appreciated, I'm sure I missed something obvious because it seems like a basic need. (I'm new to django if u didn't catch it !)
-- You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/cuOGukeOYZgJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Javascript Image Hollover In Django
Hey,
--
Thanks & Regards
----------------------------
Amyth [Admin - Techstricks]
Email - aroras.official@gmail.com, admin@techstricks.com
Twitter - @a_myth_________
http://techstricks.com/
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
dun think this is really Django related, but still i created a jquery example for you, check it http://jsfiddle.net/TjUtq/
Thanks & Regards
----------------------------
Amyth [Admin - Techstricks]
Email - aroras.official@gmail.com, admin@techstricks.com
Twitter - @a_myth_________
http://techstricks.com/
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Provide editable single text field (through admin) w/o using a whole model
I'd like to have a single text field that stands for the text in the homepage, and editable in the admin panel, what way would you do this ?
Having a whole class for this seems like a waste to me, except if there's maybe a way to set/limit the number of entries properly in the model ?
(I'm obviously kind of new to django, any clue appreciated)
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/zGGBPZUjX-YJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Having a whole class for this seems like a waste to me, except if there's maybe a way to set/limit the number of entries properly in the model ?
(I'm obviously kind of new to django, any clue appreciated)
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/zGGBPZUjX-YJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: coding urls in templates
Hi Amyth- That is exactly what I needed. Thanks. I'm now updating all my views. - Mike
On Aug 31, 2012, at 8:44 AM, Amyth Arora <aroras.official@gmail.com> wrote:
Hey Mike,
I think i understand what you are trying to achieve now. You can basically name your urls and then call the url template tag in the templates with the url name as follows, this way you will not break any urls in your template if you simply move your app to a new location.
Example:
#zetawrite account urls
urlpatterns += patterns('zetawrite.views',
url(r'^zetawrite/account/signup/$', 'account_signup', name='account_signup'),
url(r'^zetawrite/account/profile/$', 'account_profile', name='account_profile'),
url(r'^zetawrite/account/settings/$', 'account_settings', name='account_settings'),
)
Then use the url template tag as follows:for an anchor tag like <a href="/account/profile">Profile</a>use <a href="{% url account_profile %}">Profile</a>Hope this helps.
On Fri, Aug 31, 2012 at 11:33 AM, Michael Thon <mike.thon@gmail.com> wrote:
>
> the root directlry of my domain is hosting wordpress, which I'm using to develop the landing pages:
> www.zetawrite.com (I know, it still needs a lot of work).
>
> The app itself will only be available to logged in users so I thought that the easiest way to deploy it would be to run it in a subdirectory of the main website. Now I'm trying to do my first deployment to a staging server.
>
> here's the project level urls.py:
>
> urlpatterns = patterns('',
> # Uncomment the admin/doc line below to enable admin documentation:
> url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
>
> # Uncomment the next line to enable the admin:
> url(r'^zetawrite/admin/', include(admin.site.urls)),
> url(r'^zetawrite/accounts/', include('registration.backends.default.urls')),
> url(r'zetawrite/', include('sieveapp.urls')),
>
> )
>
> Eventually, If the app gets traction, I'll want to have the wordpress landing pages and the django project running on separate servers, so I should figure out how I can move it without changing any urls...
>
>
> On Aug 31, 2012, at 7:45 AM, Amyth Arora <aroras.official@gmail.com> wrote:
>
> could you post the directory structure and your urls.py file. Thanks.
>
> On Fri, Aug 31, 2012 at 11:00 AM, Mike <mike.thon@gmail.com> wrote:
>>
>> Quick question: I changed my urls.py so I can run my project in a subdirectory and I broke all the urls in my templates. Should I be using {% url path.to.some_view v1 v2 %} in all my templates instead of hard coding the path?
>>
>> --
>> You received this message because you are subscribed to the Google Groups "Django users" group.
>> To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/SV-wL8jMdCUJ.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
>> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>
>
>
>
> --
> Thanks & Regards
> ----------------------------
>
> Amyth [Admin - Techstricks]
> Email - aroras.official@gmail.com, admin@techstricks.com
> Twitter - @a_myth_________
> http://techstricks.com/
>
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to django-users+unsubscribe@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+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
--
Thanks & Regards
----------------------------
Amyth [Admin - Techstricks]
Email - aroras.official@gmail.com, admin@techstricks.com
Twitter - @a_myth_________
http://techstricks.com/--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Subscribe to:
Posts (Atom)