Re: user object not available in template

2016-11-25 Thread Drew Ferguson
mes Bennett <ubern...@gmail.com > > wrote: > >> The auth context processor provides it, but not as a variable named >> 'user'; instead it's attached to the 'request' variable, so what you want >> is '{% if request.user.is_authenticated }}'. >> >> On Fr

user object not available in template

2016-11-25 Thread Drew Ferguson
Hi Using Django 1.10 In my templates there is no user object to provide user.is_authenticated Is there something I have to do to turn this on? My settings has this TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [],

Re: managed=False ignored by migrate

2015-04-17 Thread Drew Ferguson
Erk! My own fault unfortunately, apologies for the noise Some files had gotten left in a migration folder in an app; causing all sorts of confusion evidently All well now... On Fri, 17 Apr 2015 13:51:08 +0100 Drew Ferguson <d...@afccommercial.co.uk> wrote: > Hi > > Trying

managed=False ignored by migrate

2015-04-17 Thread Drew Ferguson
ngo running fine but it always wanted an "id" field to exist in tables even though there was another field had "primary_key=True" set Is there some trick I am missing or maybe I should not be using 1.8 just yet -- Drew Ferguson -- You received this message because you

Re: Dynamic CSS

2014-08-14 Thread Drew Ferguson
Hi Avraham Thanks for the heads-up On Wed, 13 Aug 2014 11:25:09 +0300 Avraham Serour <tovm...@gmail.com> wrote: > just remember to change the headers of the response to reflect that you > are serving a css file and not html > > > On Wed, Aug 13, 2014 at 3:37

Re: # in django URL

2014-08-14 Thread Drew Ferguson
where file_path is path to the file > > both > requestGET["file_path"] and > request.get_full_path() > > ignore #1/test.txt part, how can i fix this? Is there some other way to > get full url? > -- Drew Ferguson -- You received this message because you

Re: Dynamic CSS

2014-08-12 Thread Drew Ferguson
;bleedin' obvious" is hard to see Thanks > ATOM, XML and JSON in templates). Or you could have multiple CSS files > and just pick the one you want to use when you render the link to the > CSS in your HTML pages. > > François > > On Aug 12, 2014, at 7:37 PM, Drew

Dynamic CSS

2014-08-12 Thread Drew Ferguson
Hi Is there any documentation describing possible ways of having dynamic CSS in a site? For example, having a CSS colour scheme set from a database query or setting a site logo URL from a database query Ta -- Drew Ferguson -- You received this message because you are subscribed to the Google

Re: A subprocess call fails, but only under Django

2014-03-11 Thread Drew Ferguson
the amount of memory required, > but I'm pretty sure this script isn't consuming much memory. Even when > it's not running ls, it's just doing a subprocess call to gpg to sign > and encrypt a file. It takes well under one second. > > Thanks for looking at it. > Shawn > --

Re: two apps against one table (admin)

2014-02-06 Thread Drew Ferguson
Hi This seems a very complicated solution to a fairly basic problem unless I am missing something > On Feb 7, 2014 2:24 AM, "fborell" wrote: > > > I need to create a second application in the admin section that ports > > to the first applications model. The second

Re: moving from sqlite3 to mysql

2014-02-05 Thread Drew Ferguson
t; mysql> SHOW DATABASES; > > ++ > > | Database | > > ++ > > | information_schema | > > | django_1 | > > | mysql | > > | performance_schema | > > | test | > > +

Re: Do I need an API?

2014-02-03 Thread Drew Ferguson
-- > > 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

Problem with Form with ForeignKey field

2014-01-14 Thread Drew Ferguson
Hi Django 1.5 I have a model which includes a ForeignKey field defined likes this class Document(models.Model): name = models.CharField(max_length=25, unique=True, null=False,blank=False) target = models.CharField(max_length=12, choices=TARGETS,default='report') content

Re: Url logic

2013-12-15 Thread Drew Ferguson
r id) > /mylibrary/book/32/addnewbook > > 2) how do I extract the slug within my BookNew (derived from CreateNew)? > url(r'^book/(?P\d+)/addnewbook, BookNew.as_view()), > > seems not avaliable as in the context/template: {{ slug }} > > Cheers, > Giulio. >

Re: How to get database data into a template sidebar

2013-12-03 Thread Drew Ferguson
reprocessors: > https://docs.djangoproject.com/en/1.5/ref/settings/#template-context-processors > > On 12/2/13, Drew Ferguson <d...@afccommercial.co.uk> wrote: > > Hi > > > > I am not really sure how to ask the Django docs what I want to do for > > this Could s

How to get database data into a template sidebar

2013-12-02 Thread Drew Ferguson
lumn but independent of view classes Do I have to add a function call to all CBV contexts to tabulate the data I want to list or is there a better way? Thanks -- Drew Ferguson AFC Commercial http://www.afccommercial.co.uk signature.asc Description: PGP signature

Re: Complex query

2013-09-09 Thread Drew Ferguson
of 30 items you needed. This way the ORM & Django SQL access is reduced to a single query on the view. The heavy lifting is all done server-side as comments/articles are saved Could this work? -- Drew Ferguson -- You received this message because you are subscribed to the Google Groups &quo

Re: Passing initial values to a form

2013-09-01 Thread Drew Ferguson
ub.com/django/django/blob/1.6b2/django/views/generic/edit.py#L22 > ) > > > `get_initial` should return a dict, and you should use: > > { > 'name_of_the_model_field': self.kwargs["iid"] > } > > > On Sun, Sep 1, 2013 at 6:37 PM, Drew Ferguson >

Passing initial values to a form

2013-09-01 Thread Drew Ferguson
Hi I have gotten myself badly confused today trying to figure this out. If I have these elements # urls.py url(r'^banker/(?P\d+)/iac$', view = IacCreateView.as_view()) # views.py class IacCreateView(LoginRequiredMixin, CreateView): template_name = 'iaccount_form.html' model = Iaccount

Re: Class Based Views

2013-08-14 Thread Drew Ferguson
Phew! Thanks for clearing that up On Wed, 14 Aug 2013 17:29:59 -0400 Bill Freeman <ke1g...@gmail.com> wrote: > I believe that GENERIC views that ARE NOT CBVs are deprecated (or maybe > even gone in the latest). > > > On Wed, Aug 14, 2013 at 5:23 PM, Drew Ferguson > &

Class Based Views

2013-08-14 Thread Drew Ferguson
Hi Did someone here recently say CBVs are now or will be deprecated? Or did I imagine that because I was on holiday? -- Drew Ferguson -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiv

Re: Live server tests from cron

2013-08-10 Thread Drew Ferguson
n > that invokes the tests: > > export DISPLAY=:0.0 > xhost + > > But that seems to have had no effect at all. This question seems to > have been asked a lot, but none of the answers I saw on SO or other > sites worked for me (none of them were using django). > >

Re: Avoiding huge IDs after deleting data

2013-08-05 Thread Drew Ferguson
e table instead? Then you can reset the sequence with this... TRUNCATE mytable RESTART IDENTITY http://www.postgresql.org/docs/9.1/interactive/sql-truncate.html -- Drew Ferguson -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from t

Re: How to check if DEBUG is True in template?

2013-08-05 Thread Drew Ferguson
On Mon, 5 Aug 2013 03:41:49 -0700 (PDT) cui ye <darwi...@gmail.com> wrote: > As title. > http://stackoverflow.com/questions/433162/can-i-access-constants-in-settings-py-from-templates-in-django Gives has an extensive answer with several alternatives -- Drew Ferguson --

Re: Custom column names in ManyToMany Field intermediate table

2013-08-02 Thread Drew Ferguson
give custom names to the columns in the > table So, as to not get the Missing column error in Java. > > Any help would be really appreciated. > -- Drew Ferguson -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsu

Re: Where is CBV & Formset docs

2013-08-02 Thread Drew Ferguson
s > to be the best of the options. > > Django core doesn't deal with teh cbv/formset problem very well (yet) > - there are ways they can be mangled, but it's code heavy. > django-extra-views is relatively simple by comparison. > > cheers > L. > > On 2 August 2013 22:28, Drew F

Where is CBV & Formset docs

2013-08-02 Thread Drew Ferguson
Hi I am having trouble locating documentation illustrating use of formsets with CBVs. Can someone point me at a page please? Issue #17700 in the tracker has been closed suggesting there is something somewhere -- Drew Ferguson -- You received this message because you are subscribed

Re: Unable to do import django

2013-07-08 Thread Drew Ferguson
On Mon, 8 Jul 2013 14:46:25 -0700 (PDT) "Yves S. Garret" <yoursurrogate...@gmail.com> wrote: > On Monday, July 8, 2013 5:18:21 PM UTC-4, Drew Ferguson wrote: > > > > Yo > > > > You have 2 versions of python installed: > > > > * python 2.

Re: Unable to do import django

2013-07-08 Thread Drew Ferguson
entire django install steps and when I fired up > > my Python shell > > (python 2.7.5, to be exact) and did import django, this is what I got: > > > > >>> import django > > Traceback (most recent call last): > > File "", line 1, in > > Im

Re: Django date format issue

2013-07-05 Thread Drew Ferguson
) > > DATE_INPUT_FORMAT = ['%d/%m/%Y','%m/%d/%Y'] > > class ReportDateTimeForm(forms.ModelForm): > > manual_date = forms.DateField(input_formats = DATE_INPUT_FORMAT, > > widget=forms.DateInput(format = '%d/%m/%Y')) > > class SettingsForm(forms.M

Re: Getting URL root

2013-07-02 Thread Drew Ferguson
So either your script needs to run in response to a request on django when the domain can be retained; this could be achieved through some configuration page that saves the url in the database which your script can then reference or you provide the script with the url from a configuration file or someth

Re: Project settings and application settings.

2013-06-21 Thread Drew Ferguson
IDDLEWARE_CLASSES[index+1:]) > >> > >> EXTERNAL_AUTH is used at different locations in my application, for > >> example I use it to decide whether or not > >> I display the "change password" link. > >> > >> When I start testing, toggling EX

Re: Complex(for me) queryset comparisons

2013-06-12 Thread Drew Ferguson
ctionary out of that. > > Should I be approaching this from a different angle? Is there a nice > Django way of making these comparisons and counts? > > Thank you, > > -Matt > -- Drew Ferguson signature.asc Description: PGP signature

Re: ROOT_URLCONF = 'mysite.urls' : SyntaxError: invalid syntax

2013-06-02 Thread Drew Ferguson
here is a syntax error probably very close to line 104 Possibly the closing bracket ")" of the previous tuple has been removed accidentally or something similar -- Drew Ferguson -- You received this message because you are subscribed to the Google Groups "Django users"

Re: listing objects in a html file

2013-05-28 Thread Drew Ferguson
edpremises = [] %} > {% for premises in object_list %} > {% if premises.in_use %} > {{ premises.name }} Update > > {% else unusedpremises.add(premises) %} > {% endif %} > {% endfor %} > > Unused Premises > > {% for premises in unusedpremises %} > {{ premises.nam

Re: view data tables?

2013-05-25 Thread Drew Ferguson
1.5/ref/models/options/#table-names > > > On Sun, May 26, 2013 at 5:51 AM, Drew Ferguson > <d...@afccommercial.co.uk>wrote: > > > On Sun, 26 May 2013 05:23:08 +0530 > > Kakar Arunachal Service <kakararunachalserv...@gmail.com> wrote: > > > > &

Re: view data tables?

2013-05-25 Thread Drew Ferguson
Is this what you are looking for? http://stackoverflow.com/questions/835069/which-sqlite-administration-console-do-you-recommend On my Linux system, sqliteman gets the billing "The best developer's and/or admin's GUI tool for Sqlite3 in the world" someone thinks it is good. I wouldn't kno

Re: Testing with complex database setups

2013-05-23 Thread Drew Ferguson
se with some pre-data. > > So how I should proceed with unit testing with database like that, since > some operations rely heavily that there really exists all that > trigger-function mess in the database? So that I don't need everytime to > start from the scratch but from some known stat

Re: Serving files in production

2013-04-11 Thread Drew Ferguson
wrote: > On Thu, Apr 11, 2013 at 1:50 PM, Drew Ferguson > <d...@afccommercial.co.uk> wrote: > > On Thu, 11 Apr 2013 14:54:50 +0300 > > Avraham Serour <tovm...@gmail.com> wrote: > > > >> you can create a subdomain (static.yourdomain.com) and serve static >

Re: Serving files in production

2013-04-11 Thread Drew Ferguson
in templates, etc AND life gets very complicated when trying to develop the same site on a development system. Is the recommendation really addressing a performance issue for high traffic sites where Apache WSGI gets overloaded and becomes a bottleneck? > > > On Thu, Apr 11, 2013 at 2

Serving files in production

2013-04-11 Thread Drew Ferguson
Hi The docs recommend serving static data from a second web server rather than the one serving via WSGI How do folks implement this? I can't figure how to serve data for the same domain using 2 web servers. Am I missing something? -- Drew signature.asc Description: PGP signature

Re: How do I have company display in admin drop down box?

2013-04-07 Thread Drew Ferguson
On Sun, 7 Apr 2013 18:15:32 -0700 (PDT) frocco <faro...@gmail.com> wrote: > Thanks Drew, > > I am trying your second suggestion. > > But it is complaining not found for UserProfile > > On Sunday, April 7, 2013 8:41:46 PM UTC-4, Drew Ferguson wrote: > > >

Re: How do I have company display in admin drop down box?

2013-04-07 Thread Drew Ferguson
On Sun, 7 Apr 2013 17:01:52 -0700 (PDT) frocco wrote: > I have a model that references User and on the admin page, it shows the > user name. > I have the User tied to a UserProfile model that has a field called > company. > > I want the drop down on my Pricing Model to show

Re: django templates and tex/latex

2013-03-13 Thread Drew Ferguson
On Wed, 13 Mar 2013 07:01:45 -0700 (PDT) Ken wrote: > I would like to write a tex/latex file with django tags in it. Load it > with the template loader and render it with a context. The problem is > that my tex/latex file has quite a few '{%' in them. They are > conventional