Django Multiple ForeignKey Navigation

2014-12-18 Thread Rodney Lewis
Hey All;

Sorry my question yesterday was poorly assembled.  I'm trying again. 
 Please take a look:

https://stackoverflow.com/questions/27543962/django-multiple-foreignkey-navigation

Thank you so much for any help!

-- 
Rodney Lewis
http://www.youtube.com/pyrodney

-- 
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/9909b7db-6085-4f6e-8724-3e17e62f23f0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Raw access to cache table

2014-12-18 Thread Erik Cederstrand
Hi list,

I'm using Django as a hub to synchronize data between various external systems. 
To do this, I have some long-running Django management commands that are 
started as cron jobs. To ensure that only one job is working on a data set at 
any one time, I have implemented a locking system using the Django cache system.

Due to my less-than-stellar programming talent, a cron job may need to be 
killed once in a while. To avoid leaving orphaned locks in the cache, I want to 
clean up any locks before exiting, and I may not know which cache keys exist at 
the time of exit. Therefore, I want to write a signal handler that searches the 
Django cache for any entries that can be traced to the current process (my 
cache keys can be used for this purpose) and delete those.

AFAICS, the Django cache API can't be used for this. There's cache.clear() but 
I don't want to delete all cache entries. I'm using the database backend, so 
I'm thinking I could access the database table directly and issue any custom 
SQL on that. But it does feel hackish, so maybe one of you have a better 
approach? Maybe I got the whole thing backwards?

Here's my cache setup from settings.py:

CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.db.DatabaseCache',
'LOCATION': 'dispatch_cache',
'TIMEOUT': None,
}
}


Thanks,
Erik

-- 
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/9A6110DB-9D5A-4A3F-9DD3-49CC406C1C18%40cederstrand.dk.
For more options, visit https://groups.google.com/d/optout.


Evaluating variables in a blocktrans block within templates

2014-12-18 Thread Frankline
Hi all,

I recently had a weird problem in my django templates regarding evaluating
variables within a blocktrans, but I finally figured it out. I guess I just
want to know the reason why it worked, an explanation sort of.

THIS DID NOT WORK
{% blocktrans %}Approve all {{ objects.count }} users{% endblocktrans %}

HOWEVER, THIS WORKED
{% blocktrans with objects.count as objects_count%}Approve all {{
objects_count }} users{% endblocktrans %}

Can someone explain to me the reason behind why the last code statement
worked as opposed to the first one?

Thanks.

With Regards,
Frankline

-- 
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/CAEAUGdX5it8Z3kLGKOspGZj%3DY%3DkstNeLHLvySGtogLXEOO58HQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Evaluating variables in a blocktrans block within templates

2014-12-18 Thread Andreas Kuhne
Hi Frankline,

You can only reference variables in the templates directly with the
blocktrans tag. See
https://docs.djangoproject.com/en/1.7/topics/i18n/translation/#blocktrans-template-tag.
So you have to use the "with" statement on blocktrans to access properties
of a class.

Regards,

Andréas

2014-12-18 13:16 GMT+01:00 Frankline :
>
> Hi all,
>
> I recently had a weird problem in my django templates regarding evaluating
> variables within a blocktrans, but I finally figured it out. I guess I just
> want to know the reason why it worked, an explanation sort of.
>
> THIS DID NOT WORK
> {% blocktrans %}Approve all {{ objects.count }} users{% endblocktrans %}
>
> HOWEVER, THIS WORKED
> {% blocktrans with objects.count as objects_count%}Approve all {{
> objects_count }} users{% endblocktrans %}
>
> Can someone explain to me the reason behind why the last code statement
> worked as opposed to the first one?
>
> Thanks.
>
> With Regards,
> Frankline
>
> --
> 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/CAEAUGdX5it8Z3kLGKOspGZj%3DY%3DkstNeLHLvySGtogLXEOO58HQ%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/CALXYUbkfrmAUShH_VSbw8s0ih-8V21zWQ3FfwQCHVcaDum91qg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Evaluating variables in a blocktrans block within templates

2014-12-18 Thread Frankline
Nicely answered.

Thanks Andreas.

On Thu, Dec 18, 2014 at 3:27 PM, Andreas Kuhne 
wrote:
>
> Hi Frankline,
>
> You can only reference variables in the templates directly with the
> blocktrans tag. See
> https://docs.djangoproject.com/en/1.7/topics/i18n/translation/#blocktrans-template-tag.
> So you have to use the "with" statement on blocktrans to access properties
> of a class.
>
> Regards,
>
> Andréas
>
> 2014-12-18 13:16 GMT+01:00 Frankline :
>
>> Hi all,
>>
>> I recently had a weird problem in my django templates regarding
>> evaluating variables within a blocktrans, but I finally figured it out. I
>> guess I just want to know the reason why it worked, an explanation sort of.
>>
>> THIS DID NOT WORK
>> {% blocktrans %}Approve all {{ objects.count }} users{% endblocktrans %}
>>
>> HOWEVER, THIS WORKED
>> {% blocktrans with objects.count as objects_count%}Approve all {{
>> objects_count }} users{% endblocktrans %}
>>
>> Can someone explain to me the reason behind why the last code statement
>> worked as opposed to the first one?
>>
>> Thanks.
>>
>> With Regards,
>> Frankline
>>
>> --
>> 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/CAEAUGdX5it8Z3kLGKOspGZj%3DY%3DkstNeLHLvySGtogLXEOO58HQ%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/CALXYUbkfrmAUShH_VSbw8s0ih-8V21zWQ3FfwQCHVcaDum91qg%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/CAEAUGdVpUOHS%2Br2EuH6BYTawdPvhPuLvcGe7xxc5P-p7rHZe5A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Raw access to cache table

2014-12-18 Thread Vijay Khemlani
I'm not sure that using a cache system as a lock mechanism is a good idea.

What I would do is setup a task queue (using celery and rabbitMQ) with a
single worker, that way you guarantee that only one task is running at a
time and you can queue as many as you want. Also, each task has a maximum
lifespan, after that it kill itself and the workers starts executing the
next task in the queue automatically.

On Thu, Dec 18, 2014 at 8:20 AM, Erik Cederstrand  wrote:
>
> Hi list,
>
> I'm using Django as a hub to synchronize data between various external
> systems. To do this, I have some long-running Django management commands
> that are started as cron jobs. To ensure that only one job is working on a
> data set at any one time, I have implemented a locking system using the
> Django cache system.
>
> Due to my less-than-stellar programming talent, a cron job may need to be
> killed once in a while. To avoid leaving orphaned locks in the cache, I
> want to clean up any locks before exiting, and I may not know which cache
> keys exist at the time of exit. Therefore, I want to write a signal handler
> that searches the Django cache for any entries that can be traced to the
> current process (my cache keys can be used for this purpose) and delete
> those.
>
> AFAICS, the Django cache API can't be used for this. There's cache.clear()
> but I don't want to delete all cache entries. I'm using the database
> backend, so I'm thinking I could access the database table directly and
> issue any custom SQL on that. But it does feel hackish, so maybe one of you
> have a better approach? Maybe I got the whole thing backwards?
>
> Here's my cache setup from settings.py:
>
> CACHES = {
> 'default': {
> 'BACKEND': 'django.core.cache.backends.db.DatabaseCache',
> 'LOCATION': 'dispatch_cache',
> 'TIMEOUT': None,
> }
> }
>
>
> Thanks,
> Erik
>
> --
> 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/9A6110DB-9D5A-4A3F-9DD3-49CC406C1C18%40cederstrand.dk
> .
> 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/CALn3ei0D2ZL7YJb17ibGDnBDJvTXg%2B2Hj%3DwrCZearRZBjzvpNQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Raw access to cache table

2014-12-18 Thread Avraham Serour
I implemented a network lock using redis, the module had some other
functionalities, but the basic lock class was:

class Lock():
"""
Regular behavior lock, works across the network, useful for
distributed processes
"""
def __init__(self, name):
self.redis = StrictRedis(host='dev3', db=2)
self.redis._use_lua_lock = False
self.lock = self.redis.lock(name)

def __enter__(self, blocking=True):
# print('Acquiring lock')
return self.lock.acquire(blocking)

def __exit__(self, exc_type=None, exc_val=None, exc_tb=None):
# print('releasing lock')
self.lock.release()

acquire = __enter__
release = __exit__


On Thu, Dec 18, 2014 at 4:14 PM, Vijay Khemlani  wrote:
>
> I'm not sure that using a cache system as a lock mechanism is a good idea.
>
> What I would do is setup a task queue (using celery and rabbitMQ) with a
> single worker, that way you guarantee that only one task is running at a
> time and you can queue as many as you want. Also, each task has a maximum
> lifespan, after that it kill itself and the workers starts executing the
> next task in the queue automatically.
>
> On Thu, Dec 18, 2014 at 8:20 AM, Erik Cederstrand <
> erik+li...@cederstrand.dk> wrote:
>>
>> Hi list,
>>
>> I'm using Django as a hub to synchronize data between various external
>> systems. To do this, I have some long-running Django management commands
>> that are started as cron jobs. To ensure that only one job is working on a
>> data set at any one time, I have implemented a locking system using the
>> Django cache system.
>>
>> Due to my less-than-stellar programming talent, a cron job may need to be
>> killed once in a while. To avoid leaving orphaned locks in the cache, I
>> want to clean up any locks before exiting, and I may not know which cache
>> keys exist at the time of exit. Therefore, I want to write a signal handler
>> that searches the Django cache for any entries that can be traced to the
>> current process (my cache keys can be used for this purpose) and delete
>> those.
>>
>> AFAICS, the Django cache API can't be used for this. There's
>> cache.clear() but I don't want to delete all cache entries. I'm using the
>> database backend, so I'm thinking I could access the database table
>> directly and issue any custom SQL on that. But it does feel hackish, so
>> maybe one of you have a better approach? Maybe I got the whole thing
>> backwards?
>>
>> Here's my cache setup from settings.py:
>>
>> CACHES = {
>> 'default': {
>> 'BACKEND': 'django.core.cache.backends.db.DatabaseCache',
>> 'LOCATION': 'dispatch_cache',
>> 'TIMEOUT': None,
>> }
>> }
>>
>>
>> Thanks,
>> Erik
>>
>> --
>> 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/9A6110DB-9D5A-4A3F-9DD3-49CC406C1C18%40cederstrand.dk
>> .
>> 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/CALn3ei0D2ZL7YJb17ibGDnBDJvTXg%2B2Hj%3DwrCZearRZBjzvpNQ%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/CAFWa6tKpf6wEcX1bOMcvn3FVo0qXxZyQgx3djWQaMNdcRDCJQw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Raw access to cache table

2014-12-18 Thread Javier Guerra Giraldez
On Thu, Dec 18, 2014 at 6:20 AM, Erik Cederstrand
 wrote:
> I'm using Django as a hub to synchronize data between various external 
> systems. To do this, I have some long-running Django management commands that 
> are started as cron jobs. To ensure that only one job is working on a data 
> set at any one time, I have implemented a locking system using the Django 
> cache system.


there are many ways to skin this cat; one of them is doing it the Unix
way with flock.  In short, it's a command line tool that makes it easy
to do "if i'm already running, exit now" in shell scripts.

check the man page, it lists a few ways to do this kind of things.

http://linux.die.net/man/1/flock

-- 
Javier

-- 
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/CAFkDaoTFuxQ-f564uWBd6S%3DPaO960nxRKNLkspqko5DujjhioQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


change_list html template filter block inject a css class

2014-12-18 Thread Damjan Dimitrioski
Hi,

the following block of code is an excerpt from change_list.html template:

{% block filters %}
> {% if cl.has_filters %}
>   
> {% trans 'Filter' %}
> 
>
>
> {% for spec in cl.filter_specs %}
>   {% if "somefilter" in spec|slugify %} 
> {% admin_list_filter cl spec 
> %} 
>   
>   {% else %}
> {% admin_list_filter cl spec %}
>   {% endif %}
>
> {% endfor %}
>   
> {% endif %}
>   {% endblock %}
>

What I'm looking for is to format some 's based on given conditions.

-- 
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/754b0df2-2fe6-4ac7-8002-52314f808ac2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Raw access to cache table

2014-12-18 Thread François Schiettecatte
Hi

I use fcntl.flock() from the fcntl module. I have used this method in C, Perl 
and Python, works great. Happy to share code.

François




> On Dec 18, 2014, at 9:24 AM, Javier Guerra Giraldez  
> wrote:
> 
> On Thu, Dec 18, 2014 at 6:20 AM, Erik Cederstrand
>  wrote:
>> I'm using Django as a hub to synchronize data between various external 
>> systems. To do this, I have some long-running Django management commands 
>> that are started as cron jobs. To ensure that only one job is working on a 
>> data set at any one time, I have implemented a locking system using the 
>> Django cache system.
> 
> 
> there are many ways to skin this cat; one of them is doing it the Unix
> way with flock.  In short, it's a command line tool that makes it easy
> to do "if i'm already running, exit now" in shell scripts.
> 
> check the man page, it lists a few ways to do this kind of things.
> 
> http://linux.die.net/man/1/flock
> 
> -- 
> Javier
> 
> -- 
> 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/CAFkDaoTFuxQ-f564uWBd6S%3DPaO960nxRKNLkspqko5DujjhioQ%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/C9709909-1AA9-43DB-8E7B-A6676844BC7F%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Optimizing has_perm query time on PERMISSION AND GROUP PERMISSION

2014-12-18 Thread mohd irshad
Hello , 
I am constantly facing face max cpu usage problem because of few database 
(postgres) heavy query has_perm is one of them.

how can I optimized such query.

-- 
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/525f6423-f10b-40f7-8514-d3b5af225d96%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: ANN: Django website redesign launched

2014-12-18 Thread Thomas Leo
The new Design looks great! Awesome job!

One thing I really like about https://docs.python.org/3/ is the ability to 
show/hide the side bar. The new design features a very large sidebar, being 
able to toggle it would be awesome. 

Also as previously mentioned trac doesn't look right yet.

On Tuesday, December 16, 2014 11:09:55 AM UTC-5, Jannis Leidel wrote:
>
> Hi everyone, 
>
> We're incredibly proud to share with you the new design of the Django 
> website, the documentation and the issue tracker. 
>
> This is a long time coming and we couldn't be happier to finally ship it 
> :) 
>
> As you can imagine, there will be bugs, so please bear with us and report 
> issues to the issue tracker at 
> https://github.com/django/djangoproject.com/issues 
>
> More infos about the redesign and its history can be found in the blog 
> post: 
>
>   
> https://www.djangoproject.com/weblog/2014/dec/15/announcing-django-website-redesign/
>  
>
> Happy coding, everyone! 
>
> Jannis 
>
>

-- 
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/c9438430-7908-464f-82ce-b89131e3bbea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


ModelAdmin with inlines: How to learn if/what has changed before the models are saved?

2014-12-18 Thread Carsten Fuchs

Hi fellow Django developers,

using a model with several related models, for the Django Admin I have a 
ModelAdmin that uses several InlineModelAdmin objects, very much as in 
the example at 
.


All works well, but when the user clicks the "Save" button in the change 
view, I would like to find out if anything has changed in the parent 
model or the related (inline) models, and depending on the result, 
update one of the parent model's fields before it is saved.


Can you please tell me how can this be achieved?


In more detail, having read all of 
https://docs.djangoproject.com/en/1.7/ref/contrib/admin/ and thinking 
that I have understood most of it, the ModelAdmin methods


save_model()
save_formset()
save_related()

seem to be the right approach to my problem, but are a complete mystery 
to me: How are the related to each other, and what is their purpose?


The documentation of all three begins with "The save_* method is given 
the HttpRequest, ...", but what follows it too sparse for my still 
limited Django knowledge, and unfortunately I cannot see yet the bigger 
picture about them, or how to proceed from there.


Could someone please explain how these methods work, when they are 
called, etc.?



A huge thanks in advance and best regards,
Carsten

--
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/54930CBE.5010608%40cafu.de.
For more options, visit https://groups.google.com/d/optout.


Re: eCommerce Search

2014-12-18 Thread Patti Chen
You can use haystack(http://haystacksearch.org/) to communicate with
search engines.

On Thu, Dec 18, 2014 at 5:20 AM, Jonathan Baker
 wrote:
> Also, check out: https://github.com/alex/django-filter
>
> On Wed, Dec 17, 2014 at 2:11 PM, John Rodkey  wrote:
>> Yes, that is what I'm looking for.  I'm new to the Django world and was
>> curious if there is already a good existing package.  I will search for
>> django faceted search.
>>
>>
>> On Wednesday, December 17, 2014 2:30:13 PM UTC-6, werefrog wrote:
>>>
>>> Hi John,
>>>
>>> You might want to search for django+faceted+search. Is it what you're
>>> looking for?
>>>
>>> Best regards
>>>
>>>
>>> Le 17/12/2014 16:20, John Rodkey a écrit :
>>> > Hi All, I apologize if this has been answered, but what is the best way
>>> > to
>>> > search/query a model based on filters.
>>> >
>>> > For example, say we are setting up a shoe site. What is the best way to
>>> > allow customers to search for shoes by brand, color, size, and/or price.
>>> > I
>>> > would prefer to make these dropdowns in the templates, I'm just not sure
>>> > how to build this functionality in the view.
>>> >
>>> > I would appreciate any direction.
>>> >
>>>
>> --
>> 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/d2097d0d-7a73-4910-9382-8136d58a05d6%40googlegroups.com.
>>
>> For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> Jonathan D. Baker
> Developer
> http://jonathandbaker.com
>
> --
> 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/CAPMFOb7q0vxgApt6RfXKj2%3DvJWDe2YcRQ77Kh6p4brJz8Kb_pQ%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/CAN1WgRJWHM%2BT2o8UYabvR1H-c%3Dp0rsiLWcJwEm2%2BxVHun7mqDQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Webcomponents in Django

2014-12-18 Thread Peter of the Norse

On 11/19/2014 7:18 AM, Timothy W. Cook wrote:

then the designer-element.html is imported:
href="elements/designer-element/designer-element.html">


Here's your problem.  This is a relative link, so the current directory 
gets used as the base, and it tries to load 
http://127.0.0.1/designer/elements/designer-element/designer-element.html. 
That matches

url(r'^designer/', (DesignerView.as_view()), name='designer')

because there's not a $ at the end of the pattern.

And it loads the page again.  That page also has the same relative link, 
but this time in a different file, so it creates the new link as 
http://127.0.0.1/designer/elements/designer-element/elements/designer-element/designer-element.html 
and the process starts all over again.


This isn't a Django problem but an HTML problem.

--
Peter of the Norse

--
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/54932746.1090705%40radio1190.org.
For more options, visit https://groups.google.com/d/optout.


Database queries location

2014-12-18 Thread pythonista
I understand that functions can be placed in the models fille

However if I have complex queries that receive post input does the 


Query live in the model  the views or an external module

-- 
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/45f5d942-2ede-49bb-8ec1-d5a2486bd656%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Database queries location

2014-12-18 Thread Lachlan Musicman
I usually put those functions in the view
cheers
L.

On 19 December 2014 at 08:12, pythonista  wrote:
> I understand that functions can be placed in the models fille
>
> However if I have complex queries that receive post input does the
>
>
> Query live in the model  the views or an external module
>
> --
> 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/45f5d942-2ede-49bb-8ec1-d5a2486bd656%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
--
"We are at once both obnoxious and indispensable." - John Ngumi on the Kikuyu
in It's Our Turn To Eat, by Michela Wrong.

-- 
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/CAGBeqiNoWsSSgZ4-xyWtH%3DoyxVVwWSYihbAsK2XFXbbPwtAORw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Cache middleware problem

2014-12-18 Thread T Kwn
I have a list view where I can add or delete objects. I found that if the 
cache middleware is included:

'django.middleware.cache.UpdateCacheMiddleware',
'django.middleware.cache.FetchFromCacheMiddleware'

The page doesn't operate properly. Basically deleted objects don't always 
disappear.
Added objects didn't display etc. I verified objects are created or deleted by 
viewing the db file.

Finally I deleted the cache middelware and now the page operates properly. 

So when I finally go into production will I have a problem because there's no 
caching? Or 
if I want to enable caching, how do I prevent this problem again? It appears 
the cache
middleware isn't operating properly but I can't see how it wouldn't have been 
fixed by now...

I'm running python 2.7 and django 1.6.2




-- 
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/c356fe31-8c94-4744-8040-e66c5524ead4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Cache middleware problem

2014-12-18 Thread Andreas Kuhne
Add a never cache decorator to the view that does the deleting (and perhaps
to the view that lists the items). Then you shouldn't have any problems and
you can still use the cache middleware.

See https://docs.djangoproject.com/en/1.6/topics/cache/

Regards,

Andréas

2014-12-19 5:07 GMT+01:00 T Kwn :
>
> I have a list view where I can add or delete objects. I found that if the
> cache middleware is included:
>
> 'django.middleware.cache.UpdateCacheMiddleware',
> 'django.middleware.cache.FetchFromCacheMiddleware'
>
> The page doesn't operate properly. Basically deleted objects don't always 
> disappear.
> Added objects didn't display etc. I verified objects are created or deleted 
> by viewing the db file.
>
> Finally I deleted the cache middelware and now the page operates properly.
>
> So when I finally go into production will I have a problem because there's no 
> caching? Or
> if I want to enable caching, how do I prevent this problem again? It appears 
> the cache
> middleware isn't operating properly but I can't see how it wouldn't have been 
> fixed by now...
>
> I'm running python 2.7 and django 1.6.2
>
>
>
>
>  --
> 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/c356fe31-8c94-4744-8040-e66c5524ead4%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/CALXYUbn8J1u7fEZBKw%3DoJQFUQZYjir7KQ79p53UqqvO-qadyiQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.