Re: Mysql connector python 3

2014-12-05 Thread Andreas Kuhne
n error. This suggests that > this is django related and not in the driver. > > That being said I am very curious how your test turns out. > > François > > > > On Dec 5, 2014, at 8:36 AM, Andreas Kuhne > wrote: > > > > François, > > > > T

Re: Evaluating variables in a blocktrans block within templates

2014-12-18 Thread Andreas Kuhne
Hi Frankline, You can only reference variables in the templates directly with the blocktrans tag. See https://docs.djangoproject.com/en/1.7/topics/i18n/translation/#blocktrans-template-tag. So you have to use the "with" statement on blocktrans to access properties of a class. Regards, Andréas 2

Re: Cache middleware problem

2014-12-18 Thread Andreas Kuhne
Add a never cache decorator to the view that does the deleting (and perhaps to the view that lists the items). Then you shouldn't have any problems and you can still use the cache middleware. See https://docs.djangoproject.com/en/1.6/topics/cache/ Regards, Andréas 2014-12-19 5:07 GMT+01:00 T Kw

Re: Advice about composing several templates

2015-01-04 Thread Andreas Kuhne
Hi Martin, You are doing it correctly if you use the {% include "foo/bar.html" %} method. I usually try to make my include templates as small as possible and use one or more on a page to try to be as DRY as possible. It tends to make better, smaller code and also it's easier when something chan

Re: what's different between {% static %} and {{ STATIC_URL}}

2015-01-06 Thread Andreas Kuhne
Hi, The difference is the age of the django project you are looking at. {% load staticfiles %} the {% static %} is the current way to load and use static files. It also has the option to do other things (like MD5 hashes for versions) automatically and should be used. If you create a project in th

Re: Django 1.7 problem

2015-01-07 Thread Andreas Kuhne
please help me. > > Regards, > Sarfaraz Ahmed > > On Thursday, 4 December 2014 15:21:59 UTC+5:30, Andréas Kühne wrote: >> >> 2014-12-04 1:39 GMT+01:00 Carl Meyer : >> >>> Hi Andreas, >>> >>> On 12/03/2014 01:34 PM, Andreas Kuhne wro

Re: Django 1.7 problem

2015-01-07 Thread Andreas Kuhne
nversation I >>> am not able to get solution of this issue. Could please help me. >>> >>> Regards, >>> Sarfaraz Ahmed >>> >>> On Thursday, 4 December 2014 15:21:59 UTC+5:30, Andréas Kühne wrote: >>>> >>>> 2014-12-04 1:39 GMT

Problem with django-dynamodb2-sessions

2013-12-27 Thread Andreas Kuhne
Hi all, We have just migrated our website to Amazon AWS. It works perfectly except for one thing. We are using the django-dynamodb2-sessions plugin to manage our sessions. For most of the time it works ok, but then we get errors with the following error in them: ConditionalCheckFailedException:

Re: ec2 using bitnami djangostack: application never loads; browser just hangs

2014-01-22 Thread Andreas Kuhne
1. Have you checked all of the access logs and error logs when the app is started? Is your request getting served by modwsgi, or is it stuck in apache? 2. Start the application with DEBUG=True in settings, to see if you get any information from the app. Thats where I'd start. Regards, Andréas Kü

Re: Django with Ubuntu Cloud

2014-01-31 Thread Andreas Kuhne
Hi, Why not use S3 for storage? Then you can still keep heroku and don't have to make vast changes to your setup? Regards, Andréas 2014-01-31 Vibhu Rishi : > Hi, > > Has anyone setup Django with Ubuntu Cloud ? > > My primary interest is how to setup the media server. I am primarily using > He

Re: Template/Form Errors and DynaTree.js

2014-02-27 Thread Andreas Kuhne
Hi Timothy, What you probably have to do is submit the form in a ajax call via jquery for example. https://api.jquery.com/jQuery.ajax/ You create a request via the ajax method in jquery and then add a success and error handler. They only have to update the div you want to replace: $("#div_id").ht

Re: Template/Form Errors and DynaTree.js

2014-02-27 Thread Andreas Kuhne
tion that you want in the div, all you have to do is get in into the div :-) Regards, Andréas 2014-02-27 14:06 GMT+01:00 Timothy W. Cook : > Hi Andreas, > > Thanks for the reply. > > > On Thu, Feb 27, 2014 at 9:42 AM, Andreas Kuhne > wrote: > >> Hi Timothy, >> >&g

Re: Template/Form Errors and DynaTree.js

2014-02-28 Thread Andreas Kuhne
rown); } }); } This way it is pretty generic as long as the "old_div_content" div id stays the same. Regards, Andréas Med vänliga hälsningar, Andréas Kühne Software Development Manager Suitopia Scandinavia AB 2014-02-28 15:48 GMT+01:00 Timothy W. Cook : > > On Thu, Feb 27, 2014 at

Re: memcached and redis

2014-03-01 Thread Andreas Kuhne
Hi, In response to your question about memcache and redis, they are extremely useful, if you use them correctly. For example if you are generating a query to your database that takes 1 second to finish, and you cache the results in memcache or redis, then you would be able to get the second reques

Re: memcached and redis

2014-03-01 Thread Andreas Kuhne
hed and redis please. > > > On Sun, Mar 2, 2014 at 1:45 AM, Andreas Kuhne > wrote: > >> Hi again, >> >> Do you mean use cases with redis and memcache or with S3? >> >> Regards, >> >> Andréas >> >> 2014-03-01 21:00 GMT+01:00 Robin

Re: memcached and redis

2014-03-02 Thread Andreas Kuhne
able()* and > *putifuntouched() > *like memcache, I think these are for consistency? > > > On Sun, Mar 2, 2014 at 2:09 AM, Andreas Kuhne > wrote: > >> Ok, >> >> Redis and Memcache really solve the same problems. The main difference is >> that you can u

Re: CSRF problem (403 FORBIDDEN)

2014-03-17 Thread Andreas Kuhne
2014-03-17 22:15 GMT+07:00 Sergiy Khohlov : > I'm proposing to update your views and templates for supporting csrf > Many thanks, > > Serge > > > +380 636150445 > skype: skhohlov > > > On Mon, Mar 17, 2014 at 5:05 PM, Gkpetrak wrote: > > Hello, > > > > I'm developing an app using django and O

Django admin inline forms

2014-03-26 Thread Andreas Kuhne
Hi all, I have 2 models that look something like this: class Address(models.Model): address_row1 = models.CharField(max_length=200, null=True, blank=True) address_row2 = models.CharField(max_length=200, null=True, blank=True) postal_code = models.CharField(max_length=30, null=True, bl

django-dbgettext and python 3

2014-04-02 Thread Andreas Kuhne
Hi all, I am in the process of rewriting our e-commerce site. In doing so we also thought that we should upgrade all of our packages to the latest versions (django 1.6, python 3 and so on). I have been doing alot of troubleshooting just getting our site to work and trying to use all of the functio

Re: I can't connect Django with SQL Anywhere 11 Database

2014-04-14 Thread Andreas Kuhne
Just a wild guess here. Checking your databases dictionary, you have set : 'HOST': 'django'. I am guessing your server is running on the same computer as your django server? In that case you should change the line to : 'HOST': 'localhost', or just delete the line entirely (default is localhost). I

Re: I can't connect Django with SQL Anywhere 11 Database

2014-04-15 Thread Andreas Kuhne
Hi again, Unfortunately I don't have any experience with sqlanywhere. However, I googled and came up with the following information: https://code.google.com/p/sqlany-django/wiki/GettingStarted. In your databases dict you specify 'OPTIONS': {'eng': '2638'}, I think that should be : 'OPTIONS': {'eng'

Re: Bilingual Content Creation

2014-04-23 Thread Andreas Kuhne
That really depends on what you want to do with it. We are using both dbgettext with Rosetta and transmeta in our application. Transmeta creates extra database fields with _en and _es (or other language-codes). You then edit the fields in django admin, like regular fields. It is an easy way to cr

Re: How can I set up Debian x86_64 so a Django project sees django.contrib.staticfiles?

2014-04-24 Thread Andreas Kuhne
First of all are you using a virtual environment for running the django project in? If not, I would strongly recommend that you check how to use and implement virtualenv. The problem with running python on a debian based system otherwise is that you can get issues with different packages in differe

Re: IndentationError :Unexpected Indent

2014-04-28 Thread Andreas Kuhne
2014-04-28 7:55 GMT+02:00 Kelvin Mwangi : > I have been following up on the tutorial on Python version 1.6 and I got > stuck at an indentation error I can't seem to debug. Its under the first > tutorial of creating Django application and I modified my polls\models.py > file to look like this; > >

Saving files to s3 with python 3.3

2014-04-30 Thread Andreas Kuhne
Hi all, We are trying to rewrite our webplattform because it has been developed since 2009 and is more or less a patchwork of fixes. In doing so, we want to be able to use the latest versions of all plugins and frameworks, so we are looking at: Django 1.6 (or 1.7 if it is released before Septembe

Re: I can't run django server nor activate the virtualenv

2014-05-02 Thread Andreas Kuhne
You are not running your commands in a virtual environment. You can't run pip outside the virtual environment because that requires root permissions. If you type "sudo pip install -r requirements", it will install the files, but I'm not sure you want to do that. Every shell you open, you have to r

Re: I can't run django server nor activate the virtualenv

2014-05-02 Thread Andreas Kuhne
You can always see if your shell is running with a virtual environment, by the (env) in front of the prompt. If you check your last screenshot, you will see that you are running in a virtualenvironment there. Regards, Andréas 2014-05-02 15:48 GMT+02:00 Andreas Kuhne : > You are not runn

Re: website statistics

2014-05-21 Thread Andreas Kuhne
I would use google analytics for that. Any reason why you are not using google analytics? Regards, Andréas 2014-05-21 20:15 GMT+02:00 chansonsyiddish : > Thanks for your answer, Avraham, I will look into the logfile to see if I > can use that. I don't need any "pretty" display, just plain visi

Re: CSRF Token Help

2014-06-15 Thread Andreas Kuhne
Hi Jesse, I can't remember where I saw it, but I found that the csrf token is added as a cookie to the response, so it is always present on each response. In my code I have an event handler (I'm using jquery to post) that looks like the following: $(document).ajaxSend(function (event, jqxhr,

Re: CSRF Token Help

2014-06-16 Thread Andreas Kuhne
The cookie is set via the django.middleware.csrf.CsrfViewMiddleware middleware. It does all of the handling for csrf tokens. It has to be included in your middleware classes. Also the order of the middleware classes are important (at least some of my middleware didn't work if it wasn't in the corre

Re: where is base_site.html

2014-06-30 Thread Andreas Kuhne
Hi Dariusz, You will have to find where you have created your virtualenv. In the virtualenv folder you should have a lib/python2.7/site-packages folder. In that folder, you will find all of the libraries you have installed via pip. It is good to know where that folder is, so you can check the sour

Re: Testing if a view have an html element with at least one attribute

2016-07-31 Thread Andreas Kuhne
2016-07-31 12:38 GMT+02:00 ludovic coues : > Hello, > > I am trying to test if a view is displaying a form with an input > element with name=username. > > Currently, I have tried a lot of variation around > `self.assertContains( response, "", > html=True)` but none work. > I assume that doesn't wo

Re: Testing if a view have an html element with at least one attribute

2016-07-31 Thread Andreas Kuhne
ml=True) > > I could copy/past the input directly in my test but if the maxlength > or class attribute change, the test will break. Taking the input > directly from the django form will test if the django form is rendered > in the view, not if the view is displaying a suitable form. >

Re: Testing if a view have an html element with at least one attribute

2016-07-31 Thread Andreas Kuhne
plication. > > 2016-07-31 14:46 GMT+02:00 Andreas Kuhne : > > 2016-07-31 13:56 GMT+02:00 ludovic coues : > >> > >> First, thanks for the suggestion. > >> > >> I just tried that, didn't work. > >> Here is the test file I us

Re: Testing if a view have an html element with at least one attribute

2016-07-31 Thread Andreas Kuhne
code, 200) > doc = etree.HTML(response.content) > > self.assertEqual(len(doc.findall('.//input[@name="username"]')), 1) > > > > 2016-07-31 17:46 GMT+02:00 Andreas Kuhne : > > 2016-07-31 15:59 GMT+02:00 ludovic coues : > >> > >> Oh, sorry.

Re: Please another problem

2016-08-08 Thread Andreas Kuhne
Hi Timothy, There aren't any errors in the trace you are showing. There is a missing file however (404 error), that is the favicon.ico, which browsers try to fetch from the root URL if nothing is set in your html header. To resolve that, all you have to do is add a link to a favicon file. Check th

Re: Launching websites

2016-08-09 Thread Andreas Kuhne
Hi, I don't know what level you are interested in, but I think this course will be interesting: https://www.kickstarter.com/projects/mikeckennedy/python-for-entrepreneurs-video-course It'll probably contain some of the items you are requesting. Regards, Andréas 2016-08-09 12:59 GMT+02:00 : >

Re: Clarifying Project vs Apps

2016-08-24 Thread Andreas Kuhne
2016-08-24 19:12 GMT+02:00 Lee Hinde : > On Wed, Aug 24, 2016 at 9:23 AM, Rich Shepard > wrote: > >> On Wed, 24 Aug 2016, Lee Hinde wrote: >> >> My tuppence. >>> >> >> Lee, >> >> Before or after Brexit? The value might change. :-) >> >> No, an app is a logical grouping of objects/tables. You mi

Re: Running Django Project Locally

2016-08-24 Thread Andreas Kuhne
2016-08-24 17:54 GMT+02:00 Michael Macdonald : > Interestingly enough, just this morning, after a couple times being bitten > with differences in behavior between use of runserver in development vs. > wsgi in production, I've decided to do all development on my local machine > under lighttpd. In

Re: Clarifying Project vs Apps

2016-08-24 Thread Andreas Kuhne
2016-08-24 21:09 GMT+02:00 Andromeda Yelton : > My feeling/practice on apps is: each app is a one-word informative noun. > It contains the models that are logically grouped under that noun (and the > views, urls, etc required to interact with those models on the front end). > > If there isn't a si

Re: Maintaining old django code

2016-09-06 Thread Andreas Kuhne
2016-09-06 10:57 GMT+02:00 Erik Cederstrand : > > > Den 6. sep. 2016 kl. 10.20 skrev Lekan Wahab : > > > > Good morning guys. > > I was handed a project at work which was written as far back as 2012. > > Quiet a lot of the packages used in the project are either no longer > being maintained. > > R

Re: Maintaining old django code

2016-09-06 Thread Andreas Kuhne
2016-09-06 16:07 GMT+02:00 Andromeda Yelton : > +1 to Erik's plan. > > In deciding whether to stop at 1.8 or go all the way to 1.10 I'd ask > myself the following questions: > > * Are there features from 1.10 (that aren't in 1.8) that I'd really like > to have? (channels is the big one for me) > >

Re: A public cloud with django backend

2016-09-16 Thread Andreas Kuhne
2016-09-15 9:21 GMT+02:00 Rahul Doshi : > Hi ,I want to setup a dropbox like server with django. So far i have > achieved uploading files onto a location .I want these files to show up on > browser which they do(while saving file to the location I indexed an entry > in the Db so i just print the

Re: django group authentication

2016-09-20 Thread Andreas Kuhne
2016-09-20 1:36 GMT+02:00 sum abiut : > Hi, > i am building an app using django, on login i want django to check for > users in a group before login users. > For example, i want to redirect users from a group to page when they > login. > > please advise the best way to approached this. > > cheers

Re: can't create django project using Windows command prompt!

2016-10-05 Thread Andreas Kuhne
Hi, First make sure that you have a valid virtual environment - it's the easiest way to run python code. When that is working, you can just write : "python django-admin.py startproject mySite" - your problem is that .py files have been associated with notepad ++, and therefore it opens the file t

Re: Django FORM for India Postal Address

2016-11-06 Thread Andreas Kuhne
Hi, There is a plugin called django-smart-selects, that enables you to get information from the server based on information in a select field. You could try that? The form_valid() method and clean methods where you can VALIDATE such information is only called when posting the form (as you have fou

Re: External access

2016-11-07 Thread Andreas Kuhne
Do you have "ALLOWED_HOSTS" correclty configured in django settings? Regards, Andréas 2016-11-07 14:48 GMT+01:00 bob gailer : > I am running a the django server, listening at port 8000. I can access the > server using localhost. When I try using my external ip address I get "The > server at 24.

Problem with redis on AWS and transition to dynamodb

2016-12-06 Thread Andreas Kuhne
Hi, We are having a strange problem with our redis elasticache instances on AWS. We have our sessions stored in a redis cluster on AWS. Our webservers sometimes get a: * Error connecting to redis.example.com:6379. timed out * Timeout reading from socket (I haven't included our real domain for the

Re: Problem with redis on AWS and transition to dynamodb

2016-12-06 Thread Andreas Kuhne
project and it works fine. Here're the docs about > session engines: https://docs.djangoproject.com/en/1.10/ > topics/http/sessions/#using-cached-sessions > > On 6 Dec 2016, at 15:55, Andreas Kuhne wrote: > > Hi, > > We are having a strange problem with our redis el

Re: Problem with redis on AWS and transition to dynamodb

2016-12-06 Thread Andreas Kuhne
k something is proxying your request to redis.example.com and > this something is what gives you timeouts and connection errors. > > On 6 Dec 2016, at 17:41, Andreas Kuhne wrote: > > Hi, > > Thanks for you answer - I don't think the problem is with django either, > but

Re: Problem in django tutorial 5 , 1044 Access denied for user @'localhost' database error

2017-01-12 Thread Andreas Kuhne
You need to have the database create permission as well. Otherwise django can't recreate the database. What happens when you start the tests is that the database is dropped and recreated each time. Regards, Andréas 2017-01-12 10:24 GMT+01:00 Shashank Yadav : > Hello, > > I am working on tutoria

Re: Am I stupid or is there an essential error in Django 1.10 Docs?

2017-01-16 Thread Andreas Kuhne
What does the project structure look like? Is Stranvr the name of the project? It looks to me like you haven't created an app - or have you called your app "db_testing" and the project "Stranvr"? Because you first have to create you project with "django-admin.py startproject " and then within th

Re: Django and timezones ... how to initialize a field to now() in the in clients time zone?

2017-01-22 Thread Andreas Kuhne
Hi, The problem here is as you say, your server doesn't know the clients timezone. This isn't trivial to find out either. I can help you with some pointers though: 1. ALWAYS save all times in the database in UTC. ALWAYS - never diviate from this - one exception - if you are running a server that w

Re: Moving from django 1.3 to 1.9

2017-01-27 Thread Andreas Kuhne
I second this. Having moved from 1.3 to 1.9 in stages - I think this is the best way to do it. Upgrade one minor version at a time and it will probably be easiest. Regards, Andréas 2017-01-27 10:55 GMT+01:00 ludovic coues : > You might have an easier time upgrading from one version to the next.

Re: good doc and example on how to use bootstrap with DJango

2017-02-01 Thread Andreas Kuhne
Hi, You will have to follow the following information: https://docs.djangoproject.com/en/1.10/howto/static-files/ Make sure that the css files and js files are in the static directory. Then you can use {% static "css/bootstrap.min.css" %} for the filepath to the static files. The static files sho

Re: good doc and example on how to use bootstrap with DJango

2017-02-01 Thread Andreas Kuhne
The setting you have to specify are: STATIC_URL and STATIC_ROOT. STATIC_URL is the url base for creating paths for the webserver to the static files. Usually you just leave this at '/static/' - however you could also set this to a completely different domain (if for example you were serving stati

Re: good doc and example on how to use bootstrap with DJango

2017-02-01 Thread Andreas Kuhne
Great to see that I could be of help :-) Regards, Andréas 2017-02-01 21:35 GMT+01:00 Thames Khi : > Thank you so much, you are a legend, sir! I can now continue my learning > and combine my python database code with django. > > I am very grateful, thank you for taking the time to explain this t

Re: good 404 vs bad 404

2017-03-01 Thread Andreas Kuhne
I think you should always report a 404 as a 404 regardless of the situation. The application shouldn't have to know if it is a valid 404 or an "invalid" - because from the applications point of view, the page (or item) couldn't be found. Just my 2 cents. Regards, Andréas 2017-03-01 10:25 GMT+0

Re: django angular

2017-03-03 Thread Andreas Kuhne
Hi Mohamed, I would start by looking at some of the tutorials for django rest framework - because you will need to have a format like json to communicate from angular to the database. Checkout : http://www.django-rest-framework.org/ I would also recommend looking at the tutorials on angular : htt

Re: Django clustering - How to manage Image uploading

2015-09-09 Thread Andreas Kuhne
I would use something like Amazon S3 to store the images. I think that's the easiest way to do it. If you use the django-storages plugin, you can configure your servers to talk to S3 just like they were using local storage. You will never have any problems with diskspace and all of your servers wil

Re: Why should we use Django Rest Framework?

2015-10-02 Thread Andreas Kuhne
Hi Robert, The main reason for using django rest framework is if you need a backend to communicate with one or more rich frontends. An example could be if you have a website running django and you want to create a mobile application for iOS or android. You can then create an API that will communic

Re: Method call at end of Django session

2015-10-02 Thread Andreas Kuhne
Hi, I don't think you can reliably do that. Django never knows when the user closes his browser window. Because a session is stateless (there is only a connection to the server when it responds to a request). However you could do this via a bit of ajax or a pretty unreliable javascript event. Wha

Re: Method call at end of Django session

2015-10-03 Thread Andreas Kuhne
Hi again, What I would do is create a django management command (see https://docs.djangoproject.com/en/1.8/howto/custom-management-commands/) and then use cron to call it a regular intervals (5-10 minute intervals for example). Another way to do it would be to use celery, which is a delayed job w

Re: Logout implementation Django

2015-10-14 Thread Andreas Kuhne
Hi, You should be able to access the website without logging in? Or do you mean that the user has access to protected pages? If you have added the login_required decorator ( https://docs.djangoproject.com/en/1.8/topics/auth/default/#the-login-required-decorator) on your view functions that should

Re: Starting a .py file from a Button in my Template

2015-10-19 Thread Andreas Kuhne
Hi, You can't do it that way. If you want to run a python file on the server, you can do it in several ways: 1. Create a view that runs all the code inside the refresh.py file. This could take an amount of time, so I wouldn't do it that way. 2. Create a view that calls a celery task to run the re

Re: Translation is not working for Template even though po and mo files are created

2015-10-30 Thread Andreas Kuhne
Hi, Have you made sure that you have activated the languages you want in your application? Also, how is the current language being selected? See: https://docs.djangoproject.com/en/1.8/topics/i18n/translation/#how-django-discovers-language-preference Regards, Andréas 2015-10-30 7:45 GMT+01:00 Se

Re: Translation is not working on ModelForm when widget is specified for form field

2015-10-30 Thread Andreas Kuhne
Hi, The problem is that you are redifining the fields, the fields then don't get any labels (because you haven't specified them). You can achieve what you want in two ways: Either add the following to your modelform: start_time = forms.DateTimeField(label=_("start time"), widget=SplitDateTimeWidg

Re: Translation is not working for Template even though po and mo files are created

2015-10-30 Thread Andreas Kuhne
Hmmm I'm a bit at a loss here. But does Django know where to find the .mo files? Is it only your template that isn't getting translated, because you said that the form itself is? Regards, Andréas 2015-10-30 12:45 GMT+01:00 Sean Xu : > Now I have corrected the orders of each Middleware clas

Re: Django templates

2015-10-31 Thread Andreas Kuhne
Hi, There aren't any specific templates for windows or any other operating system. Django runs on a webserver and is compatible regardless of OS. I would recommend that you look at the tutorial and see how to get started: https://docs.djangoproject.com/en/1.8/intro/tutorial01/ Regards, Andréas

Re: Translation is not working for Template even though po and mo files are created

2015-11-01 Thread Andreas Kuhne
Hi Sean, That's interesting. You shouldn't have to add the locale paths explicitly. Good that it's wokring, but as long as you put the locale files in a directory named locale under each app and also under the project, it should just work (as long as all apps are included in the config). Just chec

Re: Translation is not working for Template even though po and mo files are created

2015-11-02 Thread Andreas Kuhne
Hi, I am unsure about the project level translations path, if they should be found as well. I have added them manually to settings, but only that path. Application paths get imported automatically. Regards, Andréas 2015-11-02 6:38 GMT+01:00 Sean Xu : > Sorry, > > ~/django-swingtime/django-swin

Django admin multipleselect filter

2015-11-02 Thread Andreas Kuhne
Hi all, I have a django site that displays the change list for a class called Order. The Order class has a property called status. I would like to be able to filter the change list by multiple statuses. So a user should be able to check several statuses and show all orders that have one of the che

Re: return values from static files to django admin

2015-11-02 Thread Andreas Kuhne
Hi, What you are suggesting doesn't work. You can't communicate with the django backend via javascript if you don't use a lot of ajax requests. I would check django-smart-selects and see if you could use that? Regards, Andréas 2015-11-02 15:57 GMT+01:00 dc : > Any lead will be extremely helpfu

Re: return values from static files to django admin

2015-11-02 Thread Andreas Kuhne
Hi, Yes you could just populate the dropdown list with javascript. Regards, Andréas 2015-11-02 17:27 GMT+01:00 dc : > Thanks a lot. Let me look into it. > > Is there any other way I can populate my choice list with user input? > > On Monday, November 2, 2015 at 10:19:22 AM UTC-5, Andréas Kühne

Re: Django admin multipleselect filter

2015-11-04 Thread Andreas Kuhne
HI! Thanks for the pointers. I actually was able to solve it by myself. What I did was create a multichoice checkbox field in a form. Then I used a bit of javascript just to reformat the parameters in a way that I wanted then. Works very good actually. :-) Med vänliga hälsningar, Andréas Kühne S

Re: django admin - You don't have permission to edit anything

2015-11-05 Thread Andreas Kuhne
Hi, You don't have permissions to edit anything, because you haven't created a superuser. The superuser in django has a property that is called "is_superuser" and should be set to True. If you don't have that property (and your createsuperuser sets some other property), you will have the same rig

Re: django admin - You don't have permission to edit anything

2015-11-06 Thread Andreas Kuhne
r models or in the User manager. Therefore, I > just copied the example from the django doc and tried running it. After > creating the superuser, I can edit the models. I have no Idea what I am > mission now. > > > On Fri, Nov 6, 2015 at 11:35 AM, Andreas Kuhne > wrote: > &

Re: Where does the static files reside

2015-11-08 Thread Andreas Kuhne
Hi Gary, You can certainly setup a global static files location. All you need to do is add a path to STATICFILES_DIRS in your settings file. However, that is not really necessary. All files that are in a static directory in one app are accessible in other apps. You can create an app that contains

Re: Just starting, cannot create Password for superuser

2015-11-11 Thread Andreas Kuhne
Hi Raja, What do you mean it doesn't allow you to type anything at all? It shouldn't echo anything. The prompt doesn't move when inputing the password and that's the way it should be. Try to add a password and the press enter. You should then be prompted to re-enter the password. Without echoing a

Re: How to get logged username in template

2015-11-12 Thread Andreas Kuhne
Hi, First of all, you are using request.user.username and not username in your template. If you want the username to be accessed via the "username" variable. You should write this in your view: def profile(request): return render_to_response('accounts/profile.html', {'username': request.user.

Re: Custom user model password is not hashed

2015-11-12 Thread Andreas Kuhne
As aRkadeFR says, you seam to have mixed code there The row: user.set_password(self.cleaned_data["password"]) is taken from a form somewhere and won't work. It should instead be : user.set_password(password) I suppose the password is going through to the create method via the kwargs argument

Re: Custom user model password is not hashed

2015-11-12 Thread Andreas Kuhne
etting the same result. > > On Thu, Nov 12, 2015 at 8:57 PM, Andreas Kuhne > wrote: > >> As aRkadeFR says, you seam to have mixed code there >> >> The row: >> user.set_password(self.cleaned_data["password"]) >> >> is taken from a

Re: How to search by country using django-countries?

2015-11-23 Thread Andreas Kuhne
HI Jorge, What do you mean you want to search by country? I think the easiest way would be to add a filter for the country field in admin. The thing is with the countries plugin, you only save the 2-letter version of the country (for example GB for Great Britain, ES for Spain, SE for Sweden and s

Re: update Django

2015-12-15 Thread Andreas Kuhne
Hi, As previously stated. Give us some more details and we can probably help you. I have done upgrades from 1.3 to 1.8 and 1.5 to 1.8 in different projects, we can probably help if we get some more information :-) Regards, Andréas 2015-12-15 16:55 GMT+01:00 Ovnicraft : > > > On Tue, Dec 15, 20

Re: Admin debugging delete

2015-12-18 Thread Andreas Kuhne
Hi, Are you working in django admin and using the delete checkbox to delete a child record? If so, it is not a javascript event, but it is handled by when you save to the parents form (it's a formset with child forms). I would follow where the django code stops executing. Regards, Andréas 2015

Re: Guidelines For A Newbie

2016-01-04 Thread Andreas Kuhne
Hi Jay, What I would recommend is that you go throught the django tutorials and just "do" the js parts regardless of what they say - you will then get a bit of understanding for the django MVC concept and also how the django backend works and what goes where in django. The other issues you are ha

Re: possible to setup old project (different dependencies) as a library ?

2016-01-04 Thread Andreas Kuhne
As a person who has done this on 2 separate occasions, I also think that the best way would be to start a rewrite and upgrade ASAP. However, having said that. I think you COULD be able to run the old code in a django 1.9 environment, by checking for different methods. For example in django 1.4 a m

Re: Drop down dependent on two other form fields

2016-01-04 Thread Andreas Kuhne
Hi Arindam, I didn't find any really good solution, however, googling for "django dropdown dynamic", should point you in the right direction. Hope that helps. Regards, Andréas 2016-01-05 7:07 GMT+01:00 Arindam sarkar : > Hello, > In my project I have a from in which there is three drop down.

Re: Execute code which runs on the database only when the server is running - and doesn't need users to view pages.

2016-01-11 Thread Andreas Kuhne
Hi, Wouldn't it be possible to use celery and tasks for this purpose? http://www.celeryproject.org/ You could have it running all the time and have a flag in the database for when the server is running? Regards, Andréas 2016-01-11 9:59 GMT+01:00 Tony Flury : > I have a small background task (

Re: Execute code which runs on the database only when the server is running - and doesn't need users to view pages.

2016-01-11 Thread Andreas Kuhne
Oh ok, Sorry I misunderstood your problem. How about running the celery task and then checking if http://localhost is up? Regards, Andréas 2016-01-11 13:31 GMT+01:00 Tony Flury : > Andreas, > > Thanks for your answer. Certainly it looks like running celery might > alleviate the issue with thre

Re: Django Admin

2016-01-18 Thread Andreas Kuhne
Hi Rafael, I would use a plugin for django admin that creates an autocomplete field (django-selectable works). Then when the user chooses something in the autocomplete list, I would populate the other fields via ajax with the values that you need. That way you don'ẗ need a foreign key field (even

Re: django admin objectaction confirmation

2016-01-18 Thread Andreas Kuhne
Hi, Check how actions work in the admin interface. You should be able to create something that works the same by clicking on a button. See here: https://docs.djangoproject.com/en/1.9/ref/contrib/admin/actions/ The main point is that if you do a http get, you should show the confirmation page, and

Re: How to update a live / deployed Django project?

2016-02-10 Thread Andreas Kuhne
Hi, What I tend to do when deploying is: 1. Create a fabric script that contains a reference to the server that should be updated (defaults to dev server). 2. Use git archive to zip the contents of a git tag to a local file. 3. Upload the file to the server 4. Stop the uwsgi process 5. Update file

Re: How to update a live / deployed Django project?

2016-02-10 Thread Andreas Kuhne
The thing is, you should be able to catch those issues when migrating locally on you development machines. In that case, just fix the migration and then it should work perfectly in production. You can always add certain values in the migration scripts themselves. Regards, Andréas 2016-02-10 14:5

Re: Django Multiple User Login

2016-02-11 Thread Andreas Kuhne
You can't? Not without logging out the previous user. The session itself is used to contain a reference to the current user. You can only have one session to a certain domain (for example www.example.com and app.example.com are 2 different domains). The only way for the other user to login is to

Re: Bug or unaccepted behaviour

2016-02-14 Thread Andreas Kuhne
Hi, Would need to see more of you code to understand exactly what you want to do. Regarding your question. It doesn't make sense, but I think you are asking the difference between "u.theme_id = self.id" and "u.theme = self"? I don't know exactly the difference, but I do know that you shouldn't ha

Re: Migrate Data from Django 1.4 to Django 1.8

2016-02-22 Thread Andreas Kuhne
Hi, I did that a while back, I wrote my own SQL migration script that we tested with the production database in development. I think that would be the only way. Django doesn't know of the changes that you have made in your database models. However if you had started with the production database an

Re: context dictionary

2016-02-23 Thread Andreas Kuhne
Hi, All you have to do is add what you want to the dictionary that you need for your template. There isn't anything "magic" about the context. So for example, if you want to have a model called "user" in the template, you can add it by writing: context = {} context['user'] = User.objects.get(pk=u

Re: context dictionary

2016-02-23 Thread Andreas Kuhne
True, didn't know that it was active in that way nowadays. To Malik: Don't use user as a key in the dictionary. Regards, Andréas 2016-02-23 16:01 GMT+01:00 : > Wouldn't including the name 'user' in your context dictionary override the > authenticated user object in your template? Might make for

Re: Home Page

2016-02-24 Thread Andreas Kuhne
Malik, I find that in many of your questions you are thinking a bit too hard. If you want to have a view for the default page (home page) on a website, just create an app that will handle those pages. In one project that I am currently working on, we created an app called website. In that app we

<    1   2   3   >