Re: using historic changes from django-admin to templates?

2014-08-17 Thread Collin Anderson
Or, is the data on the admin "history" page good enough? You could just 
import LogEntry and start querying it. The model is undocumented and not 
guaranteed to be a stable API, but you can see the model here:

https://github.com/django/django/blob/master/django/contrib/admin/models.py

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c115a3d4-6281-4513-92a8-c7395747feb2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Multilingual search with Haystack

2014-08-17 Thread Collin Anderson
Could you simply have a field to record the language, and then filter by 
that language when searching?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2ac27cdb-8592-472f-b6b4-cdee48ff02bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Desperatly seeking help with ALLOWED_HOSTS

2014-08-17 Thread Cal Leeming [iops.io]
Beautiful, glad you got it sorted out, and thanks for sharing the fix!

Cal


On Sun, Aug 17, 2014 at 8:57 PM, Subodh Nijsure 
wrote:

> Thank you SO MUCH for that suggestion for logger. I have some compress
> tags in my templates, but I guess I haven't configured that correctly.
> And I was getting following error.
>
>
>   File
> "/home/ubuntu/.virtualenvs/myvirt/lib/python2.7/site-packages/compressor/base.py",
> line 121, in get_filename
> filename = self.storage.path(basename)
>   File
> "/home/ubuntu/.virtualenvs/myvirt/lib/python2.7/site-packages/django/core/files/storage.py",
> line 261, in path
> raise SuspiciousFileOperation("Attempted access to '%s' denied." %
> name)
> SuspiciousFileOperation: Attempted access to '/css/bootstrap311.min.css'
> denied.
> Not Found: /accounts/login/
>
> the way I debugged this was creating following setup in my
> production.py and then /tmp/debug.log had this error.
>
> LOGGING = {
> 'version': 1,
> 'disable_existing_loggers': False,
> 'handlers': {
> 'file': {
> 'level': 'DEBUG',
> 'class': 'logging.FileHandler',
> 'filename': '/tmp/debug.log',
> },
> },
> 'loggers': {
> 'django.request': {
> 'handlers': ['file'],
> 'level': 'DEBUG',
> 'propagate': True,
> },
> },
> }
>
> I removed the {% compress %} tags from my templates for now so I can
> disable DEBUG on my "production/demo" server and everything works
> great now!
>
> -Subodh
>
> On Sun, Aug 17, 2014 at 11:53 AM, Cal Leeming [iops.io] 
> wrote:
> > Interesting, you could try removing the 400.html and allow it to raise
> the
> > original exception that caused it.
> >
> > You could also try using a different WSGI server, such as uWSGI or
> gunicorn,
> > as it could be a problem with that.
> >
> > Another option would be to use something like Sentry to capture the
> errors,
> > or modify your `settings.LOGGING` to send to stderr.
> >
> > Cal
> >
> >
> > On Sun, Aug 17, 2014 at 7:46 PM, Subodh Nijsure <
> subodh.nijs...@gmail.com>
> > wrote:
> >>
> >> Unfortunately I don't see traceback neither in my nginx log or my
> >> apache log that is what is making it very confusing and difficult to
> >> debug...
> >>
> >> -Subodh
> >>
> >> On Sun, Aug 17, 2014 at 11:37 AM, Cal Leeming [iops.io] 
> >> wrote:
> >> > Can you please send us the traceback of the error generated? (assuming
> >> > there
> >> > is one)
> >> >
> >> > Cal
> >> >
> >> >
> >> > On Sun, Aug 17, 2014 at 7:25 PM, Subodh Nijsure
> >> > 
> >> > wrote:
> >> >>
> >> >> I am totally stumped why I can't get my site to work when
> DEBUG=False.
> >> >>
> >> >> I have entered my domain name and IP address in the ALLOWED_HOSTS
> >> >>
> >> >> I even tried putting '*' in my ALLOWED_HOST but when DEBUG=False I
> >> >> always get my 400.html page served to me. As soon as DEBUG=True
> >> >> everything works great.
> >> >>
> >> >> I have search through google tried all the checks people say to try (
> >> >> I think) , all my urls end in '/'. none of my local.py or base.py
> have
> >> >> DEBUG setting or ALLOWED_HOSTS
> >> >>
> >> >> ALLOWED_HOSTS = ['1.2.3.4', 'www.myhost.com', '*' , ]
> >> >>
> >> >> Nothing seems to be working.
> >> >>
> >> >> I even inserted by own dummy LoginRequierdMiddleware class it does
> get
> >> >> called but I don't see anything wrong with request coming in.
> >> >>
> >> >> class LoginRequiredMiddleware:
> >> >>   def process_request(self, request):
> >> >> print request
> >> >>
> >> >> I am running nginx and apache2 in production environment. I am really
> >> >> stuck , desperately need help!Any clues on how to debug this?
> >> >>
> >> >> -Subodh
> >> >>
> >> >> --
> >> >> You received this message because you are subscribed to the Google
> >> >> Groups
> >> >> "Django users" group.
> >> >> To unsubscribe from this group and stop receiving emails from it,
> send
> >> >> an
> >> >> email to django-users+unsubscr...@googlegroups.com.
> >> >> To post to this group, send email to django-users@googlegroups.com.
> >> >> Visit this group at http://groups.google.com/group/django-users.
> >> >> To view this discussion on the web visit
> >> >>
> >> >>
> https://groups.google.com/d/msgid/django-users/CALr9Q3Y_CvwWo1cPEcmROok13VQOneKnis2m9rwGQULbqo%3DpaQ%40mail.gmail.com
> .
> >> >> For more options, visit https://groups.google.com/d/optout.
> >> >
> >> >
> >> > --
> >> > You received this message because you are subscribed to the Google
> >> > Groups
> >> > "Django users" group.
> >> > To unsubscribe from this group and stop receiving emails from it, send
> >> > an
> >> > email to django-users+unsubscr...@googlegroups.com.
> >> > To post to this group, send email to django-users@googlegroups.com.
> >> > Visit this group at http://groups.google.com/group/django-users.
> >> > To view this discussion on the web visit
> >> >
> 

Re: Desperatly seeking help with ALLOWED_HOSTS

2014-08-17 Thread Subodh Nijsure
Thank you SO MUCH for that suggestion for logger. I have some compress
tags in my templates, but I guess I haven't configured that correctly.
And I was getting following error.


  File 
"/home/ubuntu/.virtualenvs/myvirt/lib/python2.7/site-packages/compressor/base.py",
line 121, in get_filename
filename = self.storage.path(basename)
  File 
"/home/ubuntu/.virtualenvs/myvirt/lib/python2.7/site-packages/django/core/files/storage.py",
line 261, in path
raise SuspiciousFileOperation("Attempted access to '%s' denied." % name)
SuspiciousFileOperation: Attempted access to '/css/bootstrap311.min.css' denied.
Not Found: /accounts/login/

the way I debugged this was creating following setup in my
production.py and then /tmp/debug.log had this error.

LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'file': {
'level': 'DEBUG',
'class': 'logging.FileHandler',
'filename': '/tmp/debug.log',
},
},
'loggers': {
'django.request': {
'handlers': ['file'],
'level': 'DEBUG',
'propagate': True,
},
},
}

I removed the {% compress %} tags from my templates for now so I can
disable DEBUG on my "production/demo" server and everything works
great now!

-Subodh

On Sun, Aug 17, 2014 at 11:53 AM, Cal Leeming [iops.io]  wrote:
> Interesting, you could try removing the 400.html and allow it to raise the
> original exception that caused it.
>
> You could also try using a different WSGI server, such as uWSGI or gunicorn,
> as it could be a problem with that.
>
> Another option would be to use something like Sentry to capture the errors,
> or modify your `settings.LOGGING` to send to stderr.
>
> Cal
>
>
> On Sun, Aug 17, 2014 at 7:46 PM, Subodh Nijsure 
> wrote:
>>
>> Unfortunately I don't see traceback neither in my nginx log or my
>> apache log that is what is making it very confusing and difficult to
>> debug...
>>
>> -Subodh
>>
>> On Sun, Aug 17, 2014 at 11:37 AM, Cal Leeming [iops.io] 
>> wrote:
>> > Can you please send us the traceback of the error generated? (assuming
>> > there
>> > is one)
>> >
>> > Cal
>> >
>> >
>> > On Sun, Aug 17, 2014 at 7:25 PM, Subodh Nijsure
>> > 
>> > wrote:
>> >>
>> >> I am totally stumped why I can't get my site to work when DEBUG=False.
>> >>
>> >> I have entered my domain name and IP address in the ALLOWED_HOSTS
>> >>
>> >> I even tried putting '*' in my ALLOWED_HOST but when DEBUG=False I
>> >> always get my 400.html page served to me. As soon as DEBUG=True
>> >> everything works great.
>> >>
>> >> I have search through google tried all the checks people say to try (
>> >> I think) , all my urls end in '/'. none of my local.py or base.py have
>> >> DEBUG setting or ALLOWED_HOSTS
>> >>
>> >> ALLOWED_HOSTS = ['1.2.3.4', 'www.myhost.com', '*' , ]
>> >>
>> >> Nothing seems to be working.
>> >>
>> >> I even inserted by own dummy LoginRequierdMiddleware class it does get
>> >> called but I don't see anything wrong with request coming in.
>> >>
>> >> class LoginRequiredMiddleware:
>> >>   def process_request(self, request):
>> >> print request
>> >>
>> >> I am running nginx and apache2 in production environment. I am really
>> >> stuck , desperately need help!Any clues on how to debug this?
>> >>
>> >> -Subodh
>> >>
>> >> --
>> >> You received this message because you are subscribed to the Google
>> >> Groups
>> >> "Django users" group.
>> >> To unsubscribe from this group and stop receiving emails from it, send
>> >> an
>> >> email to django-users+unsubscr...@googlegroups.com.
>> >> To post to this group, send email to django-users@googlegroups.com.
>> >> Visit this group at http://groups.google.com/group/django-users.
>> >> To view this discussion on the web visit
>> >>
>> >> https://groups.google.com/d/msgid/django-users/CALr9Q3Y_CvwWo1cPEcmROok13VQOneKnis2m9rwGQULbqo%3DpaQ%40mail.gmail.com.
>> >> For more options, visit https://groups.google.com/d/optout.
>> >
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "Django users" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> > an
>> > email to django-users+unsubscr...@googlegroups.com.
>> > To post to this group, send email to django-users@googlegroups.com.
>> > Visit this group at http://groups.google.com/group/django-users.
>> > To view this discussion on the web visit
>> >
>> > https://groups.google.com/d/msgid/django-users/CAHKQagG%2BoyHxp%3DkOFZLZZBfrVLDcBYpWBPtFRAwKediRdwWkjg%40mail.gmail.com.
>> > For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to 

Re: Should I use generic foreign key, and how?

2014-08-17 Thread Amirouche Boubekki
2014-08-17 11:24 GMT+02:00 Vladimir Chukharev 
:

>
>
> On Saturday, August 16, 2014 10:46:33 PM UTC+3, Aaron Law wrote:
>>
>>
>> Hi all,
>>
>> I have php web programming background, and new to Django. I am helping my
>> brother to build an online system to manage inventory, and I've got a
>> database design & coding problem recently. Needing help!
>>
>> That is, I have a set of tables of "possible products", "inventory",
>> "suppiler", etc. I want to attach a "comment" to each of them. Therefore, I
>> think I should make a generic "comment" table to hold all the comments of
>> products, inventory, suppiler.
>>
>> --
>> possible_products
>> id: int (pk)
>> name: varchar
>> url: varchar
>> price: decimal
>> created_at: datetime
>> updated_at: datetime
>> --
>> comments
>> id: int (pk)
>> parent_id: int (fk)
>> content: text
>> author: int (fk)
>> table: char (which the table this comment belongs to)
>> created_at: datetime
>> updated_at: datatime
>> --
>>
>> My problem is, when "possible_products" table is the parent of "comment",
>> then a foreign key of the parent (id number) is stored in the "comment"
>> table in order to link up them.
>>
>
>> However, how about the fk of the "inventory" table and the "suppiler"
>> table? It should not be that: I create 2 more columns of "inventory_id" nor
>> "suppiler_id" in "comments" table. (That is, I should not create the 4th
>> column when I want to link up the 4th parent table.)
>>
>
> You can make the fk to the "possible_products" table. In your particular
> case, I do not see reasons to take comments into a separate table rather
> than in the parent table, though this might be just omitted in the
> description.
>

I second that. I don't understand why you need to make another table to
store comments.


> I do use this style of inheriting tables with connections between them. If
> you are interested, I have one project in this style in googlecode (early
> stage yet): labman2 .
>
> Note that django docs generally discourage using the involved type on
> table inheritance. I attribute this discourage to wide use of mysql...
>
>
>> So, Should I use generic forgien key of Django? (so that, my "comment"
>> table design is right.) And how to use/implement it?
>>
>> P.S I mainly develop the system in the Admin section of Django.
>>
>> Regards,
>> Aaron Law Ho hon
>> --~--~-~--~~~---~--~~
>> Free as in Freedom ;-)
>> --~--~-~--~~~---~--~~
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/93d80efa-8ef3-426f-a492-f19222c6a4cc%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAL7_Mo8bRX0vAX5hzF_-ajcU4MmPtufJKZ3MQU%3D0dLGNc-Yf9A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Desperatly seeking help with ALLOWED_HOSTS

2014-08-17 Thread Cal Leeming [iops.io]
Interesting, you could try removing the 400.html and allow it to raise the
original exception that caused it.

You could also try using a different WSGI server, such as uWSGI or
gunicorn, as it could be a problem with that.

Another option would be to use something like Sentry to capture the errors,
or modify your `settings.LOGGING` to send to stderr.

Cal


On Sun, Aug 17, 2014 at 7:46 PM, Subodh Nijsure 
wrote:

> Unfortunately I don't see traceback neither in my nginx log or my
> apache log that is what is making it very confusing and difficult to
> debug...
>
> -Subodh
>
> On Sun, Aug 17, 2014 at 11:37 AM, Cal Leeming [iops.io] 
> wrote:
> > Can you please send us the traceback of the error generated? (assuming
> there
> > is one)
> >
> > Cal
> >
> >
> > On Sun, Aug 17, 2014 at 7:25 PM, Subodh Nijsure <
> subodh.nijs...@gmail.com>
> > wrote:
> >>
> >> I am totally stumped why I can't get my site to work when DEBUG=False.
> >>
> >> I have entered my domain name and IP address in the ALLOWED_HOSTS
> >>
> >> I even tried putting '*' in my ALLOWED_HOST but when DEBUG=False I
> >> always get my 400.html page served to me. As soon as DEBUG=True
> >> everything works great.
> >>
> >> I have search through google tried all the checks people say to try (
> >> I think) , all my urls end in '/'. none of my local.py or base.py have
> >> DEBUG setting or ALLOWED_HOSTS
> >>
> >> ALLOWED_HOSTS = ['1.2.3.4', 'www.myhost.com', '*' , ]
> >>
> >> Nothing seems to be working.
> >>
> >> I even inserted by own dummy LoginRequierdMiddleware class it does get
> >> called but I don't see anything wrong with request coming in.
> >>
> >> class LoginRequiredMiddleware:
> >>   def process_request(self, request):
> >> print request
> >>
> >> I am running nginx and apache2 in production environment. I am really
> >> stuck , desperately need help!Any clues on how to debug this?
> >>
> >> -Subodh
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups
> >> "Django users" group.
> >> To unsubscribe from this group and stop receiving emails from it, send
> an
> >> email to django-users+unsubscr...@googlegroups.com.
> >> To post to this group, send email to django-users@googlegroups.com.
> >> Visit this group at http://groups.google.com/group/django-users.
> >> To view this discussion on the web visit
> >>
> https://groups.google.com/d/msgid/django-users/CALr9Q3Y_CvwWo1cPEcmROok13VQOneKnis2m9rwGQULbqo%3DpaQ%40mail.gmail.com
> .
> >> For more options, visit https://groups.google.com/d/optout.
> >
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to django-users+unsubscr...@googlegroups.com.
> > To post to this group, send email to django-users@googlegroups.com.
> > Visit this group at http://groups.google.com/group/django-users.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/django-users/CAHKQagG%2BoyHxp%3DkOFZLZZBfrVLDcBYpWBPtFRAwKediRdwWkjg%40mail.gmail.com
> .
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CALr9Q3aM4KgYZa4Jwe3egoyCzvK3UFTngmY7ckCb4sPPPtrMPw%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHKQagGBpVcETUMDhci1n09qpTg3v6Q_dBtUMGM_Ff%2Bur7%2BobQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Desperatly seeking help with ALLOWED_HOSTS

2014-08-17 Thread Subodh Nijsure
Unfortunately I don't see traceback neither in my nginx log or my
apache log that is what is making it very confusing and difficult to
debug...

-Subodh

On Sun, Aug 17, 2014 at 11:37 AM, Cal Leeming [iops.io]  wrote:
> Can you please send us the traceback of the error generated? (assuming there
> is one)
>
> Cal
>
>
> On Sun, Aug 17, 2014 at 7:25 PM, Subodh Nijsure 
> wrote:
>>
>> I am totally stumped why I can't get my site to work when DEBUG=False.
>>
>> I have entered my domain name and IP address in the ALLOWED_HOSTS
>>
>> I even tried putting '*' in my ALLOWED_HOST but when DEBUG=False I
>> always get my 400.html page served to me. As soon as DEBUG=True
>> everything works great.
>>
>> I have search through google tried all the checks people say to try (
>> I think) , all my urls end in '/'. none of my local.py or base.py have
>> DEBUG setting or ALLOWED_HOSTS
>>
>> ALLOWED_HOSTS = ['1.2.3.4', 'www.myhost.com', '*' , ]
>>
>> Nothing seems to be working.
>>
>> I even inserted by own dummy LoginRequierdMiddleware class it does get
>> called but I don't see anything wrong with request coming in.
>>
>> class LoginRequiredMiddleware:
>>   def process_request(self, request):
>> print request
>>
>> I am running nginx and apache2 in production environment. I am really
>> stuck , desperately need help!Any clues on how to debug this?
>>
>> -Subodh
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CALr9Q3Y_CvwWo1cPEcmROok13VQOneKnis2m9rwGQULbqo%3DpaQ%40mail.gmail.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHKQagG%2BoyHxp%3DkOFZLZZBfrVLDcBYpWBPtFRAwKediRdwWkjg%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALr9Q3aM4KgYZa4Jwe3egoyCzvK3UFTngmY7ckCb4sPPPtrMPw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: using historic changes from django-admin to templates?

2014-08-17 Thread Cal Leeming [iops.io]
Several projects have attempted this, though personally I don't feel any of
them are the right solution;
https://www.djangopackages.com/grids/g/model-audit/

Django reversion is probably your best bet, and although I don't agree with
the approach, it gets the job done;
https://github.com/etianen/django-reversion

Cal


On Sun, Aug 17, 2014 at 4:47 PM,  wrote:

> Hi,
>
> I just ask if it's possible (and how) to use the "historic changes" of
> django-admin interface to templates for showing what changes I've made in
> my models in my site.
>
> Can anyone follow the Poll examples of the tutorial.
>
> Thanks in advance,
> Xan
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/4fa8cf97-bd5e-4029-9fc6-ea2ec833acec%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHKQagFpPOr%2B18fVTh-q%3D_RKHOruKbfcfdZHdGCkEfa6S7iwiw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Desperatly seeking help with ALLOWED_HOSTS

2014-08-17 Thread Cal Leeming [iops.io]
Can you please send us the traceback of the error generated? (assuming
there is one)

Cal


On Sun, Aug 17, 2014 at 7:25 PM, Subodh Nijsure 
wrote:

> I am totally stumped why I can't get my site to work when DEBUG=False.
>
> I have entered my domain name and IP address in the ALLOWED_HOSTS
>
> I even tried putting '*' in my ALLOWED_HOST but when DEBUG=False I
> always get my 400.html page served to me. As soon as DEBUG=True
> everything works great.
>
> I have search through google tried all the checks people say to try (
> I think) , all my urls end in '/'. none of my local.py or base.py have
> DEBUG setting or ALLOWED_HOSTS
>
> ALLOWED_HOSTS = ['1.2.3.4', 'www.myhost.com', '*' , ]
>
> Nothing seems to be working.
>
> I even inserted by own dummy LoginRequierdMiddleware class it does get
> called but I don't see anything wrong with request coming in.
>
> class LoginRequiredMiddleware:
>   def process_request(self, request):
> print request
>
> I am running nginx and apache2 in production environment. I am really
> stuck , desperately need help!Any clues on how to debug this?
>
> -Subodh
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CALr9Q3Y_CvwWo1cPEcmROok13VQOneKnis2m9rwGQULbqo%3DpaQ%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHKQagG%2BoyHxp%3DkOFZLZZBfrVLDcBYpWBPtFRAwKediRdwWkjg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Desperatly seeking help with ALLOWED_HOSTS

2014-08-17 Thread Subodh Nijsure
I am totally stumped why I can't get my site to work when DEBUG=False.

I have entered my domain name and IP address in the ALLOWED_HOSTS

I even tried putting '*' in my ALLOWED_HOST but when DEBUG=False I
always get my 400.html page served to me. As soon as DEBUG=True
everything works great.

I have search through google tried all the checks people say to try (
I think) , all my urls end in '/'. none of my local.py or base.py have
DEBUG setting or ALLOWED_HOSTS

ALLOWED_HOSTS = ['1.2.3.4', 'www.myhost.com', '*' , ]

Nothing seems to be working.

I even inserted by own dummy LoginRequierdMiddleware class it does get
called but I don't see anything wrong with request coming in.

class LoginRequiredMiddleware:
  def process_request(self, request):
print request

I am running nginx and apache2 in production environment. I am really
stuck , desperately need help!Any clues on how to debug this?

-Subodh

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALr9Q3Y_CvwWo1cPEcmROok13VQOneKnis2m9rwGQULbqo%3DpaQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Efficient way to perform many queries

2014-08-17 Thread 9devmail
Thank you, it works perfectly :)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/91e4565b-0e58-4060-9a56-d973e8d55ef6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


using historic changes from django-admin to templates?

2014-08-17 Thread somenxavier
Hi,

I just ask if it's possible (and how) to use the "historic changes" of 
django-admin interface to templates for showing what changes I've made in 
my models in my site. 

Can anyone follow the Poll examples of the tutorial.

Thanks in advance,
Xan

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4fa8cf97-bd5e-4029-9fc6-ea2ec833acec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Push like notifications app

2014-08-17 Thread Cal Leeming [iops.io]
That was strange, my email decided to send as I was typing the rest of my
reply :X See in-line again.


On Sun, Aug 17, 2014 at 3:53 PM, Cal Leeming [iops.io]  wrote:

>
>
> Cal
>
>
> On Sun, Aug 17, 2014 at 1:07 PM, Guy Bowden  wrote:
>
>> Hi,
>>
>> I'm looking for an app that will allow me to 'push'
>> notifications/messages to a user / users / groups via the admin system.
>>
>
>

These might be useful;

https://github.com/django-notifications/django-notifications
https://github.com/justquick/django-activity-stream

It's also worth mentioning that I found that by searching for "django
notifications" in Google, did you already check these out?


>
>> examples:
>> show all users a notice about a new feature
>> show users a notice about planned maintenance
>> and other such useful things!
>>
>> it would be able to have a 'dismiss'/'delete' notification feature. Plus
>> read/unread and so on.
>>
>> Admin would enter the admin site, add in a new notice, select who should
>> see it, perhaps with optional publish / unpublish dates and a level
>> (info/warning/danger etc)
>>
>> On the front end a templatetag would be used to fetch all notices to
>> display, and then display them, marking them as read when they're
>> displayed. There would be a simple way to dismiss a message and never see
>> it again.
>>
>> Anything like that exist? Seems fairly simple to create (don't they all!)
>> if not.
>>
>
> Really depends on your use case.
>
> If you're talking about less than 100k notifications in the life time of
> the application, and a throughput of under 10 reqs/sec, then you might get
> away with storing in your relational DB.
>
> However if you're looking for a high throughput messaging system, multiple
> delivery channels, or large amounts of notifications, then you'd probably
> want to look into using something like Redis (or RabbitMQ), or perhaps
> *insert NoSQL technology here*.
>
>
>>
>> Cheers
>> Guy
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/29b03086-4b57-49bd-acda-36c78ddd19f5%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHKQagHT4Nb8T2QFa%3DDB2J-qfxdgp-sPb3s%3D%2Bqyn2afNpofeWQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Push like notifications app

2014-08-17 Thread Cal Leeming [iops.io]
Cal


On Sun, Aug 17, 2014 at 1:07 PM, Guy Bowden  wrote:

> Hi,
>
> I'm looking for an app that will allow me to 'push' notifications/messages
> to a user / users / groups via the admin system.
>


>
> examples:
> show all users a notice about a new feature
> show users a notice about planned maintenance
> and other such useful things!
>
> it would be able to have a 'dismiss'/'delete' notification feature. Plus
> read/unread and so on.
>
> Admin would enter the admin site, add in a new notice, select who should
> see it, perhaps with optional publish / unpublish dates and a level
> (info/warning/danger etc)
>
> On the front end a templatetag would be used to fetch all notices to
> display, and then display them, marking them as read when they're
> displayed. There would be a simple way to dismiss a message and never see
> it again.
>
> Anything like that exist? Seems fairly simple to create (don't they all!)
> if not.
>

Really depends on your use case.

If you're talking about less than 100k notifications in the life time of
the application, and a throughput of under 10 reqs/sec, then you might get
away with storing in your relational DB.

However if you're looking for a high throughput messaging system, multiple
delivery channels, or large amounts of notifications, then you'd probably
want to look into using something like Redis (or RabbitMQ), or perhaps
*insert NoSQL technology here*.


>
> Cheers
> Guy
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/29b03086-4b57-49bd-acda-36c78ddd19f5%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHKQagG%2BcJjTp5nfedRPPe5dBAezrB6hCg8AMBis%2Bi3WqsjejA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Push like notifications app

2014-08-17 Thread Guy Bowden
Hi,

I'm looking for an app that will allow me to 'push' notifications/messages 
to a user / users / groups via the admin system.

examples:
show all users a notice about a new feature
show users a notice about planned maintenance
and other such useful things!

it would be able to have a 'dismiss'/'delete' notification feature. Plus 
read/unread and so on.

Admin would enter the admin site, add in a new notice, select who should 
see it, perhaps with optional publish / unpublish dates and a level 
(info/warning/danger etc)

On the front end a templatetag would be used to fetch all notices to 
display, and then display them, marking them as read when they're 
displayed. There would be a simple way to dismiss a message and never see 
it again.

Anything like that exist? Seems fairly simple to create (don't they all!) 
if not.

Cheers
Guy 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/29b03086-4b57-49bd-acda-36c78ddd19f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Sequence of code validation

2014-08-17 Thread Malik Rumi
Thanks. Your answer led me straight to
https://docs.python.org/2/tutorial/modules.html#packages and I am working
my way through that now, but it looks promising. If I have more issues,
I'll be back...


On Sun, Aug 17, 2014 at 8:44 AM, Russell Keith-Magee <
russ...@keith-magee.com> wrote:

> Hi Malik,
>
> Ah - in that case, you're not looking at anything special that Django is
> doing; you're just seeing the result of importing Python code.
>
> Running something like ./manage.py runserver sets of a sequence of complex
> code internally - effectively, all the code in your project (or, at least,
> all your models.py, views.py and urls.py files) will be imported. If there
> are any problems in any of them, the first error encountered by the
> interpreter will be surfaced.
>
> The fact that you're seeing a NameError means that *something* in your
> code is generating it. Unfortunately, for a variety of reasons, the actual
> source of the error can be hard to track down from the stack trace Django
> provides. The best was I know of to debug the problem is to open up a shell
> and try importing modules until  you find the one that fails to import.
>
> Yours,
> Russ Magee %-)
>
> On Sun, Aug 17, 2014 at 9:28 PM, Malik Rumi 
> wrote:
>
>> Thanks for both the reply and it's speed. Yes, this looks to be part of
>> what I am looking for. I say part because the link you gave does not
>> specifically reference checking views and urls.py, but whatever check is
>> being run for me is clearly looking there, too. I am using 1.7c1, and the
>> reason I asked specifically about the sequence of these checks is because I
>> am trying to track down a NameError that is showing up in urls.py even
>> though my import from views.py is *.
>>
>>
>> On Sun, Aug 17, 2014 at 8:15 AM, Russell Keith-Magee <
>> russ...@keith-magee.com> wrote:
>>
>>> HI Malik,
>>>
>>> It sounds like you might be referring to the validation/system check
>>> framework.
>>>
>>> In Django 1.6, this is implemented using a single huge method that looks
>>> for specific problems in your model definitions. This functionality isn't
>>> well documented, and isn't extensible as an end user. If you want to run
>>> the validation manually, you can invoke `python manage.py validate` - that
>>> will *just* run the validation. Commands like syncdb and runserver hook
>>> into the same functionality and force a validation check before they do
>>> what they're supposed to do.
>>>
>>> In Django 1.7 (soon to be released), the validation tools have been
>>> replaced but the system checks framework. This capability *is* documented,
>>> and *is* user extensible.
>>>
>>> https://docs.djangoproject.com/en/1.7/ref/checks/
>>>
>>> You invoke the system check framework by calling `python manage.py
>>> check` (calls to validate will redirect to check).
>>>
>>> I hope that helps.
>>>
>>> Yours,
>>> Russ Magee %-)
>>>
>>>
>>> On Sun, Aug 17, 2014 at 8:08 PM, Malik Rumi 
>>> wrote:
>>>
 When you run python mange.py *, Django runs through your code and stops
 to point out errors instead of giving you runserver or shell or whatever
 you were trying to do. What is that sequence? Is it the same every time?
 Where can I find out more about it? I looked in the docs, but I couldn't
 find it. I assume that's because I don't know the right keywords. Thx.

 --
 You received this message because you are subscribed to the Google
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to django-users+unsubscr...@googlegroups.com.

 To post to this group, send email to django-users@googlegroups.com.
 Visit this group at http://groups.google.com/group/django-users.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/f9cb25aa-784e-4512-9172-19df8b67b3ed%40googlegroups.com
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>>
>>>  --
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "Django users" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/django-users/MpGtEwlt8rc/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> django-users+unsubscr...@googlegroups.com.
>>>
>>> To post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAJxq84_sM6am%3DnU2WU6ShPY%2BwBi%2BkeLKrAHCuUCTJV%3DA5gsVMA%40mail.gmail.com
>>> 

Re: Sequence of code validation

2014-08-17 Thread Russell Keith-Magee
Hi Malik,

Ah - in that case, you're not looking at anything special that Django is
doing; you're just seeing the result of importing Python code.

Running something like ./manage.py runserver sets of a sequence of complex
code internally - effectively, all the code in your project (or, at least,
all your models.py, views.py and urls.py files) will be imported. If there
are any problems in any of them, the first error encountered by the
interpreter will be surfaced.

The fact that you're seeing a NameError means that *something* in your code
is generating it. Unfortunately, for a variety of reasons, the actual
source of the error can be hard to track down from the stack trace Django
provides. The best was I know of to debug the problem is to open up a shell
and try importing modules until  you find the one that fails to import.

Yours,
Russ Magee %-)

On Sun, Aug 17, 2014 at 9:28 PM, Malik Rumi  wrote:

> Thanks for both the reply and it's speed. Yes, this looks to be part of
> what I am looking for. I say part because the link you gave does not
> specifically reference checking views and urls.py, but whatever check is
> being run for me is clearly looking there, too. I am using 1.7c1, and the
> reason I asked specifically about the sequence of these checks is because I
> am trying to track down a NameError that is showing up in urls.py even
> though my import from views.py is *.
>
>
> On Sun, Aug 17, 2014 at 8:15 AM, Russell Keith-Magee <
> russ...@keith-magee.com> wrote:
>
>> HI Malik,
>>
>> It sounds like you might be referring to the validation/system check
>> framework.
>>
>> In Django 1.6, this is implemented using a single huge method that looks
>> for specific problems in your model definitions. This functionality isn't
>> well documented, and isn't extensible as an end user. If you want to run
>> the validation manually, you can invoke `python manage.py validate` - that
>> will *just* run the validation. Commands like syncdb and runserver hook
>> into the same functionality and force a validation check before they do
>> what they're supposed to do.
>>
>> In Django 1.7 (soon to be released), the validation tools have been
>> replaced but the system checks framework. This capability *is* documented,
>> and *is* user extensible.
>>
>> https://docs.djangoproject.com/en/1.7/ref/checks/
>>
>> You invoke the system check framework by calling `python manage.py check`
>> (calls to validate will redirect to check).
>>
>> I hope that helps.
>>
>> Yours,
>> Russ Magee %-)
>>
>>
>> On Sun, Aug 17, 2014 at 8:08 PM, Malik Rumi 
>> wrote:
>>
>>> When you run python mange.py *, Django runs through your code and stops
>>> to point out errors instead of giving you runserver or shell or whatever
>>> you were trying to do. What is that sequence? Is it the same every time?
>>> Where can I find out more about it? I looked in the docs, but I couldn't
>>> find it. I assume that's because I don't know the right keywords. Thx.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>>
>>> To post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/f9cb25aa-784e-4512-9172-19df8b67b3ed%40googlegroups.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/django-users/MpGtEwlt8rc/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> django-users+unsubscr...@googlegroups.com.
>>
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAJxq84_sM6am%3DnU2WU6ShPY%2BwBi%2BkeLKrAHCuUCTJV%3DA5gsVMA%40mail.gmail.com
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this 

Re: Sequence of code validation

2014-08-17 Thread Malik Rumi
Thanks for both the reply and it's speed. Yes, this looks to be part of
what I am looking for. I say part because the link you gave does not
specifically reference checking views and urls.py, but whatever check is
being run for me is clearly looking there, too. I am using 1.7c1, and the
reason I asked specifically about the sequence of these checks is because I
am trying to track down a NameError that is showing up in urls.py even
though my import from views.py is *.


On Sun, Aug 17, 2014 at 8:15 AM, Russell Keith-Magee <
russ...@keith-magee.com> wrote:

> HI Malik,
>
> It sounds like you might be referring to the validation/system check
> framework.
>
> In Django 1.6, this is implemented using a single huge method that looks
> for specific problems in your model definitions. This functionality isn't
> well documented, and isn't extensible as an end user. If you want to run
> the validation manually, you can invoke `python manage.py validate` - that
> will *just* run the validation. Commands like syncdb and runserver hook
> into the same functionality and force a validation check before they do
> what they're supposed to do.
>
> In Django 1.7 (soon to be released), the validation tools have been
> replaced but the system checks framework. This capability *is* documented,
> and *is* user extensible.
>
> https://docs.djangoproject.com/en/1.7/ref/checks/
>
> You invoke the system check framework by calling `python manage.py check`
> (calls to validate will redirect to check).
>
> I hope that helps.
>
> Yours,
> Russ Magee %-)
>
>
> On Sun, Aug 17, 2014 at 8:08 PM, Malik Rumi 
> wrote:
>
>> When you run python mange.py *, Django runs through your code and stops
>> to point out errors instead of giving you runserver or shell or whatever
>> you were trying to do. What is that sequence? Is it the same every time?
>> Where can I find out more about it? I looked in the docs, but I couldn't
>> find it. I assume that's because I don't know the right keywords. Thx.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>>
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/f9cb25aa-784e-4512-9172-19df8b67b3ed%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/MpGtEwlt8rc/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJxq84_sM6am%3DnU2WU6ShPY%2BwBi%2BkeLKrAHCuUCTJV%3DA5gsVMA%40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKd6oBwnSn6vPC8UZCTBLtPwxBg5quFZACkoY6X0kbzZPZ4N-g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Sequence of code validation

2014-08-17 Thread Russell Keith-Magee
HI Malik,

It sounds like you might be referring to the validation/system check
framework.

In Django 1.6, this is implemented using a single huge method that looks
for specific problems in your model definitions. This functionality isn't
well documented, and isn't extensible as an end user. If you want to run
the validation manually, you can invoke `python manage.py validate` - that
will *just* run the validation. Commands like syncdb and runserver hook
into the same functionality and force a validation check before they do
what they're supposed to do.

In Django 1.7 (soon to be released), the validation tools have been
replaced but the system checks framework. This capability *is* documented,
and *is* user extensible.

https://docs.djangoproject.com/en/1.7/ref/checks/

You invoke the system check framework by calling `python manage.py check`
(calls to validate will redirect to check).

I hope that helps.

Yours,
Russ Magee %-)


On Sun, Aug 17, 2014 at 8:08 PM, Malik Rumi  wrote:

> When you run python mange.py *, Django runs through your code and stops to
> point out errors instead of giving you runserver or shell or whatever you
> were trying to do. What is that sequence? Is it the same every time? Where
> can I find out more about it? I looked in the docs, but I couldn't find it.
> I assume that's because I don't know the right keywords. Thx.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f9cb25aa-784e-4512-9172-19df8b67b3ed%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJxq84_sM6am%3DnU2WU6ShPY%2BwBi%2BkeLKrAHCuUCTJV%3DA5gsVMA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Sequence of code validation

2014-08-17 Thread Malik Rumi
When you run python mange.py *, Django runs through your code and stops to 
point out errors instead of giving you runserver or shell or whatever you 
were trying to do. What is that sequence? Is it the same every time? Where 
can I find out more about it? I looked in the docs, but I couldn't find it. 
I assume that's because I don't know the right keywords. Thx. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f9cb25aa-784e-4512-9172-19df8b67b3ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Should I use generic foreign key, and how?

2014-08-17 Thread Vladimir Chukharev


On Saturday, August 16, 2014 10:46:33 PM UTC+3, Aaron Law wrote:
>
>
> Hi all,
>
> I have php web programming background, and new to Django. I am helping my 
> brother to build an online system to manage inventory, and I've got a 
> database design & coding problem recently. Needing help!
>
> That is, I have a set of tables of "possible products", "inventory", 
> "suppiler", etc. I want to attach a "comment" to each of them. Therefore, I 
> think I should make a generic "comment" table to hold all the comments of 
> products, inventory, suppiler.
>
> --
> possible_products
> id: int (pk)
> name: varchar
> url: varchar
> price: decimal
> created_at: datetime
> updated_at: datetime
> --
> comments
> id: int (pk)
> parent_id: int (fk)
> content: text
> author: int (fk)
> table: char (which the table this comment belongs to)
> created_at: datetime
> updated_at: datatime
> --
>
> My problem is, when "possible_products" table is the parent of "comment", 
> then a foreign key of the parent (id number) is stored in the "comment" 
> table in order to link up them. 
>

> However, how about the fk of the "inventory" table and the "suppiler" 
> table? It should not be that: I create 2 more columns of "inventory_id" nor 
> "suppiler_id" in "comments" table. (That is, I should not create the 4th 
> column when I want to link up the 4th parent table.)
>

You can make the fk to the "possible_products" table. In your particular 
case, I do not see reasons to take comments into a separate table rather 
than in the parent table, though this might be just omitted in the 
description. I do use this style of inheriting tables with connections 
between them. If you are interested, I have one project in this style in 
googlecode (early stage yet): labman2 .

Note that django docs generally discourage using the involved type on table 
inheritance. I attribute this discourage to wide use of mysql...


> So, Should I use generic forgien key of Django? (so that, my "comment" 
> table design is right.) And how to use/implement it?
>
> P.S I mainly develop the system in the Admin section of Django.
>
> Regards,
> Aaron Law Ho hon
> --~--~-~--~~~---~--~~
> Free as in Freedom ;-)
> --~--~-~--~~~---~--~~
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/93d80efa-8ef3-426f-a492-f19222c6a4cc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Multilingual search with Haystack

2014-08-17 Thread Simon Bächler
Hi

I need to set up a search server for our production servers. Each 
production server has multiple Django instances and every instance has 
multiple languages.
As a search backend I'm leaning towards Elasticsearch because it is easier 
to add new sites to the index. 

Unfortunately Haystack associates a text field with a text_en backend field 
by default. The solution they suggest for multi language sites doesn't 
really work if you are using multilingual models such as those created by 
'django-modeltranslation'. 

There is a great blog post 
 
about how to create a multilingual router for Solr to get and post data to 
the search server.
It could be easily modified for Elasticsearch. 
But I haven't found a solution for multilingual index creation.

Regards
Simon

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f578a4f6-f96a-4223-be0c-20ef779c22f2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Should I use generic foreign key, and how?

2014-08-17 Thread Amirouche Boubekki
2014-08-16 21:45 GMT+02:00 Aaron Law :

>
> Hi all,
>
> I have php web programming background, and new to Django. I am helping my
> brother to build an online system to manage inventory, and I've got a
> database design & coding problem recently. Needing help!
>
> That is, I have a set of tables of "possible products", "inventory",
> "suppiler", etc. I want to attach a "comment" to each of them. Therefore, I
> think I should make a generic "comment" table to hold all the comments of
> products, inventory, suppiler.
>
> --
> possible_products
> id: int (pk)
> name: varchar
> url: varchar
> price: decimal
> created_at: datetime
> updated_at: datetime
> --
> comments
> id: int (pk)
> parent_id: int (fk)
> content: text
> author: int (fk)
> table: char (which the table this comment belongs to)
> created_at: datetime
> updated_at: datatime
> --
>
> My problem is, when "possible_products" table is the parent of "comment",
> then a foreign key of the parent (id number) is stored in the "comment"
> table in order to link up them.
>
> However, how about the fk of the "inventory" table and the "suppiler"
> table? It should not be that: I create 2 more columns of "inventory_id" nor
> "suppiler_id" in "comments" table. (That is, I should not create the 4th
> column when I want to link up the 4th parent table.)
>
> So, Should I use generic forgien key of Django? (so that, my "comment"
> table design is right.) And how to use/implement it?
>

You SHOULD rather create an abstract ProductBase model class with a
ManyToMany Field pointing to Comment class and then inherit ProductBase for
each specific products.

Most of the time class names are singular.


> P.S I mainly develop the system in the Admin section of Django.
>

See also: django polymorphic.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAL7_Mo-E1-ZNBk9%2Bh6ggKfs335Z6ai2r7xuUrRr8wYr9YB9b3g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: I can't load fixtures

2014-08-17 Thread Davide Scatto
when you run a test the django fixture discoverer search in all fixture 
subfolder in apps registered in settings.INSTALLED_APPS.
you don't need __init__.py file nor FIXTURE_DIRS (fixture folder is a 
subfolder of app folder, isn't it?).

did you add fixture param in yr test class?

what version of django are you using?

Davide

Il giorno giovedì 14 agosto 2014 19:05:30 UTC+2, Daniel Grace ha scritto:
>
> I created a fixtures file called testdata.xml in a fixtures folder, but I 
> can't load the fixtures file into the database.
>
> I placed an __init__.py file in the fixtures folder (not sure about this 
> step, is it needed?)
>
> I put the fixtures directory in settings.py:
> FIXTURE_DIRS = (
>'/myapp/fixtures/',
> )
>
> I tried two ways to load the fixture, but neither worked:
> >python manage.py syncdb
> Creating tables ...
> Installing custom SQL ...
> Installing indexes ...
> Installed 0 object(s) from 0 fixture(s)
> >python manage.py loaddata "myapp/fixtures/testdata.xml"
> C:\myenv\lib\site-packages\django\core\management\commands\loaddata.py:216: 
> User
> Warning: No fixture named 'myapp/fixtures/testdata' found.
>   warnings.warn("No fixture named '%s' found." % fixture_name)
> Installed 0 object(s) from 0 fixture(s)
>
> Any ideas?
> Thanks
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/58cab9f2-8c75-47c8-bcd6-0d257c683154%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Should I use generic foreign key, and how?

2014-08-17 Thread Davide Scatto
another way is not to use fk but generic field, where patent_id is a normal 
integer field. In a custom manager you have to manage the data content in 
this field with data content in table field to retrieve yr linked record.

Il giorno sabato 16 agosto 2014 21:46:33 UTC+2, Aaron Law ha scritto:
>
>
> Hi all,
>
> I have php web programming background, and new to Django. I am helping my 
> brother to build an online system to manage inventory, and I've got a 
> database design & coding problem recently. Needing help!
>
> That is, I have a set of tables of "possible products", "inventory", 
> "suppiler", etc. I want to attach a "comment" to each of them. Therefore, I 
> think I should make a generic "comment" table to hold all the comments of 
> products, inventory, suppiler.
>
> --
> possible_products
> id: int (pk)
> name: varchar
> url: varchar
> price: decimal
> created_at: datetime
> updated_at: datetime
> --
> comments
> id: int (pk)
> parent_id: int (fk)
> content: text
> author: int (fk)
> table: char (which the table this comment belongs to)
> created_at: datetime
> updated_at: datatime
> --
>
> My problem is, when "possible_products" table is the parent of "comment", 
> then a foreign key of the parent (id number) is stored in the "comment" 
> table in order to link up them.
>
> However, how about the fk of the "inventory" table and the "suppiler" 
> table? It should not be that: I create 2 more columns of "inventory_id" nor 
> "suppiler_id" in "comments" table. (That is, I should not create the 4th 
> column when I want to link up the 4th parent table.)
>
> So, Should I use generic forgien key of Django? (so that, my "comment" 
> table design is right.) And how to use/implement it?
>
> P.S I mainly develop the system in the Admin section of Django.
>
> Regards,
> Aaron Law Ho hon
> --~--~-~--~~~---~--~~
> Free as in Freedom ;-)
> --~--~-~--~~~---~--~~
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6c2ac6dc-44c0-4681-960b-29983f609469%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.