Re: Implementing multiple user types with Django 1.7

2015-06-05 Thread Daniel França
You can define different groups for each role and assign the users to the groups. Em sex, 5 de jun de 2015 às 11:24, Andreas Kuhne escreveu: > Hi Marcelle, > > You should not use the user profile solution anymore, because you can now > create a custom User model

Re: calling a view from a view doesnt clear the URL path

2015-05-29 Thread Daniel Roseman
You can redirect with whatever arguments you want, as long as the receiving URL accepts them. -- 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

calling a view from a view doesnt clear the URL path

2015-05-29 Thread Daniel Roseman
Why should it? The browser requested the original view, and the code returned a response to that request. The browser doesn't know or care that the process of constructing that response involved calling another view function. If you want to change the URL, instead of returning the result of

Re: Why the extra minute in PostgreSQL when using time zone info?

2015-05-28 Thread Daniel Grace
I used this function, seemed to tidy up the problem: from datetime import datetime from pytz import timezone def utcDtTm(self, dt_tm): tz = timezone('Europe/London') return tz.normalize(tz.localize(dt_tm)).astimezone(timezone('UTC')) -- You received this message because you

Why the extra minute in PostgreSQL when using time zone info?

2015-05-28 Thread Daniel Grace
I am creating some test data for a DateTimeField using the following function: def rndDtTm(self): uktz = timezone('Europe/London') year = 2015 month = 6 day = randint(1, 30) hour = randint(0, 23) minute = 30 * randint(0, 1) return

Re: How can this error be corrected?

2015-05-23 Thread Daniel Roseman
On Saturday, 23 May 2015 18:09:31 UTC+1, Preeti wrote: > > > ImportError: No module named 'django.contrib.staticfilesdjango' > > You're missing a comma after the 'staticfiles' entry in INSTALLED_APPS. -- DR. -- You received this message because you are subscribed to the Google Groups "Django

Re: Which is the best tutorial to learn django, djangobook.com or djangoproject.com?

2015-05-23 Thread Daniel Roseman
On Saturday, 23 May 2015 18:17:15 UTC+1, Preeti wrote: > > Which is the best tutorial to learn django, djangobook.com or > djangoproject.com? > Why do you even need to ask that question, given the large bold warning on the front page of the Django book site? -- DR. -- You received this

Re: Django 1.8 and MySQL, how to connect??

2015-05-20 Thread Daniel Roseman
On Wednesday, 20 May 2015 16:05:17 UTC+1, eduardo.c...@gmail.com wrote: > > Hi, I never used Django with MySQL data base before. Someone can tellme > how I can (if it's possible) connect my Django web site with a data base in > MySQL. I tryed to install "mysqlclient-1.3.6-cp27-none-win32.whl"

Re: Help with templating and databases.

2015-05-10 Thread Daniel Roseman
On Sunday, 10 May 2015 13:49:44 UTC+1, Reznov Ammar wrote: > > Hi guys :), > > I have a question about flask and databases in django. > There is nothing in this question related to Django. Why are you asking about Flask on a Django group? -- DR. -- You received this message because you are

Re: NoReverseMatch at /polls/1/results/

2015-05-09 Thread Daniel Roseman
On Saturday, 9 May 2015 05:05:00 UTC+1, James Schneider wrote: > > I agree that the typo is also an issue and should be fixed, but that > wouldn't result in the OP's error, since reverse() is complaining about a > 'detail' URL specifically. The typo would result in a similar error when > the

Re: Upload above apache web root?

2015-04-07 Thread Daniel Roseman
On Monday, 6 April 2015 22:38:36 UTC+1, Stephanie Socias wrote: > > I've implemented this same solution (using custom file storage and the > "upload_to" parameter) but now cannot get the uploaded files to display > from my template. I would normally use {{ STATIC_URL }} but, since I've now >

Re: FK relations hell : help with `_set` feature

2015-03-30 Thread Daniel Roseman
On Monday, 30 March 2015 13:04:00 UTC+1, François GUÉRIN wrote: > > Hi all, > > I'm using django for a couple of years, and I've a question about > relations in the ORM and templates. I massively use class-based generic > views. > > I' currently working with a model which have many other

Re: Global access to request.user

2015-03-27 Thread Daniel França
I don't understand how middlware or filter would help on those cases. Why not only pass the variable where it's needed? On Fri 27 Mar 2015 at 10:18 guettli wrote: > > > Am Donnerstag, 26. März 2015 15:52:07 UTC+1 schrieb Anderson Resende: >> >> You can use middlewares!!! It is

Re: QueryDict and its .dict() method - why does it do that?

2015-03-26 Thread Daniel Roseman
that format and does not do any specific conversion for it. The way to provide multiple values for an item in Django is by simply repeating the name: ?categories=1=3 which you can then get from the querydict via `request.getlist('categories') -- Daniel. -- You received this message becau

Why is list(Model.objects.all()) 10x slower against an Oracle database as compared to Postgres?

2015-03-24 Thread Daniel Porter
I have an application that we run locally against a postgres database but our dev/test/prod servers all run Oracle. The command list(Person.objects.all()) runs remarkably faster against my local Postgresql database. It takes at least 10x longer against an Oracle database. The thing is the

How to create a multi valued field in the model?

2015-03-23 Thread Daniel Grace
How to create a field with multiple values? For example an integer field that takes on particular values: state = models.IntegerField() ... where state=0 represents 'pending', state=1 represents 'accepted' and state=2 represents 'rejected'. Is it possible to put these values / constants into

Re: Why I don't access the {{ user }} variable in template?

2015-03-23 Thread Daniel Roseman
On Monday, 23 March 2015 14:16:00 UTC, Fellipe Henrique wrote: > > Hello, > > I have this settings.py [1], and my CustomUser [2] > > When I try to use in my template: > > {{ user_first_name }} > > don't show anything... What I miss in these code? > > You should show your view. Are you using a

Re: Data migration fails because contenttypes not yet ready

2015-03-19 Thread Daniel Hahler
help much by itself.) Thanks, Daniel. On 22.01.2015 14:23, Markus Holtermann wrote: > The sanest way to generate all ContentTypes and Permissions is to > migrate those two apps explicitly before migrating the remaining apps: > > $ python manage.py migrate contenttypes >

Re: fake button run a view and come back to the same page.

2015-03-10 Thread Daniel Roseman
he error. However you shouldn't really call one view from the other. If you do that, the browser will show the URL of the main view, which will be confusing. Instead, after running the task, *redirect* back to the main view: from django.shortcuts import redirect ... return redir

Re: RoR dev having trouble with finding best-packages for Django

2015-03-04 Thread Daniel França
... And you can compare On Wed 4 Mar 2015 at 20:33 Daniel França <daniel.fra...@gmail.com> wrote: > 4. Have you tried https://www.djangopackages.com/ ? > It has some sections with grids that shows several information about each > one > On Wed 4 Mar 2015 at 20:30 Avraham Serour

Re: RoR dev having trouble with finding best-packages for Django

2015-03-04 Thread Daniel França
4. Have you tried https://www.djangopackages.com/ ? It has some sections with grids that shows several information about each one On Wed 4 Mar 2015 at 20:30 Avraham Serour wrote: > 1 - built in > 2 - buit in > 3 - I like all-auth > 4 - pypi > 5 - go for python 3, unless you

Django 1.7 tutorial part 4, url

2015-03-04 Thread Daniel Altschuler
I ran into the following problem with the tutorial. When I'm at http://127.0.0.1:8000/polls/1/, I get the expected page: What's up? Not much The sky However when I try to vote I get the error Page not found (404)Request Method:POSTRequest URL: http://127.0.0.1:8000/polls/1/vote/ No

Writing your first Django app, part 5 Testing

2015-02-21 Thread Daniel Roseman
You're doing this in the shell, which uses your devv database in which you have obviously defined a poll already. The docs are taking about running this in a unit test, which would create a blank db without any polls. -- DR. -- You received this message because you are subscribed to the

Re: JSON Response

2015-02-20 Thread Daniel Roseman
What it sounds like actually is that the OP is not preventing the default action of the form, so the page is being submitted normally and displaying the response. -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from

RE: Necesito ayuda para poner a funcionar django el tutorial no loentiendo

2015-02-17 Thread Ricardo Daniel Quiroga
Primero creas un proyecto en un directorio con el comando (abri la consola seleciona el directorio donde trabajar y) ejecuta django-admin startproject miproyecto se crea una carpeta con lo necesario para tu proyecto django en la carpeta ejecutas python manage.py runserver y abres el navegador

Re: Implementing a grammar checker on the web

2015-02-16 Thread Ricardo Daniel Quiroga
security disable CORS, and add CSRF tokken verification.. if only going to implement the grammar interpreter is way too django uses something simpler like bottle or flask 2015-02-16 16:02 GMT-03:00 Ricardo Daniel Quiroga <l2radamant...@gmail.com>: > Hi > > html + textarea + jav

Re: Implementing a grammar checker on the web

2015-02-16 Thread Ricardo Daniel Quiroga
e.com/d/msgid/django-users/b7817512-cdad-460d-b0b9-a643e303d490%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/b7817512-cdad-460d-b0b9-a643e303d490%40googlegroups.com?utm_medium=email_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- R

Re: Proble understanding DetailView url doesn't match the slug

2015-02-14 Thread Daniel Roseman
On Saturday, 14 February 2015 04:28:40 UTC, inoyon artlover KLANGRAUSCH wrote: > > > urlpatterns = patterns('', > url(r'^admin/', include(admin.site.urls)), > url(r'^(?P)$',List.as_view()), > ) > That regex will never match anything. You need to give it some character classes to match:

Re: how to get a link to an absolute hyperlink

2015-02-13 Thread Daniel França
How's the hyperlink saved in the column? If it's a relative one this is what is going to happen, to change that you need an absolute link, i.e: http://google.com On Fri 13 Feb 2015 at 23:40 dk wrote: > this is my template > I do have this address >

Re: admin shows `model name` object instead of values for foreign key fields

2015-02-06 Thread Daniel Roseman
On Friday, 6 February 2015 20:30:02 UTC, larry@gmail.com wrote: > > I have a 1.7 app, and in admin when I reference a foreign key field, > instead of showing the values in the drop down, it shows "`model name` > object": > > > How can I get it show the values from the IPGroups table? I'm

Re: Strange error with reverse() when running tests

2015-02-06 Thread Daniel Roseman
On Thursday, 5 February 2015 12:34:51 UTC, João Sampaio wrote: > > There are 3 Python files attached. > > I have my URL file attached. I'm using django-rest-framework (in case you > are wondering what the routers are). When I use ./manage.py test with the > first file (file1.py), the tests

Re: Create User method for Custom Manager Django

2015-02-03 Thread Daniel Roseman
On Tuesday, 3 February 2015 06:19:47 UTC, Max Nathaniel Ho wrote: > > Hi all, > > I am following this tutorial ( > http://musings.tinbrain.net/blog/2014/sep/21/registration-django-easy-way/) > to create a user registration model in Django. > > I understand that the class UserManager is

Re: Reduce start up time for manage.py

2015-01-30 Thread Daniel Roseman
On Friday, 30 January 2015 14:01:17 UTC, Avraham Serour wrote: > > I believe putting imports inside functions would slow down execution, it > will make the import everytime the function is executed > > one could make something like a lazy import, but you would be trading slow > startup for slow

Re: Django + Bamboo

2015-01-26 Thread Daniel França
t; On Mon, Jan 26, 2015 at 5:42 PM, Daniel França <daniel.fra...@gmail.com> > wrote: > > I should try circleCI sometime, but that project was on a private > bitbucket > > repo, and circleCI didn't support this at that moment. > > > > Em Sun Jan 25 2015 at 2:27:

Re: Default auth with username but unique email, is it possible?

2015-01-26 Thread Daniel França
There's a solution referred here: http://stackoverflow.com/questions/1160030/how-to-make-email-field-unique-in-model-user-from-contrib-auth-in-django This solution basically override the *clean_email* method of the UserForm, and check if the email is unique, raising an error if it's not. But I

Re: Django + Bamboo

2015-01-26 Thread Daniel França
flexibility. > > Cal > > On Fri, Jan 23, 2015 at 6:46 PM, Daniel França <daniel.fra...@gmail.com> > wrote: > > I gave up Bamboo and start using codeship, 100 times easiet > > > > On Fri 23 Jan 2015 at 19:17 Gabriel Patiño <gepat...@gmail.com> wrote: >

Re: Django + Bamboo

2015-01-23 Thread Daniel França
I gave up Bamboo and start using codeship, 100 times easiet On Fri 23 Jan 2015 at 19:17 Gabriel Patiño <gepat...@gmail.com> wrote: > Daniel, > > Did you make it work? > > I have testing covered by bamboo, and I guess I'm creating the atfacts. > > From there, I don't k

Re: Data migration fails because contenttypes not yet ready

2015-01-22 Thread Daniel Hahler
at: https://github.com/alexhayes/django-migration-fixture/pull/2/files. What is the suggested way to have initial data with Django 1.7, given that initial_data is not used for apps with migrations, and RunPython has the above shortcomings? Thanks, Daniel. Am Dienstag, 21. Oktober 2014 19:4

Re: Why this code does not change users firstname and lastname?

2015-01-20 Thread Daniel Roseman
On Monday, 19 January 2015 12:39:38 UTC, joulumaa wrote: > > Why would it make sense to switch from different form type? > I use below form to get information that I like to save to user database? > Part of information I need ot update goes to Additional user info class, I > would like to stay in

Re: Any reliable django stripe payments library

2015-01-20 Thread Daniel Roseman
On Tuesday, 20 January 2015 04:39:47 UTC, Chen Xu wrote: > > Hi Everyone, > Is there any reliable django stripe payments library that does not require > to run a python manage.py syncdb? The reason I am asking is I am uaing > SQLAlchemy instead of its builtin ORM. > > Thanks > You don't need a

Re: Why this code does not change users firstname and lastname?

2015-01-19 Thread Daniel Roseman
On Monday, 19 January 2015 09:22:02 UTC, joulumaa wrote: > > I have created user earlier in code with email address and password. > Created users work fine. > Now in later phase I asked more information and would like to fill in > first_name and last_name. > Code shows old first_name and

Re: Newbie question: How to avoid a very long view function?

2015-01-19 Thread Daniel Roseman
On Monday, 19 January 2015 07:28:14 UTC, Cheng Guo wrote: > > Hello, > > I am new to Django and I have run into an issue with views.py. I > understand that there is a function behind each view. For a view that I am > currently writing, it accepts a file upload from user and stores the file >

Re: Newbie question: How to avoid a very long view function?

2015-01-19 Thread Daniel França
If the operations are model related, why don't move some of those functions to models.py. On Mon 19 Jan 2015 at 08:46 Mike Dewhirst wrote: > On 19/01/2015 6:28 PM, Cheng Guo wrote: > > Hello, > > > > I am new to Django and I have run into an issue with views.py. I > >

Re: is there a Django library for AJAX support

2015-01-05 Thread Daniel França
Have you tried Dajax/Dajaxice? http://www.dajaxproject.com/ Em Sun Jan 04 2015 at 2:15:16 PM, Krishnakant Mane escreveu: > Hello all, > I am realy impressed with the Django forms and some additional > enhancements with CrispyForms >

Re: Content using {% include %} not appearing on detailed page Django

2014-12-17 Thread Daniel Roseman
On Tuesday, 16 December 2014 19:27:41 UTC, Andrew Nguyen wrote: > > I'm having some problems getting some of my content to appear on my > detailed page view, which I have in two separate html files that are being > pulled in using {% include %}. Inside my two files, slider.htmland >

AttributeError raised when calling form's superclass clean() method, however the form doesn't get filled with errors

2014-12-15 Thread Daniel Roseman
You should show your view. You should not call clean directly: it is called automatically by is_valid. Also note that the keys of self.fields are strings, so neither your if nor your elif will ever execute. -- DR. -- You received this message because you are subscribed to the Google Groups

Re: Odd subform caching problem

2014-12-15 Thread Daniel Roseman
On Monday, 15 December 2014 11:04:13 UTC, Gerald Klein wrote: > > > > Daniel, > I didn't include any code as I didn't do anything unusual but if you think > that would help here it is.I was hoping that there was some ordinary > theoretical basis for this as I didn't do a

Re: Odd subform caching problem

2014-12-15 Thread Daniel Roseman
On Monday, 15 December 2014 00:53:05 UTC, Gerald Klein wrote: > > HI, I have a simple contact form with an address subform in the form of > "TabularInline" where you can add an arbitrary amount of addresses, after I > add a contact and an address and save, when I go to add a brand new contact >

Re: Beginner: What are the pitfalls of using an html form without using django forms? I.e. form.py

2014-12-09 Thread Daniel Roseman
On Tuesday, 9 December 2014 01:37:44 UTC, T Kwn wrote: > > I'm created a form where a user can add or remove other users from a > group. Because the number of available users is unknown beforehand, I > needed to create a checkbox form where the number of elements is dynamic. > However, I

Re: django ModelForm: error name 'self' is not defined

2014-12-09 Thread Daniel Roseman
On Tuesday, 9 December 2014 06:17:57 UTC, JAI PRAKASH SINGH wrote: > > hello all, > > > I am trying to make a registration form using User model so i am using > ModelForm > > as I am using bootstrap template i need to add some atribute like class > placeholder > > so i am using widget, am

Re: Changes to Model does not migrate to sqlite with Django 1.7?

2014-12-08 Thread Daniel Roseman
On Monday, 8 December 2014 11:07:11 UTC, Tobias Dacoir wrote: > So what am I doing wrong? I'm sure it's just my fault. At first I even > manually edited the migrations file in the past, for example when I changed > one of the fields to be mandatory instead of being optional. Old data in >

Re: Changes to Model does not migrate to sqlite with Django 1.7?

2014-12-08 Thread Daniel Roseman
On Monday, 8 December 2014 07:23:33 UTC, Tobias Dacoir wrote: > > Hi, > > I'm having trouble with changes to my Models. I just added a couple of new > fields to my existing models but when I run manage makemigrations it says: > No changes detected. When I try to log in to the admin panel it

Re: Using login_required decorator

2014-12-02 Thread Daniel Roseman
On Monday, 1 December 2014 23:59:00 UTC, Rootz wrote: > > I have a small project but I am trying to restrict access on some of the > django app urls to login users only. The problem is that when I hit a page > that requires login users I expected that they(users) are redirected to the > login

Re: Query set append

2014-12-02 Thread Daniel Roseman
On Monday, 1 December 2014 19:07:59 UTC, check@gmail.com wrote: > > Hello > > I am very new to python and Django . I have a basic question : > > 1. I have three database tables : Table A , Table B and Table C > 2. in my views.py i do : > >- tableB_QuerySet =

Re: Problem Making New Django project - please help

2014-12-02 Thread Daniel Roseman
On Tuesday, 2 December 2014 09:59:30 UTC, Shashwat singh wrote: > > > > PLEASE HELP WITH THIS > Nobody can possibly help with this. This is a random error message. What were you doing when you got it? What did you type at the command line? What code do you have already? And, please do not

Re: Django 1.7 tutorial: python manage.py migrate errors.

2014-11-20 Thread Daniel França
If you are using Django 1.7 why don't you use the built in migrations: https://docs.djangoproject.com/en/dev/topics/migrations/ On Fri 21 Nov 2014 at 05:19 Alvin Panugayan wrote: > I'm following the django tutorial online and I'm stuck on the migrate bit > (bottom of the

Re: default login template not found (registration/login.html)

2014-11-20 Thread Daniel Roseman
On Thursday, 20 November 2014 11:39:09 UTC, Yen wrote: > > Hi, > > I follow the doc to test the login system. I set a view function with > @login_required to show successful login message. > > In the html, a link like: > Login > > The URLconf under 'account' namespace contains one url: >

Re: Deploying Django project

2014-11-19 Thread Daniel Roseman
On Wednesday, 19 November 2014 10:22:25 UTC, termopro wrote: > > I have created a Django 1.7 project and would like to deploy it. I am > reading about how to do it right and i have some questions. > > If i understand correctly deployment should contain the following steps: > > 1) Initial remote

Re: What on earth is causing this "naive datetime" warning?

2014-11-19 Thread Daniel Grace
> > > But based on your traceback, it seems like at some point in the past > when you made a migration, the field might have had a default value > which was a naive datetime. Is that possible? > > It might be necessary to look through your existing migrations for this > app to find the

Re: What on earth is causing this "naive datetime" warning?

2014-11-19 Thread Daniel Grace
On Wednesday, 19 November 2014 15:11:27 UTC, Carl Meyer wrote: > > Hi Daniel, > > On 11/19/2014 08:07 AM, Daniel Grace wrote: > > I have already installed pytz (2014.17) and I have set USE_TZ=True. I > > don't use any naive datetimes in my application. This error is

Re: What on earth is causing this "naive datetime" warning?

2014-11-19 Thread Daniel Grace
I have already installed pytz (2014.17) and I have set USE_TZ=True. I don't use any naive datetimes in my application. This error is caused by something that the Django test command is doing automatically, if you look at the traceback you will see that it is something to do with migrations.

What on earth is causing this "naive datetime" warning?

2014-11-19 Thread Daniel Grace
Hi, Here is my model: class Flow(models.Model): ref = models.CharField(max_length=32) state = models.ForeignKey(State) flow_type = models.ForeignKey(Type) created = models.DateTimeField(db_index=True, auto_now_add=True) modified = models.DateTimeField(db_index=True,

Re: Extending, inheriting User Model or custom User Model?

2014-11-18 Thread Daniel Roseman
On Tuesday, 18 November 2014 15:04:19 UTC, Tobias Dacoir wrote: > > I'm trying to figure out how to create my Custom User Model. > > In the official docs I basically found two different strategies: Extending > User Model or Custom User Model: >

Warning / Error when testing with W flag

2014-11-18 Thread Daniel Grace
Hi, I get another warning / error with a test command as follows: >python -W error manage.py test flow Traceback (most recent call last): File "manage.py", line 8, in from django.core.management import execute_from_command_line File

Re: Runtime warning about a naive datetime when running the test command

2014-11-17 Thread Daniel Grace
On Monday, 17 November 2014 11:33:40 UTC, Bruno Barcarol Guimarães wrote: > > > $ python -W error manage.py test > > Hi Bruno, I get another warning / error with that command: >python -W error manage.py test flow Traceback (most recent call last): File "manage.py", line 8, in from

Re: Runtime warning about a naive datetime when running the test command

2014-11-16 Thread Daniel Grace
Is this a bug in the Django tester? -- 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

Re: Runtime warning about a naive datetime when running the test command

2014-11-16 Thread Daniel Grace
I understand the problem. Why doesn't the Django tester provide time zone aware date times? I know if I set "USE_TZ = False" the warnings will disappear. I was looking for another solution. Could I conditionally set "USE_TZ = False" only when testing? -- You received this message because

Re: Newbie question on serving static files from apache

2014-11-15 Thread Daniel Roseman
On Saturday, 15 November 2014 03:13:37 UTC, pythonista wrote: > > I am using django 1.7 and apache. > > I do not understand the instructions on the django tutorial. > > The files were delivered as expected in debug mode and locally from the > django web server. > > > Can someone provide me with a

Runtime warning about a naive datetime when running the test command

2014-11-15 Thread Daniel Grace
Hi, I get a runtime warning about a naive datetime when running the test command: >python manage.py test flow Creating test database for alias 'default'... C:\landy\lib\site-packages\django\db\models\fields\__init__.py:1278: RuntimeWarn ing: DateTimeField Flow.created received a naive datetime

Re: Database "postgres" does not exist error when running test command

2014-11-15 Thread Daniel Grace
On Saturday, 15 November 2014 00:58:32 UTC, Aliane Abdelouahab wrote: > > how about this > http://stackoverflow.com/a/19426770/861487 > > That link, what is that about? Anyway, I manually created a database called "postgres" and the error went away. -- You received this message because you are

Database "postgres" does not exist error when running test command

2014-11-14 Thread Daniel Grace
Hi, I get an error when running the test command: >python manage.py test flow Creating test database for alias 'default'... Traceback (most recent call last): File "C:\landy\lib\site-packages\django\db\backends\__init__.py", line 133, in ensure_connection self.connect() File

Admin Page Error

2014-11-13 Thread Daniel Pek
Hi, I'm new to Django, and I've been following the tutorial up until the 2nd part where it asks your to runserver, and then access the admin page. However, when i try to access 127.0.0.1:8000/admin/ i get this error: Here is the traceback: *Environment:* *Request Method: GET* *Request URL:

Re: Where does django store auth migrations?

2014-11-09 Thread Daniel Roseman
On Sunday, 9 November 2014 13:40:12 UTC, Dr Ed wrote: > > Okay, I'm confused. I found it, in here: > /Users//.virtualenvs//lib/python2.7/site- > packages/django/contrib/auth/migrations > > Why are app related migrations being stored in this location? > > Cheers, > > Ed > What? Migrations

Forms / pages and CSS like Django admin

2014-11-06 Thread Daniel Grace
Hi, OK, I know how to import CSS into a template. I would like to get forms / pages that look like those on Django admin site. What is a good strategy to achieve this? Copy the CSS? Looking at "inspect element" in Google Chrome I see that the styling on the forms in the Django admin site do

Re: How to restrict a class based view to one user group?

2014-11-06 Thread Daniel Grace
Thanks Bruno, I was decorating the 'post' method. I've got it right now. -- 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

Re: How to restrict a class based view to one user group?

2014-11-06 Thread Daniel Grace
I solved this using a "method_decorator" and "user_passes_test". -- 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

How to restrict a class based view to one user group?

2014-11-05 Thread Daniel Grace
Hi, Say I have a function as follows: def is_supervisor(user): return user.groups.filter(name='supervisor').exists() ...and a CBV for deleting records: class DeleteFlow(DeleteView): # etc... How can I restrict access to this view using the function? I understand that this may be

Re: How to handle exceptions in RequestContext?

2014-11-05 Thread Daniel Grace
I see where you are coming from Carl, thanks for the information. Do you have a suitable example of where one might put error handling in the view code? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop

How to handle exceptions if RequestContext fails?

2014-11-03 Thread Daniel Grace
Say I have the following code: logger = logging.getLogger(__name__) def render_error(scr_msg, err_msg, context): logger.debug(err_msg) return render_to_response('error.html', {'message': scr_msg}, context) ... def some_view(): try: context = RequestContext(request) ...

Re: How to generally handle exceptions in function based and class based views?

2014-11-03 Thread Daniel Grace
Thanks for the information Aliane and Steven, although I still don't know what to do when handling exceptions in say form_valid of a CBV. How to render the error in this case? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe

How to handle exceptions in RequestContext?

2014-11-03 Thread Daniel Grace
Say I have the following code: try: context_dict = {} context = RequestContext(request) ... except Exception as e: return render_to_response('error.html', context_dict, context) ...then how do I handle the exception without a context? Should I use the render function instead of

Re: How to generally handle exceptions in function based and class based views?

2014-11-03 Thread Daniel Grace
OK, say if I have a function based view then how do I handle the exception? try: context = RequestContext(request) context_dict = {} ... return render_to_response('my_file.html', context_dict, context) except Exception as e: # what to do here? What about class based views (in

Re: Model Manager QuerySet over-ride class not working as expected

2014-11-03 Thread Daniel Roseman
On Sunday, 2 November 2014 18:12:10 UTC, rmschne wrote: > > I've upgraded to Django 1.7.1 > > Following the upgrade most (haven't tested all, but for all tested this > true) the over-rided queryset is not functioning. > > when the code calls > qs=Member.Active_objects.all() > > then all

How to generally handle exceptions in function based and class based views?

2014-11-02 Thread Daniel Grace
Hi, I'm looking for some information / examples of how to generally handle exceptions and show a message to the user, in function based and class based views. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and

Calling a function for a url tag parameter

2014-10-30 Thread Daniel Grace
Hi, I am trying to use the url tag on some parameters, one of which needs to come from a function. For example as follows: {% with state_url=encode_url flow.state.description %} advance encode_url is defined as follows: @register.simple_tag def encode_url(link_text): return

Re: DB foreign key constraints : Django 1.7 regression ?

2014-10-30 Thread Daniel Roseman
On Wednesday, 29 October 2014 17:53:40 UTC, not...@gmail.com wrote: > > Hi ! > > Just tested the following: > >- create clean DB >- run syncdb >- compare obtained tables when using Django 1.6.8 and Django 1.7.1 > > My findings : > > In Django 1.7, some fields with models.ForeignKey no

Re: Rendering TabuarInline inside ModelAdmin without a foreign key

2014-10-29 Thread Daniel Roseman
On Wednesday, 29 October 2014 03:57:36 UTC, somecallitblues wrote: > > Hi list, > > I have a table of orders where one of the columns is a IntegerField > containing the id of a user who created the order. > > Since it's not a FK field django admin can't display these orders inline > inside the

What is the purpose of the include function?

2014-10-28 Thread Daniel Grace
Hi, In reference to urls.py what is the purpose of the include function? For example what is the difference between these two lines? url(r'^admin/', admin.site.urls), url(r'^admin/', include(admin.site.urls)), -- You received this message because you are subscribed to the Google Groups

Re: How to get rid of help text on a ModelForm?

2014-10-28 Thread Daniel Grace
Oops, too much indentation on the "def ..." line. -- 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

How to get rid of help text on a ModelForm?

2014-10-27 Thread Daniel Grace
Hi, I have a ModelForm for creating users, but it shows some help text "Required. 30 characters..." next to the username field. How do I get rid of this text? I tried the following, but the text remains on the form: class UserForm(forms.ModelForm): password =

Re: How to get related data on one to one field of a foreign key?

2014-10-25 Thread Daniel Grace
I just used the following: {{ log.user.userprofile.picture }} ... and I didn't need the select_related. -- 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

How to get related data on one to one field of a foreign key?

2014-10-25 Thread Daniel Roseman
That's what you've already done with your select_related call. What you should have asked is how you access that data in the template, and the answer is that you simply follow the relationship from your Log object: {% for log in logs %} {{ log.myfield }} {{ log.userprofile.picture }} {%

How to get related data on one to one field of a foreign key?

2014-10-25 Thread Daniel Grace
Hi, I have a log table with a foreign key to the user table, and a userprofile table with a one to one field to the user table: class Log(models.Model): user = models.ForeignKey(User) ... class UserProfile(models.Model): user = models.OneToOneField(User) picture =

Re: Problem with Pillow image resize and save

2014-10-25 Thread Daniel Grace
I need to include the following steps, but I don't know how: 1. copy the 'picture' file 2. resize it (the copy) 3. save it to the upload directory 4. store it in the 'thumb' field ... continue as before and save the 'profile'. -- You received this message because you are subscribed to the Google

Problem with Pillow image resize and save

2014-10-24 Thread Daniel Grace
Hi, I am trying to put together some code for resizing an image and storing the resized image on the database, but I am running into some problems having struggled to find some decent examples online. Here is what I have come up with so far, in the model: class UserProfile(models.Model):

Re: Is there a way to supress blank lines in the HTML?

2014-10-24 Thread Daniel Grace
Thanks people for the info. I was looking for a way to beautify the code, rather than for performance / compression. In particular I came across this when I implemented a template tag which, under certain circumstances returns an empty string. This works well but causes blank lines in the

Re: django-admin creates the views.py files in the wrong place!

2014-10-23 Thread Daniel Roseman
On Thursday, 23 October 2014 21:45:18 UTC+1, Aliane Abdelouahab wrote: > > Try the code like that, it will not work, > > now move the views.py from /rango to the initial directory where the is > the manage.py (/abdou) and it will work > Nope; that is the correct structure, as it is, with no need

Re: django-admin creates the views.py files in the wrong place!

2014-10-23 Thread Daniel Roseman
On Thursday, 23 October 2014 15:34:15 UTC+1, Aliane Abdelouahab wrote: > > i followed exactly by words the tutorial > > http://www.tangowithdjango.com/book17/chapters/setup.html#creating-a-django-application > and it seems the problem is about creating the double directory, and when > doing

Re: DateTimeField: Hide clock

2014-10-23 Thread Daniel Roseman
On Thursday, 23 October 2014 11:28:10 UTC+1, Oskar Lyrstrand wrote: > > models.py: > class Post(models.Model): > pub_date = models.DateTimeField > > template.html: > {{ post.pub_date }} > > output: > 23 october 2014 19:25 > > Problem is I dont want "19:25" to show. What can I do? > Why are

Re: django-admin creates the views.py files in the wrong place!

2014-10-23 Thread Daniel Roseman
On Wednesday, 22 October 2014 22:05:07 UTC+1, Aliane Abdelouahab wrote: > > Hi, > Django 1.7 when a beginner runs the first tutorial, he has to change the > views.py file outside the app to the whole project itself. > i found this, >

<    1   2   3   4   5   6   7   8   9   10   >