how to manage range of hours in models and forms in django1.4

2012-06-28 Thread Nikhil Verma
Hi

I am developing an event app which has users who publish events , other
users also.
Now users have their profile info for which i have made a very common
UserProfile Model with all the necessary details in it.

I have a requirement where in UserProfile model i need to display a field
institue_hours_of_operation( no. of hours that an institute works)


class UserProfile(models.Model):
user = models.ForeignKey(User, blank=True, null=True, unique=True)
first_name = models.CharField(max_length=30, blank=True)
last_name = models.CharField(max_length=30, blank=True)
gender = models.CharField(max_length=1, choices=GENDER_CHOICES,
blank=True)
birth_date = models.DateField(auto_now_add=True)
street_address = models.CharField(max_length=75, blank=True)
city = models.CharField(max_length=30, blank=True)
zip_code = models.IntegerField(max_length=7, blank=True, null=True)
country = models.CharField(max_length=30, blank=True)
mobile = models.CharField(max_length=15, blank=True)
home_phone = models.CharField(max_length=15, blank=True)
primary_email = models.EmailField(max_length=60, blank=True)
secondary_email = models.EmailField(max_length=60, blank=True)
institution_name = models.CharField(max_length=100,blank=True,null=True)
institution_website =
models.CharField(max_length=100,blank=True,null=True)


# Field to be added

It will be displayed in html like this

Insitutue hour of operation :   Monday  9.00 - 17.00 (Monday will be
hardcoded,Time will be filled by user)
  Tuesday 9.00 - 17.00 (Monday
will be hardcoded,Time will be filled by user)

   and so on

# Note the weekdays like monday,  tuesday they are all hardcoded as
requirement but i don't want that to be hardcoded.
Also i am using a django forms  to display this.


How can i design this form field as well in models or What should be the
type of this field both in models and forms such that weekdays remain
dynamic(i can simply generate them from loop) and the user can fill the
time  and when he hits submit it will get saved.


Thanks in advance.



-- 
Regards
Nikhil Verma
+91-958-273-3156

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Avoiding code repetition in views

2012-06-28 Thread Ryan Nowakowski
Or a custom template context processor that adds gigs to every request
context.

On Thu, Jun 28, 2012 at 10:40:30PM -0400, J. Cliff Dyer wrote:
> It looks like what you want to do is create a templatetag.  Then you can
> just include a snippet like: {% gig_schedule %} in your template.  The
> documentation can point you in the right direction.
> 
> On Thu, 2012-06-28 at 15:20 -0700, grimmus wrote:
> > Hi,
> > 
> > 
> > I am doing a site for a DJ that lists upcoming gigs on each page.
> > There's an include file in each page template to output the list of
> > gigs.
> > 
> > 
> > I am wondering how i can pass the gig information to every page
> > without having to repeat the code in every page view.
> > 
> > 
> > I hope i have been clear
> > 
> > 
> > Thanks
> > 
> > -- 
> > You received this message because you are subscribed to the Google
> > Groups "Django users" group.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msg/django-users/-/naTvLr9T_3MJ.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to django-users
> > +unsubscr...@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/django-users?hl=en.
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django 1.4 + grappelli 2.4: missing css, img files.

2012-06-28 Thread bruce
Thank!!
It works! 
I checked the grappelli's admin base file:
/usr/local/lib/python2.6/dist-packages/grappelli/templates/admin/base.html
It shows that the grappelli is using {% admin_media_prefix %}.  
 

The DeprecationWarning message made me confused. 

Thanks!!



On Thursday, June 28, 2012 3:04:25 AM UTC-4, Karl Sutt wrote:
>
> Ali,
>
> Given that your static directory is STATIC_URL = '/static/' and 
> STATIC_ROOT is something like os.path.join(PROJECT_PATH, "static"), add
>
>> ADMIN_MEDIA_PREFIX = '/static/grappelli/' (or whatever your static 
>> directory is) to your settings.py
>
>
> That should do the trick. 
>
> Tervitades/Regards
> Karl Sutt
>
>
> On Thu, Jun 28, 2012 at 5:07 AM, bruce  wrote:
>
>> Dear All,
>>
>> I know this problem is related with grappelli. But it may be a django 
>> configure problem. So I am posting my question here.
>> If it is inappropriate, please let me know. 
>>
>> I followed the django 1.4's tutorial to setup the 'polls' app and it was 
>> successful.
>> I also followed the grappelli 2.4 quick start guide. 
>> http://django-grappelli.**readthedocs.org/en/grappelli_**
>> 2_4/quickstart.html
>>
>> I followed every step and didn't do anything else. 
>> The last command is:
>> python manage.py collectstatic
>> After this command is executed, two new directories were created(admin 
>> and grappelli).
>>
>> The directory is as follows:
>>  root@ubuntu:/home/hduser/**django/mysite# pwd
>> /home/hduser/django/mysite
>> root@ubuntu:/home/hduser/**django/mysite# ls
>> admin  grappelli  manage.py  mysite  mytemplate  polls
>>
>> Finally, 
>> I can access the http://127.0.0.1:8000/**admin
>> But, the css,img files are missing. Please see the attached screen shot 
>> picture. 
>>
>> The python manage.py runserver show:
>> [27/Jun/2012 21:36:19] "GET /admin/css/base.css HTTP/1.1" 404 4468
>> [27/Jun/2012 21:36:19] "GET 
>> /admin/jquery/ui/css/custom-**theme/jquery-ui-1.8.custom.css 
>> HTTP/1.1" 404 4585
>> [27/Jun/2012 21:36:19] "GET /admin/css/jquery-ui-**grappelli-extensions.css 
>> HTTP/1.1" 404 4546
>> [27/Jun/2012 21:36:19] "GET /admin/jquery/jquery-1.6.2.**min.js 
>> HTTP/1.1" 404 4510
>> [27/Jun/2012 21:36:19] "GET 
>> /admin/jquery/ui/js/jquery-ui-**1.8.15.custom.min.js 
>> HTTP/1.1" 404 4561
>> [27/Jun/2012 21:36:19] "GET /admin/js/grappelli/grappelli.**js HTTP/1.1" 
>> 404 4507
>> [27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.**grp_collapsible.js 
>> HTTP/1.1" 404 4546
>> [27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.**grp_timepicker.js 
>> HTTP/1.1" 404 4543
>> [27/Jun/2012 21:36:20] "GET 
>> /admin/js/grappelli/jquery.**grp_collapsible_group.js 
>> HTTP/1.1" 404 4564
>> [27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.**grp_related_fk.js 
>> HTTP/1.1" 404 4543
>> [27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.**grp_related_m2m.js 
>> HTTP/1.1" 404 4546
>> [27/Jun/2012 21:36:20] "GET 
>> /admin/js/grappelli/jquery.**grp_related_generic.js 
>> HTTP/1.1" 404 4558
>> [27/Jun/2012 21:36:20] "GET 
>> /admin/js/grappelli/jquery.**grp_autocomplete_fk.js 
>> HTTP/1.1" 404 4558
>> [27/Jun/2012 21:36:20] "GET 
>> /admin/js/grappelli/jquery.**grp_autocomplete_m2m.js 
>> HTTP/1.1" 404 4561
>> [27/Jun/2012 21:36:20] "GET 
>> /admin/js/grappelli/jquery.**grp_autocomplete_generic.js 
>> HTTP/1.1" 404 4573
>> [27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.**grp_timepicker.js 
>> HTTP/1.1" 404 4543
>> [27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.**grp_related_fk.js 
>> HTTP/1.1" 404 4543
>> [27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.**grp_related_m2m.js 
>> HTTP/1.1" 404 4546
>> [27/Jun/2012 21:36:20] "GET 
>> /admin/js/grappelli/jquery.**grp_related_generic.js 
>> HTTP/1.1" 404 4558
>> [27/Jun/2012 21:36:20] "GET 
>> /admin/js/grappelli/jquery.**grp_autocomplete_fk.js 
>> HTTP/1.1" 404 4558
>> [27/Jun/2012 21:36:20] "GET 
>> /admin/js/grappelli/jquery.**grp_autocomplete_m2m.js 
>> HTTP/1.1" 404 4561
>> [27/Jun/2012 21:36:20] "GET 
>> /admin/js/grappelli/jquery.**grp_autocomplete_generic.js 
>> HTTP/1.1" 404 4573
>>
>>
>>
>> Would you please tell me how to fix it? 
>> Why 404? 
>> I know I am supposed to read some web links. Please tell me. 
>> Thank you!!
>>  
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msg/django-users/-/egmDj5ZbW40J.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 

Re: Avoiding code repetition in views

2012-06-28 Thread J. Cliff Dyer
It looks like what you want to do is create a templatetag.  Then you can
just include a snippet like: {% gig_schedule %} in your template.  The
documentation can point you in the right direction.

On Thu, 2012-06-28 at 15:20 -0700, grimmus wrote:
> Hi,
> 
> 
> I am doing a site for a DJ that lists upcoming gigs on each page.
> There's an include file in each page template to output the list of
> gigs.
> 
> 
> I am wondering how i can pass the gig information to every page
> without having to repeat the code in every page view.
> 
> 
> I hope i have been clear
> 
> 
> Thanks
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/naTvLr9T_3MJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to django-users
> +unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Avoiding code repetition in views

2012-06-28 Thread David Lam
On Jun 28, 2012, at 3:20 PM, grimmus  wrote:

> Hi,
> 
> I am doing a site for a DJ that lists upcoming gigs on each page. There's an 
> include file in each page template to output the list of gigs.
> 
> I am wondering how i can pass the gig information to every page without 
> having to repeat the code in every page view.

Maybe an inclusion tag?

{%  get_list_of_cool_gigs  page %}

e.g.  output the list of gigs for a given argument, the page

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Avoiding code repetition in views

2012-06-28 Thread Christophe Pettus

On Jun 29, 2012, at 12:20 AM, grimmus wrote:

> I am doing a site for a DJ that lists upcoming gigs on each page. There's an 
> include file in each page template to output the list of gigs.
> 
> I am wondering how i can pass the gig information to every page without 
> having to repeat the code in every page view.
> 
> I hope i have been clear

I'm going to take a guess and surmise that you have a lot of different view 
functions, each one of which needs to pass a list of gigs into the context for 
the template and then render that page, and you're trying to avoid repeating 
the code that builds the list of gigs.  Is that correct?

You might look at whether you really need all those separate view functions, or 
if they can be rolled together.  You might also look at using class-based Views 
in 1.4 as a way to factor out the gig-list-building code in a reasonable way.

--
-- Christophe Pettus
   x...@thebuild.com

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: locating the functionality behind the HTML element

2012-06-28 Thread Smaran Harihar
Hey Clifford,

Thanks, this is what I am looking for, where can I locate this
django-debug-toolbar? Do i need to add it like it is stated in the git hub?
or is there a UI which i can use?

Thanks,
Smaran

On Thu, Jun 28, 2012 at 2:38 PM, CLIFFORD ILKAY
wrote:

> On 06/27/2012 08:55 PM, Smaran Harihar wrote:
>
>> Hi Guys,
>>
>> I am new to Django and have completed the initial basic tutorials in the
>> django doc. I am presently working on a pre-customized django application.
>> I was wondering how I can use FireBug to locate the code in a specific
>> element (like button). In the sense, in general the web development once we
>> are able to locate the button we are able to then locate the class of the
>> specific element and JS attached to it and CSS. But in Django this cannot
>> be done since everything is located in separate directories.
>>
>> Since I am entering into the Django code, where should I start looking
>> for the CSS and JS files?
>>
>>
> Hi Smaran,
>
> You can install django-debug-toolbar. That will tell you which templates
> are used to render a given page. You'll also see the whole template
> inheritance hierarchy. Knowing the URL and those two bits of information,
> you'll be able to mentally trace a request as it's handled by urls.py,
> dispatched to a view function, which in turn feeds a template. You can work
> forward from the URL or backward from the template.
>
> --
> Regards,
>
> Clifford Ilkay
> Dinamis
> 1419-3230 Yonge St.
> Toronto, ON
> Canada  M4N 3P6
>
> 
> +1 416-410-3326
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to django-users+unsubscribe@**
> googlegroups.com .
> For more options, visit this group at http://groups.google.com/**
> group/django-users?hl=en
> .
>
>


-- 
Thanks & Regards
Smaran Harihar

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Avoiding code repetition in views

2012-06-28 Thread Aaron C. de Bruyn
On Thu, Jun 28, 2012 at 3:20 PM, grimmus  wrote:
> I am wondering how i can pass the gig information to every page without
> having to repeat the code in every page view.
>
> I hope i have been clear

Not really.  We can't guess what you're doing.  :)
Paste a sample of the code you're referring to so someone can give you pointers.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Avoiding code repetition in views

2012-06-28 Thread grimmus
Hi,

I am doing a site for a DJ that lists upcoming gigs on each page. There's 
an include file in each page template to output the list of gigs.

I am wondering how i can pass the gig information to every page without 
having to repeat the code in every page view.

I hope i have been clear

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/naTvLr9T_3MJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: locating the functionality behind the HTML element

2012-06-28 Thread CLIFFORD ILKAY

On 06/27/2012 08:55 PM, Smaran Harihar wrote:

Hi Guys,

I am new to Django and have completed the initial basic tutorials in 
the django doc. I am presently working on a pre-customized 
django application. I was wondering how I can use FireBug to locate 
the code in a specific element (like button). In the sense, in general 
the web development once we are able to locate the button we are able 
to then locate the class of the specific element and JS attached to it 
and CSS. But in Django this cannot be done since everything is located 
in separate directories.


Since I am entering into the Django code, where should I start looking 
for the CSS and JS files?




Hi Smaran,

You can install django-debug-toolbar. That will tell you which templates 
are used to render a given page. You'll also see the whole template 
inheritance hierarchy. Knowing the URL and those two bits of 
information, you'll be able to mentally trace a request as it's handled 
by urls.py, dispatched to a view function, which in turn feeds a 
template. You can work forward from the URL or backward from the template.


--
Regards,

Clifford Ilkay
Dinamis
1419-3230 Yonge St.
Toronto, ON
Canada  M4N 3P6


+1 416-410-3326

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: locating the functionality behind the HTML element

2012-06-28 Thread Smaran Harihar
Thanks Jon

On Thu, Jun 28, 2012 at 12:41 AM, Jon Black  wrote:

>  If I understand you correctly, you want to find the django code
> responsible for rendering the view. Rather than look at the html, the most
> obvious place is to look at the url. There should be an entry in one of
> your urls.py files, which will tell you which view is being used. You can
> then trace that view to the template.
>
>  --
>  Jon Black
>  www.jonblack.org
>
>
>  On Wed, Jun 27, 2012, at 17:55, Smaran Harihar wrote:
>
> Hi Guys,
>
>  I am new to Django and have completed the initial basic tutorials in the
> django doc. I am presently working on a pre-customized django application.
> I was wondering how I can use FireBug to locate the code in a specific
> element (like button). In the sense, in general the web development once we
> are able to locate the button we are able to then locate the class of the
> specific element and JS attached to it and CSS. But in Django this cannot
> be done since everything is located in separate directories.
>
>  Since I am entering into the Django code, where should I start looking
> for the CSS and JS files?
>
> --
> Thanks & Regards
> Smaran Harihar
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Thanks & Regards
Smaran Harihar

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: WebService WSDL

2012-06-28 Thread Anurag Chourasia
Try using gSOAP if that fits your needs.

http://www.cs.fsu.edu/~engelen/soap.html

Regards,
Guddu

On Thu, Jun 28, 2012 at 2:47 PM, Rene  wrote:

> Pessoal,
>
> Preciso montar um webservice que gere um wsdl, mas não achei algo que
> fosse mais direto na web, alguém tem um caminho para indicar.
>
> Abraço
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/LhrQCVZO12EJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



WebService WSDL

2012-06-28 Thread Rene
Pessoal, 

Preciso montar um webservice que gere um wsdl, mas não achei algo que fosse 
mais direto na web, alguém tem um caminho para indicar.

Abraço

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/LhrQCVZO12EJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: 'CSRF verification failed." from django.contrib.comments. can you help solve it? django 1.3

2012-06-28 Thread Ian Clelland
On Thu, Jun 28, 2012 at 9:14 AM, brycenesbitt 
 wrote:

> I'm using django.contrib.comments and get 'CSRF token missing or
> incorrect.' when previewing or submitting a comment.  I have:

...



The HTML looks like it has the csrf security_hash in the proper place:
> 
>  />
> 
> 
> ...



The "security_hash" field that you see is part of the comments app, and is
not the CSRF token. That needs to be output by a {% csrf_token %} tag (or
its equivalent). If it's working, you should see another hidden input
field, which looks like this:





The comments app normally does that automatically -- it's part of
django/contrib/comments/templates/form.html -- Are you overriding the
comment form in your own app? If so, you need to include the call to {%
csrf_token %} yourself.

@csrf_protect  #does not matter if this is here or not
>

No, if you have the CSRFViewMiddleware installed, then you don't need this
line at all.

-- 
Regards,
Ian Clelland


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: 'CSRF verification failed." from django.contrib.comments. can you help solve it? django 1.3

2012-06-28 Thread Jonas Geiregat
On do, jun 28, 2012 at 09:14:36 -0700, brycenesbitt wrote:
> http://127.0.0.1:8000/comments/post/>" method="post">
>/>
>id="id_timestamp" />
>value="6e85e1c846861c80575ce435b21a855706725b00" id="id_security_hash" 
> />

After the starting form tag add {% csrf_token %}

More information about it: 
https://docs.djangoproject.com/en/dev/ref/contrib/csrf/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: replace or regex

2012-06-28 Thread Tim Chase
On 06/28/12 01:42, pakyazilim wrote:
> i have text ;
> **
>A
>  
>  B
>  
>   
> **
> *
> *
> *i want to remove first  end for text end  tag. *
> *how can i it?*

Depends on what you want to happen in various odd edge-cases:

- what happens if other tags surround the outside  block like

   Ab

- what happens if there's only an opening or closing  tag but
not the other?

- what happens if the  tag has attributes on it like

  ...

- what happens if case differs?

  ...

- what happens if there are superfluous spaces?

  < ul > ... < / ul >

- do you want to remove the tags and keep the whitespace around
them, or do you want to condense the whitespace too?


You likely want either a regexp or two, or you want a full-blown
HTML parser.

-tkc


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



'CSRF verification failed." from django.contrib.comments. can you help solve it? django 1.3

2012-06-28 Thread brycenesbitt
I'm using django.contrib.comments and get 'CSRF token missing or incorrect.' 
when previewing or submitting a comment.  I have:

*MIDDLEWARE_CLASSES = (*
*'django.middleware.csrf.CsrfViewMiddleware',*
*'django.middleware.common.CommonMiddleware',*
*'django.contrib.sessions.middleware.SessionMiddleware',*
*'django.contrib.auth.middleware.AuthenticationMiddleware',*
*'django.contrib.messages.middleware.MessageMiddleware',*
*)*

url(r'^comments/',  include('django.contrib.comments.urls')),
url(r'^entry/(?P\d+)/comment',  'rp2.views.entry_comment_add'),

@csrf_protect  #does not matter if this is here or not
def entry_comment_add(request, pk):
entry = models.Entry.objects.get(pk=pk)
assert isinstance(entry, models.Entry)
return render(request, 'entry_comment_popup.html', {'entry':entry})

{% extends 'head-plain.html' %}

{% load comments %}
{% block content %}
{% render_comment_form for entry %}
{% endblock %}

The HTML looks like it has the csrf security_hash in the proper place:

http://127.0.0.1:8000/comments/post/>" method="post">
  
  
  

...

I have read https://docs.djangoproject.com/en/dev/ref/contrib/comments/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/TDG0eAHHlkkJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: have an object available in every templates

2012-06-28 Thread Bastian
Well, I was curious to see if it worked with a context processor so I tried 
and indeed it works. After all it's only returning an object or list of 
objects in a dictionary. Now I don't know which method is the most 
efficient.

On Thursday, June 28, 2012 2:11:37 PM UTC+2, Bastian wrote:
>
> Hi,
>
> I don't know if this is possible or how to do it. I would like to write a 
> sort of context processor where I pass an object to the template. I have 
> always passed strings to these variables. Let's say I have a Book model and 
> in a view I list the latest books I've added to the database. In the 
> corresponding template I will then have an objects list with these objects. 
> But I also want to be able to call a variable containing another list of 
> objects, say my favorite books, without having to pass it explicitly from 
> the view and being able to call it from any template.
> Can I do it with context processors, or anything else actually?
>
> Thanks.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/QvOMOm3cfBEJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: have an object available in every templates

2012-06-28 Thread Bastian
Well, I was curious to see if it worked with a context processor so I tried 
and indeed it works. After all it's only returning an object or list of 
objects in a dictionary. Now I don't which method is the more efficient.

On Thursday, June 28, 2012 2:11:37 PM UTC+2, Bastian wrote:
>
> Hi,
>
> I don't know if this is possible or how to do it. I would like to write a 
> sort of context processor where I pass an object to the template. I have 
> always passed strings to these variables. Let's say I have a Book model and 
> in a view I list the latest books I've added to the database. In the 
> corresponding template I will then have an objects list with these objects. 
> But I also want to be able to call a variable containing another list of 
> objects, say my favorite books, without having to pass it explicitly from 
> the view and being able to call it from any template.
> Can I do it with context processors, or anything else actually?
>
> Thanks.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/CDSwmcvdg_wJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django 1.4 + grappelli 2.4: missing css, img files.

2012-06-28 Thread bruce
Thanks Karl for your reply. 
It would appear that ADMIN_MEDIA_PREFIX is Deprecated in django 1.4

root@lablinux:~/django/mysite# python manage.py  runserver 0.0.0.0:8000
/usr/local/lib/python2.6/dist-packages/django/conf/__init__.py:75: 
DeprecationWarning: The ADMIN_MEDIA_PREFIX setting has been removed; use 
STATIC_URL instead.
  "use STATIC_URL instead.", DeprecationWarning)
/usr/local/lib/python2.6/dist-packages/django/conf/__init__.py:75: 
DeprecationWarning: The ADMIN_MEDIA_PREFIX setting has been removed; use 
STATIC_URL instead.
  "use STATIC_URL instead.", DeprecationWarning)
Validating models...


I realized that I didn't post my setting.py
Please see my bellowing setting.py:

MEDIA_ROOT = ''
MEDIA_URL = ''
STATIC_ROOT = ''
STATIC_URL = '/static/'
STATICFILES_DIRS = (
)

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'grappelli',
'django.contrib.admin',
'polls',
)


The directory tree is as follows:
root@lablinux:/home/hduser/django/mysite# pwd
/home/hduser/django/mysite
root@lablinux:/home/hduser/django/mysite# ls
admin  grappelli  manage.py  mysite  polls

any idea? 
Thanks a lot!!!



On Thursday, June 28, 2012 3:04:25 AM UTC-4, Karl Sutt wrote:
>
> Ali,
>
> Given that your static directory is STATIC_URL = '/static/' and 
> STATIC_ROOT is something like os.path.join(PROJECT_PATH, "static"), add
>
>> ADMIN_MEDIA_PREFIX = '/static/grappelli/' (or whatever your static 
>> directory is) to your settings.py
>
>
> That should do the trick. 
>
> Tervitades/Regards
> Karl Sutt
>
>
> On Thu, Jun 28, 2012 at 5:07 AM, bruce  wrote:
>
>> Dear All,
>>
>> I know this problem is related with grappelli. But it may be a django 
>> configure problem. So I am posting my question here.
>> If it is inappropriate, please let me know. 
>>
>> I followed the django 1.4's tutorial to setup the 'polls' app and it was 
>> successful.
>> I also followed the grappelli 2.4 quick start guide. 
>> http://django-grappelli.**readthedocs.org/en/grappelli_**
>> 2_4/quickstart.html
>>
>> I followed every step and didn't do anything else. 
>> The last command is:
>> python manage.py collectstatic
>> After this command is executed, two new directories were created(admin 
>> and grappelli).
>>
>> The directory is as follows:
>>  root@ubuntu:/home/hduser/**django/mysite# pwd
>> /home/hduser/django/mysite
>> root@ubuntu:/home/hduser/**django/mysite# ls
>> admin  grappelli  manage.py  mysite  mytemplate  polls
>>
>> Finally, 
>> I can access the http://127.0.0.1:8000/**admin
>> But, the css,img files are missing. Please see the attached screen shot 
>> picture. 
>>
>> The python manage.py runserver show:
>> [27/Jun/2012 21:36:19] "GET /admin/css/base.css HTTP/1.1" 404 4468
>> [27/Jun/2012 21:36:19] "GET 
>> /admin/jquery/ui/css/custom-**theme/jquery-ui-1.8.custom.css 
>> HTTP/1.1" 404 4585
>> [27/Jun/2012 21:36:19] "GET /admin/css/jquery-ui-**grappelli-extensions.css 
>> HTTP/1.1" 404 4546
>> [27/Jun/2012 21:36:19] "GET /admin/jquery/jquery-1.6.2.**min.js 
>> HTTP/1.1" 404 4510
>> [27/Jun/2012 21:36:19] "GET 
>> /admin/jquery/ui/js/jquery-ui-**1.8.15.custom.min.js 
>> HTTP/1.1" 404 4561
>> [27/Jun/2012 21:36:19] "GET /admin/js/grappelli/grappelli.**js HTTP/1.1" 
>> 404 4507
>> [27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.**grp_collapsible.js 
>> HTTP/1.1" 404 4546
>> [27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.**grp_timepicker.js 
>> HTTP/1.1" 404 4543
>> [27/Jun/2012 21:36:20] "GET 
>> /admin/js/grappelli/jquery.**grp_collapsible_group.js 
>> HTTP/1.1" 404 4564
>> [27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.**grp_related_fk.js 
>> HTTP/1.1" 404 4543
>> [27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.**grp_related_m2m.js 
>> HTTP/1.1" 404 4546
>> [27/Jun/2012 21:36:20] "GET 
>> /admin/js/grappelli/jquery.**grp_related_generic.js 
>> HTTP/1.1" 404 4558
>> [27/Jun/2012 21:36:20] "GET 
>> /admin/js/grappelli/jquery.**grp_autocomplete_fk.js 
>> HTTP/1.1" 404 4558
>> [27/Jun/2012 21:36:20] "GET 
>> /admin/js/grappelli/jquery.**grp_autocomplete_m2m.js 
>> HTTP/1.1" 404 4561
>> [27/Jun/2012 21:36:20] "GET 
>> /admin/js/grappelli/jquery.**grp_autocomplete_generic.js 
>> HTTP/1.1" 404 4573
>> [27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.**grp_timepicker.js 
>> HTTP/1.1" 404 4543
>> [27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.**grp_related_fk.js 
>> HTTP/1.1" 404 4543
>> [27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.**grp_related_m2m.js 
>> HTTP/1.1" 404 4546
>> [27/Jun/2012 21:36:20] "GET 
>> /admin/js/grappelli/jquery.**grp_related_generic.js 
>> HTTP/1.1" 404 4558
>> [27/Jun/2012 21:36:20] "GET 
>> /admin/js/grappelli/jquery.**grp_autocomplete_fk.js 
>> HTTP/1.1" 404 4558
>> 

settings and constants on a reusable app

2012-06-28 Thread Marc Aymerich
Hi,
I'm developing a reusable application and I'm having troubles with
constant values on settings.

Imagine that the reusable application comes with the following settings.py

# MY_APP/settings.py
from django.conf import settings
MY_CONSTANT = 'C1'
MY_OTHER_CONSTANT =  'C2'
MY_SETTING = getattr(settings, 'MY_SETTING', CONSTANT)


But for your project you want to override the default value of
MY_SETTING by MY_OTHER_CONSTANT. So you edit your project settings.py
and adds these two lines:

# Project settings.py

from MY_APP.settings import settings as my_app_settings
MY_SETTING = my_app_settings.MY_OTHER_SETTING


But this is going to fail because of the import order.

Is there any consistent way to handle this situation?

Thanks!
-- 
Marc

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: replace or regex

2012-06-28 Thread Kurtis Mullins
You could use regular expressions to parse the string, break it up
into chunks and simply remove the first and last chunk (or whatever
you're looking for)
Also, you could use a DOM Parser to parse this tree and remove the
outer-most . Just make sure you don't remove the entire DOM Tree
within the UL.
I'd google around for ways to do either.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Testing with LiveServerTestCase and Selenium

2012-06-28 Thread Paul Childs
Hello,
I'm using Django 1.4 and was really excited to learn about the new testing 
features. I am totally new to this.
I seem to have hit a bump in the road. If I overcome this I'm hopeful it 
will be smooth sailing and I will experience some great testing goodness.
I've been mucking around with this all morning and I can't seem to get the 
selenium Firefox webdriver to navigate to the given URL.

I have read the docs:
https://docs.djangoproject.com/en/1.4/topics/testing/#django.test.LiveServerTestCase
 
and read this tutorial
http://www.tdd-django-tutorial.com/tutorial/1/ 
and tried to run the test code that they suggest.

When I run the very simple test:

from django.test import LiveServerTestCase
from selenium import webdriver

class MySeleniumTests(LiveServerTestCase):
fixtures = ['lookups_security.json']

def setUp(self):
self.browser = webdriver.Firefox()

def tearDown(self):
self.browser.quit()

def test_login(self):
# Gertrude opens her web browser, and goes to the admin page
self.browser.get(self.live_server_url + '/admin/login/')

# She sees the familiar 'Django administration' heading
body = self.browser.find_element_by_tag_name('body')
self.assertIn('CISSIMP Admin', body.text)

A blank Firefox browser pops up, sits there and then closes.

The test output is:

(sitar_env2) C:\virtual_env\sitar_env2\cissimp>python manage.py test 
--liveserver=localhost:8082 sitar
Creating test database for alias 'default'...
E
==
ERROR: test_login (sitar.tests.MySeleniumTests)
--
Traceback (most recent call last):
  File "C:\virtual_env\sitar_env2\cissimp\sitar\tests.py", line 54, in 
test_login
self.assertIn('CISSIMP Admin', body.text)
AttributeError: 'NoneType' object has no attribute 'text'

--
Ran 1 test in 22.546s

FAILED (errors=1)
Destroying test database for alias 'default'...

It seems obvious that the browser is not navigating to the URL I want so 
the code is trying to get a reference to an non-existent body tag.

Can anyone see what I am doing wrong?

Thanks
/Paul

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/jh47T9WA7QkJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: many "Broken INTERNAL link" with end string "/undefined/"

2012-06-28 Thread ferran
Hello Melvyn,

Ohhh in the javascript!. you're good I view my libraries and update 
it's necessary (Jquery, etc.).

see you with the response of the re-code javascript

Thanks


On Thursday, June 28, 2012 2:59:12 PM UTC+2, Melvyn Sopacua wrote:
>
> On 27-6-2012 18:37, ferran wrote: 
>
> > In the last 3 weeks I'm receiving in my email a many "Broken INTERNAL 
> link" 
> > how this: 
> > 
> > " 
> > Referrer: http://www.marquezshop.com/es/catalogo/sales/ 
> > Requested URL: /es/catalogo/sales/undefined/ 
> ^ 
> That's javascript, not python doing that. Python would be 'None'. So 
> check your javascript code for Google Chrome compliance. 
>
> -- 
> Melvyn Sopacua 
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/Orst_QWb4LkJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: have an object available in every templates

2012-06-28 Thread Daniel Roseman
On Thursday, 28 June 2012 13:11:37 UTC+1, Bastian wrote:
>
> Hi,
>
> I don't know if this is possible or how to do it. I would like to write a 
> sort of context processor where I pass an object to the template. I have 
> always passed strings to these variables. Let's say I have a Book model and 
> in a view I list the latest books I've added to the database. In the 
> corresponding template I will then have an objects list with these objects. 
> But I also want to be able to call a variable containing another list of 
> objects, say my favorite books, without having to pass it explicitly from 
> the view and being able to call it from any template.
> Can I do it with context processors, or anything else actually?
>
> Thanks.
>

Use a custom template tag.
--
DR. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/9lh9yuVTKL8J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: have an object available in every templates

2012-06-28 Thread Karl Sutt
I think you can do it with Middleware.
https://docs.djangoproject.com/en/1.4/topics/http/middleware/#writing-your-own-middleware
Specifically, I think it's worth looking into the
"process_template_response" method.

Tervitades/Regards
Karl Sutt


On Thu, Jun 28, 2012 at 3:11 PM, Bastian  wrote:

> Hi,
>
> I don't know if this is possible or how to do it. I would like to write a
> sort of context processor where I pass an object to the template. I have
> always passed strings to these variables. Let's say I have a Book model and
> in a view I list the latest books I've added to the database. In the
> corresponding template I will then have an objects list with these objects.
> But I also want to be able to call a variable containing another list of
> objects, say my favorite books, without having to pass it explicitly from
> the view and being able to call it from any template.
> Can I do it with context processors, or anything else actually?
>
> Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/sLXf508kb4gJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: many "Broken INTERNAL link" with end string "/undefined/"

2012-06-28 Thread ferran
Hello Russ,

In the view code of this pages I don't found de keyword "undefined"

Thanks in advanced

On Thursday, June 28, 2012 1:38:22 AM UTC+2, Russell Keith-Magee wrote:
>
> On Thu, Jun 28, 2012 at 12:37 AM, ferran  wrote: 
> > Hello django users, 
> > 
> > In the last 3 weeks I'm receiving in my email a many "Broken INTERNAL 
> link" 
> > how this: 
> > 
> > " 
> > Referrer: http://www.marquezshop.com/es/catalogo/sales/ 
> > Requested URL: /es/catalogo/sales/undefined/ 
> > User agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/536.5 (KHTML, like 
> > Gecko) Chrome/19.0.1084.56 Safari/536.5 
> > IP address: --- 
> > " 
> > or 
> > 
> > " 
> > Referrer: 
> > 
> http://www.marquezshop.com/es/catalogo/sales/sal-compactada-en-pastillas-piscinas-salnet.html/
>  
> > Requested URL: 
> > 
> /es/catalogo/sales/sal-compactada-en-pastillas-piscinas-salnet.html/undefined/
>  
>
> > User agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/534.30 (KHTML, like 
> > Gecko) Chrome/12.0.742.122 Safari/534.30 
> > IP address:  
> > " 
> > 
> > The pattern from requested URL can be any, but, always have a end string 
> > "/undefined/" 
> > 
> > I'm not update the code, but update, nginx, mysql, apache 
> > 
> > Program versions: 
> > django 1.1.4 
> > localeurl 1.5 (tip version) 
> > 
> > Do you have any Idea? 
>
> It's impossible to say without seeing all your code, but you only get 
> those emails if there is a link on your page that returns a 404. That 
> means that pages on your site are being rendered with  href=".../undefined/"> on them. 
>
> The link may not be in an obvious location -- I'm going to guess that 
> they've been found by a robot that is scraping your site -- but if 
> your getting the emails, you can be fairly certain that the links 
> exist *somewhere*. 
>
> Yours, 
> Russ Magee %-) 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/oSCO_IOjT4UJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: many "Broken INTERNAL link" with end string "/undefined/"

2012-06-28 Thread Melvyn Sopacua
On 27-6-2012 18:37, ferran wrote:

> In the last 3 weeks I'm receiving in my email a many "Broken INTERNAL link" 
> how this:
> 
> "
> Referrer: http://www.marquezshop.com/es/catalogo/sales/
> Requested URL: /es/catalogo/sales/undefined/
^
That's javascript, not python doing that. Python would be 'None'. So
check your javascript code for Google Chrome compliance.

-- 
Melvyn Sopacua


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



have an object available in every templates

2012-06-28 Thread Bastian
Hi,

I don't know if this is possible or how to do it. I would like to write a 
sort of context processor where I pass an object to the template. I have 
always passed strings to these variables. Let's say I have a Book model and 
in a view I list the latest books I've added to the database. In the 
corresponding template I will then have an objects list with these objects. 
But I also want to be able to call a variable containing another list of 
objects, say my favorite books, without having to pass it explicitly from 
the view and being able to call it from any template.
Can I do it with context processors, or anything else actually?

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/sLXf508kb4gJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Translation hooks in custom template tag

2012-06-28 Thread Владислав Митов
Hello, 

I can't make this feature

> *{% some_special_tag _("Page not found") value|yesno:_("yes,no") %} *

to work with this custom template tag - 
http://djangosnippets.org/snippets/1289/ with django 1.4.

The result from {% breadcrumb _("Create") %} is _("Create") in the HTML. 

What could be the reason?

Thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/52iLN57Ah5MJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: locating the functionality behind the HTML element

2012-06-28 Thread Jon Black
If I understand you correctly, you want to find the django code
responsible for rendering the view. Rather than look at the html,
the most obvious place is to look at the url. There should be an
entry in one of your urls.py files, which will tell you which
view is being used. You can then trace that view to the template.

--
Jon Black
www.jonblack.org


On Wed, Jun 27, 2012, at 17:55, Smaran Harihar wrote:

  Hi Guys,



I am new to Django and have completed the initial basic tutorials
in the django doc. I am presently working on a pre-customized
django application. I was wondering how I can use FireBug to
locate the code in a specific element (like button). In the
sense, in general the web development once we are able to locate
the button we are able to then locate the class of the specific
element and JS attached to it and CSS. But in Django this cannot
be done since everything is located in separate directories.



Since I am entering into the Django code, where should I start
looking for the CSS and JS files?

--
Thanks & Regards
Smaran Harihar


  --
  You received this message because you are subscribed to the
  Google Groups "Django users" group.
  To post to this group, send email to
  django-users@googlegroups.com.
  To unsubscribe from this group, send email to
  django-users+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: replace or regex

2012-06-28 Thread Abdulkerim KELEŞ
first is s='**
   A
 
 B
 
  
**'
s.replace('' ,' ', 1 )

but i dont remove last  tag.

2012/6/28 pakyazilim 

> i have text ;
> **
>A
>  
>  B
>  
>   
> **
> *
> *
> *i want to remove first  end for text end  tag. *
> *how can i it?*
> *thanks you...*
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/lPA-eOEgEBYJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: interpretting urls

2012-06-28 Thread kenneth gonsalves
On Thu, 2012-06-28 at 03:25 -0700, bruno desthuilliers wrote:
> ROOT_URLCONF
> >  setting.
> >
> >
> >
> It's also in the FineManual. If you look at the doc's home page,
> you'll 
> find a very explicit reference to middlewares : 
> 
> https://docs.djangoproject.com/en/dev/#the-view-layer
> 
> Should I mention that there's a "search" feature in the doc too ? 

but that is not yet fixed, it does not do multiword searches - better to
use duckduckgo's site feature.
-- 
regards
Kenneth Gonsalves

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: interpretting urls

2012-06-28 Thread bruno desthuilliers
On Wednesday, June 27, 2012 11:53:56 PM UTC+2, Sam007 wrote:
>
>
> Going thru the doc link you gave, I did not understand the term middleware 
> request processing?
>
> but if the incoming HttpRequest object has an attribute called urlconf (set 
> by middleware *request 
> processing*),
>  
> its value will be used in place of the 
> ROOT_URLCONF
>  setting.
>
>
>
It's also in the FineManual. If you look at the doc's home page, you'll 
find a very explicit reference to middlewares : 

https://docs.djangoproject.com/en/dev/#the-view-layer

Should I mention that there's a "search" feature in the doc too ?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/KQ6qET4bU4UJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



SimpleListFilter filter UserProfile

2012-06-28 Thread yillkid
Hi all !

I want filter a field of UserProfile (field name: timestamp),

models.py:   http://dpaste.com/764723/

admin.py:   http://dpaste.com/764724/

But when I press the filter, browser show:   http://dpaste.com/764725/

--- --- --- --- --- --- --- --- --- ---

According the error message, I can get class "UserProfile", 
but if I want to  filter timestamp, how should I do ?

thx :-)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/EpIYy3gEdUUJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: interpretting urls

2012-06-28 Thread Jani Tiainen

Hi,

Quote from URL dispatcher documentation:
"To design URLs for an app, you create a Python module informally called 
a URLconf (URL configuration). This module is pure Python code and is a 
simple mapping between URL patterns (as simple regular expressions) to 
Python callback functions (your views).

"

So you need to do your homework and learn how to read and write (Python) 
regular expressions since pretty much everything in url

config is a regular expression.

28.6.2012 1:29, Smaran Harihar kirjoitti:

The doc did not give details for *r'^(?:index/?)?$'*, in

(r'^(?:index/?)?$', 'geonode.views.index')

Thanks,
Smaran

On Wed, Jun 27, 2012 at 4:16 AM, bruno desthuilliers
>
wrote:



On Tuesday, June 26, 2012 6:52:06 PM UTC+2, Sam007 wrote:

Hi,

I am bit confused about what exactly do these urls imply in the
url.py


This is all documented here :
https://docs.djangoproject.com/en/dev/topics/http/urls/


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django 1.4 + grappelli 2.4: missing css, img files.

2012-06-28 Thread Karl Sutt
Ali,

Given that your static directory is STATIC_URL = '/static/' and STATIC_ROOT
is something like os.path.join(PROJECT_PATH, "static"), add

> ADMIN_MEDIA_PREFIX = '/static/grappelli/' (or whatever your static
> directory is) to your settings.py


That should do the trick.

Tervitades/Regards
Karl Sutt


On Thu, Jun 28, 2012 at 5:07 AM, bruce  wrote:

> Dear All,
>
> I know this problem is related with grappelli. But it may be a django
> configure problem. So I am posting my question here.
> If it is inappropriate, please let me know.
>
> I followed the django 1.4's tutorial to setup the 'polls' app and it was
> successful.
> I also followed the grappelli 2.4 quick start guide.
> http://django-grappelli.**readthedocs.org/en/grappelli_**
> 2_4/quickstart.html
>
> I followed every step and didn't do anything else.
> The last command is:
> python manage.py collectstatic
> After this command is executed, two new directories were created(admin and
> grappelli).
>
> The directory is as follows:
>  root@ubuntu:/home/hduser/**django/mysite# pwd
> /home/hduser/django/mysite
> root@ubuntu:/home/hduser/**django/mysite# ls
> admin  grappelli  manage.py  mysite  mytemplate  polls
>
> Finally,
> I can access the http://127.0.0.1:8000/**admin
> But, the css,img files are missing. Please see the attached screen shot
> picture.
>
> The python manage.py runserver show:
> [27/Jun/2012 21:36:19] "GET /admin/css/base.css HTTP/1.1" 404 4468
> [27/Jun/2012 21:36:19] "GET 
> /admin/jquery/ui/css/custom-**theme/jquery-ui-1.8.custom.css
> HTTP/1.1" 404 4585
> [27/Jun/2012 21:36:19] "GET /admin/css/jquery-ui-**grappelli-extensions.css
> HTTP/1.1" 404 4546
> [27/Jun/2012 21:36:19] "GET /admin/jquery/jquery-1.6.2.**min.js HTTP/1.1"
> 404 4510
> [27/Jun/2012 21:36:19] "GET 
> /admin/jquery/ui/js/jquery-ui-**1.8.15.custom.min.js
> HTTP/1.1" 404 4561
> [27/Jun/2012 21:36:19] "GET /admin/js/grappelli/grappelli.**js HTTP/1.1"
> 404 4507
> [27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.**grp_collapsible.js
> HTTP/1.1" 404 4546
> [27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.**grp_timepicker.js
> HTTP/1.1" 404 4543
> [27/Jun/2012 21:36:20] "GET 
> /admin/js/grappelli/jquery.**grp_collapsible_group.js
> HTTP/1.1" 404 4564
> [27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.**grp_related_fk.js
> HTTP/1.1" 404 4543
> [27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.**grp_related_m2m.js
> HTTP/1.1" 404 4546
> [27/Jun/2012 21:36:20] "GET 
> /admin/js/grappelli/jquery.**grp_related_generic.js
> HTTP/1.1" 404 4558
> [27/Jun/2012 21:36:20] "GET 
> /admin/js/grappelli/jquery.**grp_autocomplete_fk.js
> HTTP/1.1" 404 4558
> [27/Jun/2012 21:36:20] "GET 
> /admin/js/grappelli/jquery.**grp_autocomplete_m2m.js
> HTTP/1.1" 404 4561
> [27/Jun/2012 21:36:20] "GET 
> /admin/js/grappelli/jquery.**grp_autocomplete_generic.js
> HTTP/1.1" 404 4573
> [27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.**grp_timepicker.js
> HTTP/1.1" 404 4543
> [27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.**grp_related_fk.js
> HTTP/1.1" 404 4543
> [27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.**grp_related_m2m.js
> HTTP/1.1" 404 4546
> [27/Jun/2012 21:36:20] "GET 
> /admin/js/grappelli/jquery.**grp_related_generic.js
> HTTP/1.1" 404 4558
> [27/Jun/2012 21:36:20] "GET 
> /admin/js/grappelli/jquery.**grp_autocomplete_fk.js
> HTTP/1.1" 404 4558
> [27/Jun/2012 21:36:20] "GET 
> /admin/js/grappelli/jquery.**grp_autocomplete_m2m.js
> HTTP/1.1" 404 4561
> [27/Jun/2012 21:36:20] "GET 
> /admin/js/grappelli/jquery.**grp_autocomplete_generic.js
> HTTP/1.1" 404 4573
>
>
>
> Would you please tell me how to fix it?
> Why 404?
> I know I am supposed to read some web links. Please tell me.
> Thank you!!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/egmDj5ZbW40J.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Where admin classes should be registered ?

2012-06-28 Thread Shane Shane Bichel
jjcjgxydhfxydzh

On Wed, Jun 27, 2012 at 12:54 AM, Alireza Savand
wrote:

> Hi
> Common way to create [model|admin] classes is implement and create them in
> [models|admin].py file.
> But as standard non-django way is to create a python package named admin
> for AdminClass es and  create a file for each admin class.
> But i couldn't find any standard way to register those admin classes, i
> mean should i register them in admin/__init__.py or register each class in
> it own file then import them at admin/__init__.py ?
> Sometimes when i register all of them at admin/__init__.py it's happening
> that classes will initialed multiple times and i don't know the reason.
> I'm just looking for common or standard way to do it.
>
> Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/_UjokPA1WgYJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



django 1.4 + grappelli 2.4: missing css, img files.

2012-06-28 Thread bruce
Dear All,

I know this problem is related with grappelli. But it may be a django 
configure problem. So I am posting my question here.
If it is inappropriate, please let me know. 

I followed the django 1.4's tutorial to setup the 'polls' app and it was 
successful.
I also followed the grappelli 2.4 quick start guide. 
http://django-grappelli.readthedocs.org/en/grappelli_2_4/quickstart.html

I followed every step and didn't do anything else. 
The last command is:
python manage.py collectstatic
After this command is executed, two new directories were created(admin and 
grappelli).

The directory is as follows:
 root@ubuntu:/home/hduser/django/mysite# pwd
/home/hduser/django/mysite
root@ubuntu:/home/hduser/django/mysite# ls
admin  grappelli  manage.py  mysite  mytemplate  polls

Finally, 
I can access the http://127.0.0.1:8000/admin
But, the css,img files are missing. Please see the attached screen shot 
picture. 

The python manage.py runserver show:
[27/Jun/2012 21:36:19] "GET /admin/css/base.css HTTP/1.1" 404 4468
[27/Jun/2012 21:36:19] "GET 
/admin/jquery/ui/css/custom-theme/jquery-ui-1.8.custom.css HTTP/1.1" 404 
4585
[27/Jun/2012 21:36:19] "GET /admin/css/jquery-ui-grappelli-extensions.css 
HTTP/1.1" 404 4546
[27/Jun/2012 21:36:19] "GET /admin/jquery/jquery-1.6.2.min.js HTTP/1.1" 404 
4510
[27/Jun/2012 21:36:19] "GET 
/admin/jquery/ui/js/jquery-ui-1.8.15.custom.min.js HTTP/1.1" 404 4561
[27/Jun/2012 21:36:19] "GET /admin/js/grappelli/grappelli.js HTTP/1.1" 404 
4507
[27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.grp_collapsible.js 
HTTP/1.1" 404 4546
[27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.grp_timepicker.js 
HTTP/1.1" 404 4543
[27/Jun/2012 21:36:20] "GET 
/admin/js/grappelli/jquery.grp_collapsible_group.js HTTP/1.1" 404 4564
[27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.grp_related_fk.js 
HTTP/1.1" 404 4543
[27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.grp_related_m2m.js 
HTTP/1.1" 404 4546
[27/Jun/2012 21:36:20] "GET 
/admin/js/grappelli/jquery.grp_related_generic.js HTTP/1.1" 404 4558
[27/Jun/2012 21:36:20] "GET 
/admin/js/grappelli/jquery.grp_autocomplete_fk.js HTTP/1.1" 404 4558
[27/Jun/2012 21:36:20] "GET 
/admin/js/grappelli/jquery.grp_autocomplete_m2m.js HTTP/1.1" 404 4561
[27/Jun/2012 21:36:20] "GET 
/admin/js/grappelli/jquery.grp_autocomplete_generic.js HTTP/1.1" 404 4573
[27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.grp_timepicker.js 
HTTP/1.1" 404 4543
[27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.grp_related_fk.js 
HTTP/1.1" 404 4543
[27/Jun/2012 21:36:20] "GET /admin/js/grappelli/jquery.grp_related_m2m.js 
HTTP/1.1" 404 4546
[27/Jun/2012 21:36:20] "GET 
/admin/js/grappelli/jquery.grp_related_generic.js HTTP/1.1" 404 4558
[27/Jun/2012 21:36:20] "GET 
/admin/js/grappelli/jquery.grp_autocomplete_fk.js HTTP/1.1" 404 4558
[27/Jun/2012 21:36:20] "GET 
/admin/js/grappelli/jquery.grp_autocomplete_m2m.js HTTP/1.1" 404 4561
[27/Jun/2012 21:36:20] "GET 
/admin/js/grappelli/jquery.grp_autocomplete_generic.js HTTP/1.1" 404 4573



Would you please tell me how to fix it? 
Why 404? 
I know I am supposed to read some web links. Please tell me. 
Thank you!!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/egmDj5ZbW40J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

<>

replace or regex

2012-06-28 Thread pakyazilim
i have text ;
**
   A
 
 B
 
  
**
*
*
*i want to remove first  end for text end  tag. *
*how can i it?*
*thanks you...*

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/lPA-eOEgEBYJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Where admin classes should be registered ?

2012-06-28 Thread Alireza Savand
Yes, But when my models.py/admin.py reach to +2000 line then django
standard way not gonna help. That's why i seperate the classes into files
and pkgs.
I'm wonder is there any performance issue on this approach, since each
class is in separate file, when i import them i'm sure python should find
them at the filesystem and initial them or they will be initialized by
django ?


On Wed, Jun 27, 2012 at 6:28 PM, Daniel Roseman wrote:

> On Wednesday, 27 June 2012 08:54:07 UTC+1, Alireza Savand wrote:
>>
>> Hi
>> Common way to create [model|admin] classes is implement and create them
>> in [models|admin].py file.
>> But as standard non-django way is to create a python package named admin
>> for AdminClass es and  create a file for each admin class.
>> But i couldn't find any standard way to register those admin classes, i
>> mean should i register them in admin/__init__.py or register each class in
>> it own file then import them at admin/__init__.py ?
>> Sometimes when i register all of them at admin/__init__.py it's happening
>> that classes will initialed multiple times and i don't know the reason.
>> I'm just looking for common or standard way to do it.
>>
>> Thanks.
>>
>
> There is absolutely a standard way to do this, which is fully documented.
>
> Define all your ModelAdmin classes in an admin.py inside each app.
> Register the classes in that file (usually together at the end). In your
> main urls.py, call `admin.autodiscover()`, which imports all the admin.py
> files which causes them to be registered.
>
> If you do anything else, you may well run into multiple registration
> problems. Don't. Follow the standard.
> --
> DR.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/h2g8jTwkmrAJ.
>
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.