9 |
9 |
10 |
10 |
11 |
11 |
12 def home(request): |
12 def home(request): |
13 |
13 |
|
14 # if the request has a "search" get parameter, we search this term |
|
15 search = None |
|
16 nb_results = 1 |
|
17 if "search" in request.GET: |
|
18 search = request.GET["search"] |
|
19 field = "all" |
|
20 if "field" in request.GET: |
|
21 field = request.GET["field"] |
|
22 |
|
23 |
14 im1 = {"image": ImageFile(open(settings.RMN_PICT_ROOT+"0/00-004125.jpg", 'r'),FileSystemStorage(location=settings.RMN_PICT_ROOT)), "title":"title im 1", "author":"juju"} |
24 im1 = {"image": ImageFile(open(settings.RMN_PICT_ROOT+"0/00-004125.jpg", 'r'),FileSystemStorage(location=settings.RMN_PICT_ROOT)), "title":"title im 1", "author":"juju"} |
15 im2 = {"image": ImageFile(open(settings.RMN_PICT_ROOT+"0/00-004543.jpg", 'r'),FileSystemStorage(location=settings.RMN_PICT_ROOT)), "title":"title im 2", "author":"loulou"} |
25 im2 = {"image": ImageFile(open(settings.RMN_PICT_ROOT+"0/00-004543.jpg", 'r'),FileSystemStorage(location=settings.RMN_PICT_ROOT)), "title":"<span class=\"highlight\">title</span> im 2", "author":"loulou"} |
16 im3 = {"image": ImageFile(open(settings.RMN_PICT_ROOT+"0/01-017513.jpg", 'r'),FileSystemStorage(location=settings.RMN_PICT_ROOT)), "title":"title im 3", "author":"juju"} |
26 im3 = {"image": ImageFile(open(settings.RMN_PICT_ROOT+"0/01-017513.jpg", 'r'),FileSystemStorage(location=settings.RMN_PICT_ROOT)), "title":"title im 3", "author":"juju"} |
17 im4 = {"image": ImageFile(open(settings.RMN_PICT_ROOT+"0/02-009258.jpg", 'r'),FileSystemStorage(location=settings.RMN_PICT_ROOT)), "title":"title im 4", "author":"loulou"} |
27 im4 = {"image": ImageFile(open(settings.RMN_PICT_ROOT+"0/02-009258.jpg", 'r'),FileSystemStorage(location=settings.RMN_PICT_ROOT)), "title":"title im 4", "author":"loulou"} |
18 img_list = [im1,im2,im3,im4,im3,im4,im1,im2] |
28 if search: |
|
29 img_list = [im1,im2,im3,im4] |
|
30 else: |
|
31 img_list = [im1,im2,im3,im4,im3,im4,im1,im2] |
19 |
32 |
20 frg1 = {"image": im2, "path":"M 0 .5 L .5 0 L 1 .5 L .5 1 Z", "title":"Fragment X", "author":"juju"} |
33 frg1 = {"image": im2, "path":"M 0 .5 L .5 0 L 1 .5 L .5 1 Z", "title":"<span class=\"highlight\">Fragment</span> X", "author":"juju"} |
21 frg2 = {"image": im3, "path":"M .1 .3 L .5 .1 L .8 .7 Z", "title":"Fragment Y", "author":"loulou"} |
34 frg2 = {"image": im3, "path":"M .1 .3 L .5 .1 L .8 .7 Z", "title":"Fragment Y", "author":"loulou"} |
22 frg3 = {"image": im4, "path":"M 0 .5 L .5 0 L 1 .5 L .5 1 Z", "title":"Fragment Z", "author":"juju"} |
35 frg3 = {"image": im4, "path":"M 0 .5 L .5 0 L 1 .5 L .5 1 Z", "title":"Fragment Z", "author":"juju"} |
23 frg4 = {"image": im1, "path":"M .2 .5 L .7 .2 L .8 .7 Z", "title":"Fragment W", "author":"loulou"} |
36 frg4 = {"image": im1, "path":"M .2 .5 L .7 .2 L .8 .7 Z", "title":"Fragment W", "author":"loulou"} |
24 frg_list = [frg1,frg2,frg3,frg4,frg3,frg4,frg1,frg2] |
37 if search: |
|
38 frg_list = [frg1,frg2,frg3,frg4] |
|
39 else: |
|
40 frg_list = [frg1,frg2,frg3,frg4,frg3,frg4,frg1,frg2] |
25 |
41 |
26 return render_to_response("egonomy_home.html", |
42 return render_to_response("egonomy_home.html", |
27 {'img_list': img_list, 'fragment_list': frg_list}, |
43 {'img_list':img_list, 'fragment_list':frg_list, "search":search, "nb_results":nb_results}, |
28 context_instance=RequestContext(request)) |
44 context_instance=RequestContext(request)) |
29 |
45 |
30 |
46 |
31 def annotate_picture(request): |
47 def annotate_picture(request): |
32 |
48 |