Re: Backup vs Audit

2014-12-09 Thread Lachlan Musicman
I've used dbbackup with success - a cronjob to copy out the database (and replace the testing and staging databases with "yesterday's data") and copy it to another machine. Regards the Django admin interface, there are a number of points to consider: - the base interface will always be in the Dja

Re: Backup vs Audit

2014-12-09 Thread Lachlan Musicman
Sorry, what I should have lead with is "at the moment there is no point and click backup solution for your whole package". On 9 December 2014 at 21:33, Lachlan Musicman wrote: > I've used dbbackup with success - a cronjob to copy out the database > (and replace the testing

Re: Database queries location

2014-12-18 Thread Lachlan Musicman
I usually put those functions in the view cheers L. On 19 December 2014 at 08:12, pythonista wrote: > I understand that functions can be placed in the models fille > > However if I have complex queries that receive post input does the > > > Query live in the model the views or an external module

Re: Class Based Views tutorials

2015-01-06 Thread Lachlan Musicman
To answer the unanswered q's: Meta is where you define things about the class, but are not in the class. If you can imagine a space created that *all* classes would need, mine as well as yours, this is in Meta. It's "Meta". IE. How does this class sort? Should a couple of fields be "unique togethe

Form Wizard and middle step data manipulation

2013-11-21 Thread Lachlan Musicman
Hola, I want to collect an integer x in the first form, and then use that to select the x oldest items from collections of items that may have From this perspective it is natural that anarchism be marked by spontaneity, differentiation, and experimentation that it be marked by an expressed affinit

Complex validation

2013-12-04 Thread Lachlan Musicman
Hola, I have an object Part that has a method part_number() part_number is a function that returns an identifying string based on a number of different vars on the model. part_number needs to be unique, but the building of the part_number is complex enough that it cannot just be done via class M

Re: Django application

2013-12-04 Thread Lachlan Musicman
Which web server are you using to serve it on the host server? Apache, nginx are the most likely... And how do you have that web server configured? cheers L. On 5 December 2013 13:53, Sandeep kaur wrote: > Hello, > I installed a django app "zebra" in my django site. This application is > wor

Re: Django application

2013-12-04 Thread Lachlan Musicman
Sandeep, Have you read this part of the documentation? https://docs.djangoproject.com/en/1.6/howto/deployment/ cheers L. On 5 December 2013 15:07, Lachlan Musicman wrote: > Which web server are you using to serve it on the host server? > > Apache, nginx are the most likely... >

Re: Complex validation

2013-12-04 Thread Lachlan Musicman
ixtures or SQL is also validated. Should I move those validation fields to the save method? Cheers L. On 5 December 2013 15:04, Lachlan Musicman wrote: > Hola, > > I have an object Part that has a method part_number() > > part_number is a function that returns an identifying stri

Re: Complex validation

2013-12-05 Thread Lachlan Musicman
On 5 December 2013 18:21, Mike Dewhirst wrote: > On 5/12/2013 3:04pm, Lachlan Musicman wrote: >> The model's clean(): >> >>pn = self.part_number() >>all_parts = Part.objects.all() >>for part in all_pns: >

Re: Complex validation

2013-12-05 Thread Lachlan Musicman
On 5 December 2013 18:10, Mike Dewhirst wrote: > On 5/12/2013 3:18pm, Lachlan Musicman wrote: >> >> Actually, as a corollary to my previous question, I can't tell from >> the Docs whether the model's validation process (in particular, the >> clean() metho

Re: Django for in-house data

2013-12-08 Thread Lachlan Musicman
To be fair, I think the best measure is the technical literacy of your users. The Admin interface is powerful, but they could also accidentally screw everything up. Views (can) remove that opportunity L. On 9 December 2013 08:06, Mike Dewhirst wrote: > On 8/12/2013 9:15pm, giuliano.bertole...@g

Re: Django for in-house data

2013-12-09 Thread Lachlan Musicman
On 9 December 2013 19:17, Mike Dewhirst wrote: > On 9/12/2013 8:14am, Lachlan Musicman wrote: >> >> To be fair, I think the best measure is the technical literacy of your >> users. The Admin interface is powerful, but they could also >> accidentally screw everything

Re: Django for in-house data

2013-12-09 Thread Lachlan Musicman
On 10 December 2013 00:23, wrote: > What I'm trying to understand now is it's possible with little effort to > build views which mostly behave as the admin interface would, doing some > customization on specific points where needed. > > For example, the paged views offered by the admin interface

Re: Accessing database table

2014-01-08 Thread Lachlan Musicman
If it's in the app itself, try import .models? On 9 January 2014 15:27, Don Fox wrote: > In my manage.py shell I can load the following module: > from userprofile.models import NPIdata > > However inside a file of utility functions located in the userprofile app > the same import statement yiel

Re: Honest feedback

2014-01-24 Thread Lachlan Musicman
I would say it's very actively developed and supported. In 2010 release 1.1 was the newest stable. Currently it's 1.6 with 1.7 due in 3-4 months. Wikipedia shows that in those years: 1.2 17 May 2010 Multiple db connections, CSRF, model validation 1.3 23 Mar 2011 Class based views, static files 1.

Re: throwing a 301

2014-01-24 Thread Lachlan Musicman
Docs: https://docs.djangoproject.com/en/dev/ref/request-response/#django.http.HttpResponsePermanentRedirect SO: http://stackoverflow.com/questions/523356/python-django-page-redirect On 25 January 2014 13:50, Bobby Roberts wrote: > i've got a site i'm porting from classic asp over to django. Is

Postgres and backup/restore

2014-02-06 Thread Lachlan Musicman
Hola, What are people's recommendations for postgres db backup solutions? I've just installed django-dbbackup and will give it a try, but thought I'd ask what others were using. cheers L. -- >From this perspective it is natural that anarchism be marked by spontaneity, differentiation, and

Re: Freezing records in a model after a set time

2014-02-23 Thread Lachlan Musicman
I think the easiest way would be to have a timestamp var on the model and then a simple method that uses datetime? Also, check out django-model-utils - it has some nice timestamped model options https://django-model-utils.readthedocs.org/en/latest/ cheers L. On 24 February 2014 01:59, Vittor

Re: Python

2014-02-24 Thread Lachlan Musicman
Other useful tools for Django development are: some sort of server operating system (Linux is my choice); some sort of webserving software (Apache, Nginx); virtualization (virtualenv); a Version Control System (Git, Mercurial, SVN) and a Database (PostgreSQL, MySQL, SQLite) All of these technologi

generic.UpdateView and readonly ForeignKeys

2014-02-26 Thread Lachlan Musicman
I'm looking for a quick and easy way to implement readonly ForeignKeys when using the generic.UpdateView. I can't see anything that looks simpler than just ditching the UpdateView and writing a function based view that sets the FK queryset to a single object. Or have I missed something? cheers L

Re: generic.UpdateView and readonly ForeignKeys

2014-02-26 Thread Lachlan Musicman
e fk_model.__unicode__ ) instead of a ModelChoiceField. Cheers L. On 27 February 2014 09:17, Lachlan Musicman wrote: > I'm looking for a quick and easy way to implement readonly ForeignKeys > when using the generic.UpdateView. > > I can't see anything that looks simpler tha

Re: database design problem.

2014-03-15 Thread Lachlan Musicman
I would make the imports model an "intermediate model" - see here: https://docs.djangoproject.com/en/1.6/topics/db/models/#extra-fields-on-many-to-many-relationships L. On 16 March 2014 09:41, willy Hakizimana wrote: > Thank you guys so much. You guys rock! > > > On Saturday, March 15, 2014 10:

Re: run manage.py commands within app

2014-03-23 Thread Lachlan Musicman
I use cron and a script - but would love to hear other methods as well. Notes: Need to add virtualenv to PATH: crontab -e SHELL=/bin/bash PATH=/home/erp/.virtualenvs/prod/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin # # m h dom mon dow command 0 * * * * cd /home/www/prod/

Re: Deployment in Django

2014-03-24 Thread Lachlan Musicman
There's no such thing as a proper Git repository for Django, or even a proper layout for django. But you really can't go wrong following the advise offered in Two Scoops of Django by Daniel Greenfeld and Audrey Roy. First up, they say exactly that - there is no "right" way. Then they follow with "

Re: Django throws ImproperlyConfigured error when loading URLconf on startup

2014-04-03 Thread Lachlan Musicman
Are you using Debug toolbar? Try this: http://stackoverflow.com/questions/20963856/improperlyconfigured-the-included-urlconf-project-urls-doesnt-have-any-patte cheers L. On 4 April 2014 11:14, Max Demars wrote: > Greetings, > > I encounter the same error here. In latest gunicorn release, it's

Re: Django ユーザー登録について

2014-04-22 Thread Lachlan Musicman
Hi! I don't know how many people on this list speak Japanese unfortunately. I'm not sure if you will get many responses. I read and speak a little Japanese, but had to use Google translate. I think you are asking: I have made a staff database. Each Staff can login. Each staff should only see th

Re: Django ユーザー登録について

2014-04-22 Thread Lachlan Musicman
On 23 April 2014 01:52, hito koto wrote: > thank you very much Each Staff can login. Each staff should only see their own page or dataset. > This is correct > > I want to create administrator page and each staff , > 1, i want , Staff can see the staff page with ID and PW that an > administ

Re: Django ユーザー登録について

2014-04-23 Thread Lachlan Musicman
= forms.CharField(label="社員番号", required=False) > birthday = forms.CharField(label="生年月日", required=False) > > class Meta: > model = Address > fields = ('user_name','postalcode', 'address', > 'residence

Re: Django ユーザー登録について

2014-04-23 Thread Lachlan Musicman
r-to-his-custom-page-mysite-com-username cheers L. > > > 2014年4月23日水曜日 16時18分44秒 UTC+9 Lachlan Musicman: >> >> >> On 23 April 2014 14:11, hito koto wrote: >> >>> Thank you very much good idea! >>> i'm was try but i'm have error when

Re: Django ユーザー登録について

2014-04-27 Thread Lachlan Musicman
): > if request.method == "POST": > # leave_work = Leave_work(user = request.user_id) > > form = Leave_workForm(request.POST, instance = leave_work) > if form.is_valid(): > form.save() > return HttpResponseRedirect('/

Re: Django ユーザー登録について

2014-04-28 Thread Lachlan Musicman
'last_kana', >> > 'employee_number','birthday') >> > user_name = forms.CharField(label="氏名", error_messages={'required': >> > ''}, help_text='必須') >> > first_kana = >> > forms.Ch

Re: Django ユーザー登録について

2014-04-29 Thread Lachlan Musicman
April 2014 23:40, Lachlan Musicman wrote: > Hito san, > > I don't mean to be rude mate, but Google is really really awesome - > just pump in the error message > > http://stackoverflow.com/questions/10388033/csrf-verification-failed-request-aborted > > L. > > On 28

Re: how can i get all values of a field

2014-05-23 Thread Lachlan Musicman
No, that wouldn't work because Category looks like a var on Novel, not a model in it's own right. Novels.objects.filter(category="comedy") is how to get a distinct category. To get the list of categories used, use distinct for a quick hack - something like: Novel.objects.order_by('category').dis

Re: Django export csv

2014-05-25 Thread Lachlan Musicman
If you are using a var in an array or list: array[1] array[2] array[3] so if you have x = datetime.datetime.now() array[x] you would get a similar error. The x needs to be an integer. cheers L. On 26 May 2014 11:50, hito koto wrote: > Hello, > I have the errors is TypeError: 'long' object is

Formsets, adding new forms and autocomplete/ajax selects

2014-05-27 Thread Lachlan Musicman
Hola, I am trying to get two different "extras" to work. I have a form with an inline_formset, which I would like to be able to add multiple formsets of on the fly. Each of those formsets has another FK to a model with a very large dataset, so I would also like to implement some sort of autocomp

Re: virtualenv help needed

2014-05-28 Thread Lachlan Musicman
Two things: 1. Put your media local to your site - I use /home/user/www/dj-project/static and /home/user/www/dj-project/collected_media for project at /home/user/www/dj-project/ 2. The place you are referring to is inside the virtual env's little jail. You can find that by using the cdsitepackage

Re: Django and Rails

2014-05-28 Thread Lachlan Musicman
For db changes, you want South, although the author of South has just finished integrating it into Django 1.7. http://south.aeracode.org/ http://south.readthedocs.org/en/latest/ http://south.readthedocs.org/en/latest/tutorial/index.html Version 1.7 of Django, due any day now, will have migrations

Re: Django and Rails

2014-05-28 Thread Lachlan Musicman
n when the security issues are discovered than running to a plan. I wouldn't fear the Django community disappearing anytime soon. cheers L. On 29 May 2014 14:40, Lachlan Musicman wrote: > For db changes, you want South, although the author of South has just > finished integrating it into

Re: How to install psycpg2 in virtual enviroment with help easy_install.

2014-06-12 Thread Lachlan Musicman
Yep, "pip install" should be enough. Pip install is your friend in virtual environments. Jump into your environment ("workon ENV" or "./path/to/ve/ENV/bin/activate"), and then pip install Django postgresql_psycopg2 Is that what you were asking? On 12 June 2014 22:09, Віталій Лисенко wrote:

Re: Django 1.7 Final Status?

2014-06-15 Thread Lachlan Musicman
I believe I saw Andrew Godwin mention on Twitter this AM that the release blocking bugs were down to 0, and to expect a RC real soon now. As you can see here, there are actually two: https://code.djangoproject.com/query?status=!closed&severity=Release+blocker&order=priority I presume they are ei

PostgreSQL, queries, speed

2014-06-16 Thread Lachlan Musicman
Hola, In an inventory system, I've got a PartNumber model and a Buckets model - each bucket holding one or more instances of a part number. Each instance can have a separate price and currency - depending on date and supplier these can fluctuate. >From this data we would like to extract total an

Re: PostgreSQL, queries, speed

2014-06-16 Thread Lachlan Musicman
rt, then each bucket. It's that double iteration. On 17 June 2014 10:20, Tim Chase wrote: > On 2014-06-17 10:08, Lachlan Musicman wrote: >> The problem is that even with a relatively small number of parts >> (<5000) and only 4 currencies (USD, AUD, EUR, GBP) we are seeing &g

Re: PostgreSQL, queries, speed

2014-06-16 Thread Lachlan Musicman
27;s the way to go though. > > > On Mon, Jun 16, 2014 at 8:41 PM, Lachlan Musicman wrote: >> >> tkc, >> >> You make good points, and I will need to look into better use of >> Django first - aggregates and the like. >> >> I have seen the queries se

Re: PostgreSQL, queries, speed

2014-06-16 Thread Lachlan Musicman
a different DB (dev, stage, prod) from the same postgres server? I guess I set it to the PATH to prod's virtualenv because it's the most conservative but closest to dev? L. On 17 June 2014 13:04, Russell Keith-Magee wrote: > > On Tue, Jun 17, 2014 at 9:25 AM, Lachlan Musicman

Re: PostgreSQL, queries, speed

2014-06-17 Thread Lachlan Musicman
rtualenv shouldn't be involved > at all and you can just point to the system python. > > Thanks, > Alex > > On 06/16/2014 08:16 PM, Lachlan Musicman wrote: >> Thanks Russ, appreciated. >> >> Out of interest, how do people use plpythonu in postgres when

Re: PostgreSQL, queries, speed

2014-06-17 Thread Lachlan Musicman
tkc, Is that the default created when adding db_index=True of is that something that I would do directly in postgres itself? cheers L. On 17 June 2014 22:50, Tim Chase wrote: > On 2014-06-17 11:04, Russell Keith-Magee wrote: >> On Tue, Jun 17, 2014 at 9:25 AM, Lachlan Musicman wrote:

Re: Howto update a package in venv

2014-06-22 Thread Lachlan Musicman
I'm a big fan of pip-tools: pip install pip-tools Once installed, you can do: pip-review --interactive which will check all installed apps and off to update them - you can choose to upgrade for each app (hence the --interactive). Cheers L. On 22 June 2014 07:28, Tom Evans wrote: > On Sat, Ju

Re: Jump on 1.7 in new project or stick to 1.6, target release date 30th of September

2014-06-22 Thread Lachlan Musicman
Yes, I would go to 1.7. On 22 June 2014 23:22, Jorge Andrés Vergara Ebratt wrote: > I've been asking myself the same thing, I think I'm going to start with > Python3 and Django 1.7 :) > > On Jun 22, 2014 8:20 AM, "pjotr" wrote: >> >> We are starting a new project and 1.7 is not far away accordi

Re: How to use 1.7 from git repository

2014-06-23 Thread Lachlan Musicman
git checkout tags/1.7b4 On 24 June 2014 07:53, John Rambo wrote: > How do I switch to version 1.7 in git when I have the current repository? > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receivi

Re: How to use 1.7 from git repository

2014-06-23 Thread Lachlan Musicman
Alternatively, git checkout stable/1.7.x cheers L. On 24 June 2014 08:16, Lachlan Musicman wrote: > git checkout tags/1.7b4 > > On 24 June 2014 07:53, John Rambo wrote: >> How do I switch to version 1.7 in git when I have the current repository? >> >> -- >>

Re: Error: ImproperlyConfigured: The SECRET_KEY setting must not be empty

2014-06-24 Thread Lachlan Musicman
I find I get this error when I forget to set my settings, since I have a split settings set up: python manage.py --settings=app.settings.dev got to remember the --settings=app.settings.x On 24 June 2014 22:14, Tom Evans wrote: > On Tue, Jun 24, 2014 at 9:59 AM, Rini Michael wrote: >> Hi, >> i

Re: Django wizard with one to many

2014-06-24 Thread Lachlan Musicman
Yes, it is. Without a thorough knowledge of what you are doing, I would recommend looking at condition_dict which is in the urls.py https://docs.djangoproject.com/en/1.6/ref/contrib/formtools/form-wizard/#using-a-different-template-for-each-form or the condition steps https://docs.djangoproject.

Weird error like tickets 8892 and 10811

2014-06-25 Thread Lachlan Musicman
I have run up against this bug before: https://code.djangoproject.com/ticket/8892 Recently, it was updated to "duplicate of" https://code.djangoproject.com/ticket/10811 The TL;DR is Sometimes when you have models with O2O or FK you can lose data if the models are saved in the wrong order. I'm

Re: Weird error like tickets 8892 and 10811

2014-06-25 Thread Lachlan Musicman
class are considered equal. " (no docs in 1.6, but I presume that was oversight rather than a change, since no changes are referenced in the docs.) cheers. L. On 26 June 2014 13:24, Lachlan Musicman wrote: > I have run up against this bug before: > > https://code.djangoproje

Re: Using Sum function in Models.py

2014-06-25 Thread Lachlan Musicman
I recommend you send through the code for model you are talking about - since it doesn't make sense to have a sum of a single field of a model. Do you really want to keep the sum in the DB and not calculate it as needed? Maybe if you told us what your desired end point is, we could suggest best

Re: Weird error like tickets 8892 and 10811

2014-06-25 Thread Lachlan Musicman
: def save(self, *args, **kwargs): if not self.slug: self.slug = self.job_number super(Job, self).save(*args, **kwargs) cheers L. On 26 June 2014 14:09, Lachlan Musicman wrote: > Ok, I now understand why this happens: > >>>> x == j > True >>>> j ==

Django Contacts

2014-06-29 Thread Lachlan Musicman
Hi All, I am looking for a contact manager app. I've found Django-contacts, but there are a number of more forks - I was wondering what people are using? cheers L. -- The idea is that a beautiful image is frameable. Everything you need to see is there: It’s everything you want, and it’s very p

Re: how to saven models dynamically inputted by user in form

2014-07-01 Thread Lachlan Musicman
ement in the view final isn't sending a proper object back - either change the return statement, or figure out why it's sending None. Again, without any context at all, it's very hard to help you. cheers L. On 2 July 2014 06:16, Aashita Dutta wrote: > > > On T

Re: Creating subusers

2014-07-01 Thread Lachlan Musicman
I would recommend Intermediate Models as a good solution for these type of weird situations https://docs.djangoproject.com/en/dev/topics/db/models/#extra-fields-on-many-to-many-relationships Cheers L. On 2 July 2014 12:20, Jorge Andrés Vergara Ebratt wrote: > Hello everyone, > > I'm trying to c

Re: Multiple projects on one server

2014-07-02 Thread Lachlan Musicman
I do it using 3 different virtualenvs, each w their own Django install (prod, stage, dev). To facilitate the settings I use the Two Scoops of Django by @pydanny (and his partner whose name escapes me just now) method which I highly recommend as a post-tutorial text in general. But if they are dif

Re: django beginner

2014-07-02 Thread Lachlan Musicman
You need a ^articles/year/$ in your urls.py if you want to visit http://127.0.0.1:8000/articles/year/ Your URLs are looking for: http://127.0.0.1:8000/articles/ - eg http://127.0.0.1:8000/articles/2014 http://127.0.0.1:8000/articles//dd/ - eg http://127.0.0.1:8000/articles/2014/07/ http:

Re: User related objects

2014-07-02 Thread Lachlan Musicman
There are a couple of ways to do it, filtered queries are the obvious solution https://docs.djangoproject.com/en/1.6/topics/db/queries/#retrieving-specific-objects-with-filters But it would require that your model have either a group or owner permission set. (eg class MyModel(models.Model): p

Re: Creating subusers

2014-07-02 Thread Lachlan Musicman
ser in itself and also all the information > those users wirte to the DB... Would it still be a good approach and create > a 'superuser' member of the group that can have those permissions? Or should > I try something else like groups or extending BaseUser? > > > 2014-07

Re: User related objects

2014-07-02 Thread Lachlan Musicman
This is what you are after: https://docs.djangoproject.com/en/1.6/ref/contrib/admin/#django.contrib.admin.ModelAdmin.save_model cheers L. On 2 July 2014 21:42, Jonathan Querubina wrote: > My problem is doing this on django-admin. > > Thanks! > > On Jul 2, 2014, at 8:31 AM, L

Re: Multiple projects on one server

2014-07-02 Thread Lachlan Musicman
Absolutely. Can't speak to different versions of python, although you could always hard code that in the virtenv itself, but as for libs - absolutely. In reality most distros (well, deb based) come with python 2 and python 3 and there are packages available if you need an older version than 2.7. h

Re: HELP WITH THIS CODE!!

2017-10-19 Thread Lachlan Musicman
No that code wont work - it looks more like Java. Pro tip: if you want answers in this email list, you will definitely get a response if you paste your code rather than a screen shot, and if you show that you have completed the Django Tutorial as written by the developers. https://docs.djangoproj

Re: Django 2.0 tutorial

2017-11-23 Thread Lachlan Musicman
-- "The antidote to apocalypticism is *apocalyptic civics*. Apocalyptic civics is the insistence that we cannot ignore the truth, nor should we panic about it. It is a shared consciousness that our institutions have failed and our ecosystem is collapsing, yet we are still here — and we are crea

Re: Django 2.0 tutorial

2017-11-23 Thread Lachlan Musicman
On 24 November 2017 at 12:15, Carl Brubaker wrote: > Ok, I applied the migration, but it still doesn't work. Maybe this is a > django 2.0 bug that needs worked out. I figured I'd learn 2.0 so I wouldn't > have to relearn after 2.0 releases. The initial check before creating the > "polls app" wor

Re: help me

2017-12-07 Thread Lachlan Musicman
On 8 December 2017 at 08:04, kalla giga wrote: > help me with the basic of django > > If you work through the tutorial, it really gives you a good introduction. https://docs.djangoproject.com/en/2.0/intro/tutorial01/ Cheers L. -- You received this message because you are subscribed to the Go

Re: Django picks up wrong urs in application urs.py

2017-12-18 Thread Lachlan Musicman
On 19 December 2017 at 09:28, Tsuyoshi Takahashi wrote: > when application urs.py decribed as below > > urlpatterns = [ > url('card', views.card), > url('welcome', views.welcome), > url('cards', views.cards), > ] > > Django picks up "url('card', views.card)" when I enter > "http://lo

Re: How to understand below html code?

2018-03-26 Thread Lachlan Musicman
Utpal, it's not pure HTML. It's got some templating in there as well - Jinja2 I think is the default. Regardless, it reads like Python: if the list exists, open an unnumbered list for every question in the list, create a dot point with the list question. The list question will be a html a link ba

Re: I'm new to programming, I don't know where consider as "document root of web server"

2016-04-27 Thread Lachlan Musicman
Mie, Traditionally the document root to your webserver is (depending on your system) /var/www. This will be defined in the webserver (apache2/httpd, nginx, etc) configuration. I normally create a folder in my home dir called www and place my sites within that /home/lachlan/www/site1 /home/lachl

Re: I'm new to programming, I don't know where consider as "document root of web server"

2016-04-27 Thread Lachlan Musicman
"We've always done it this way." - Grace Hopper On 28 April 2016 at 11:56, Lachlan Musicman wrote: > Mie, > > Traditionally the document root to your webserver is (depending on your > system) /var/www. > > This will be defined in the webserver (apache2/httpd, nginx,

Re: I'm new to programming, I don't know where consider as "document root of web server"

2016-04-27 Thread Lachlan Musicman
On 28 April 2016 at 14:41, Mie Rex wrote: > for your case, site1 and site2 are two isolate webserver, correct? > Will all the files under both of these directories open to public once the > server is up and running? > Oops - almost, but not quite. Site1 and Site2 are two different websites, bein

Re: How can I change the TabularInline "title" on Django Admin?

2016-07-12 Thread Lachlan Musicman
There's a ticket for this in the tracker iirc, but I can't find it now. I think the reason is because that's the name of the DB field - it's not localizable (in so much as we don't localize db field names). I *think* that was the reason. -- The most dangerous phrase in the language is, "We've

Django group email in spam

2016-09-01 Thread Lachlan Musicman
Hey, I've been seeing a lot of Django group email going into my spam folder over the last 48 hours. Have there been any changes to the group that may have caused this? cheers L. -- The most dangerous phrase in the language is, "We've always done it this way." - Grace Hopper -- You receive

Re: Django group email in spam

2016-09-09 Thread Lachlan Musicman
//www.facebook.com/urievenchen> > <http://plus.google.com/+urievenchen> > <http://www.linkedin.com/in/urievenchen> <http://twitter.com/urievenchen> > > On Wed, Sep 7, 2016 at 11:05 PM, sylvain_grodes > wrote: > >> Same problem here, I have to check my spam

Re: How & Where are Django View Functions Called?

2019-01-09 Thread Lachlan Musicman
On Thu, 10 Jan 2019 at 14:36, Alejandro Reyes wrote: > Hi, > > Suppose I have a standard views.py module in my Django app and that app > has a simple function: > > def home(request): >form =request.POST['form'] > > > Where exactly in the Django framework does it specifically call 'home' > wit

SPAM sent via this list?

2019-01-09 Thread Lachlan Musicman
I just got a spam email from the account aphiso...@gmail.com That is threaded to my previous response to Alejandro Reyes's email Here's the raw header Delivered-To: data...@gmail.com Received: by 2002:ab0:59f2:0:0:0:0:0 with SMTP id k47csp1496731uad; Wed, 9 Jan 2019 20:15:11 -0800 (PST

Set default value in field dependant on another model?

2019-01-13 Thread Lachlan Musicman
We have two models: Resources and Quota Resources model instances include: - red things - yellow things - blue things Quota have two fields, one is a FK to a Resource, the other is "desired quota". When instantiating the Quota request form, we create a form for each Resource. I'd like to autofil

list_filter no longer does Boolean?

2019-06-05 Thread Lachlan Musicman
Hola, I seem to remember when list_filter did booleans - does it no longer? Cheers L. -- -- "The fact that you're still saying something like 'feminism gone mad' suggests that feminism hasn't gone mad ENOUGH yet." Helen Zaltzman / @HelenZaltzman https://twitter.com/HelenZaltzman/status/106

Re: list_filter no longer does Boolean?

2019-06-05 Thread Lachlan Musicman
On Thu, 6 Jun 2019 at 16:36, Lachlan Musicman wrote: > Hola, > > I seem to remember when list_filter did booleans - does it no longer? > Oh. I see that it does - if it's a BooleanField, but not for a method on the Model class? -- "The fact that you're

Re: USING graphs in django admin

2017-03-03 Thread Lachlan Musicman
You could try ggplot http://ggplot.yhathq.com/ alternatively there's D3 https://d3js.org/ Cheers L. -- The most dangerous phrase in the language is, "We've always done it this way." - Grace Hopper On 3 March 2017 at 21:22, Luvpreet Singh wrote: > I want to display graphs in django admi

Re: Chart library for django

2017-03-05 Thread Lachlan Musicman
Hi Luvpreet, There's nothing built into Django. Django is a web framework and charts are outside of that. Django is written in Python and uses the standard web technologies like HTML, CSS and JS. You will need to find a charting package that can be used with any of those and work out how you want

Re: Django Produces Python?

2017-03-25 Thread Lachlan Musicman
It will needs the Django as well. Think of them as layers - at the bottom is the OS, then there is python. Django sits on Python. Your project sits on Django. Can't remove a layer. cheers L. -- The most dangerous phrase in the language is, "We've always done it this way." - Grace Hopper On

Re: Django Produces Python?

2017-03-26 Thread Lachlan Musicman
If you take James' answer and expand it a little, take a look at a Python micro-framework like Pylons http://pylonsproject.org/ It's smaller than Django and is a useful tool for a different type of website. For instance take Authentication and Authorization - logins. Not every site needs one. Dja

Re: python django fields and row calculation

2017-04-04 Thread Lachlan Musicman
Depends on your models, but write a small function that returns the balance? def balance(self): return self.entitlement - self.num_days (for instance) L. -- The most dangerous phrase in the language is, "We've always done it this way." - Grace Hopper On 5 April 2017 at 10:49, sum abi

Re: python django fields and row calculation

2017-04-04 Thread Lachlan Musicman
days from the that total balance. > > > thanks > > > > On Wed, Apr 5, 2017 at 12:20 PM, Lachlan Musicman > wrote: > >> Depends on your models, but write a small function that returns the >> balance? >> >> def balance(self): >> return sel

Auth using FreeIPA?

2017-04-05 Thread Lachlan Musicman
Hola, Has anyone got tips on integrating a Django 1.11.0/2.0 with FreeIPA? I've found a video from EuroPython 2015 ( https://www.freeipa.org/page/Web_App_Authentication#Django) but that's a long time ago now and videos aren't much chop when it comes to howtos :) cheers L. -- The most danger

Re: New to django and ORM. So a basic question about data inserts

2017-04-10 Thread Lachlan Musicman
-- The most dangerous phrase in the language is, "We've always done it this way." - Grace Hopper On 11 April 2017 at 05:35, Cassium wrote: > Say I am collecting residence history and I allow the user to submit up to > five previous addresses. I have a PEOPLE model and RESIDENCES model and >

Re: Django relationships and the admin page

2017-04-10 Thread Lachlan Musicman
On 11 April 2017 at 07:32, Liam H wrote: > Hi, > > I'm new to Django, programming, web apps, the whole lot. I've been working > on an app for a while now, but I'm having trouble figuring out how to > organise my models in an effective way. Im using Django 1.10 and Python 2.7. > > Here's a rough e

Re: Please help me to solve. I am a biginner. I am following Django tutorial on its Documentation from thier website.

2017-05-09 Thread Lachlan Musicman
A quick google search shows that this error message means that port is in use by another program. Try: python manage.py runserver 8080 or python manage.py runserver 8081 instead? cheers L. -- "Mission Statement: To provide hope and inspiration for collective action, to build collective p

Re: i dont know from where to start my first project on django

2017-05-09 Thread Lachlan Musicman
A further tip. Your models might be (doesn't have to be): - Drivers - Cars - reservations (a Many to Many relationship with extra fields https://docs.djangoproject.com/en/1.11/topics/db/models/#extra-fields-on-many-to-many-relationships ) cheers L. -- "Mission Statement: To provide hope a

Triggering events on model field change

2017-06-01 Thread Lachlan Musicman
Hola, I have a model with a collection of BooleanFields. When particular fields change value I'd like to trigger an event (usually email). A quick search shows that there are questions like this back to 09. The two most obvious and recent solutions involve using: - django's from_db ( https://

Re: Same tutorial different day

2017-06-05 Thread Lachlan Musicman
I think your mysite/urls.py needs an import polls -- "Mission Statement: To provide hope and inspiration for collective action, to build collective power, to achieve collective transformation, rooted in grief and rage but pointed towards vision and dreams." - Patrisse Cullors, *Black Live

Re: Django beginner

2017-07-13 Thread Lachlan Musicman
Amir You will need a basic - very basic - understanding of databases and webservers. The webserver will serve your content. The database will store your content. For databases, you need to know: how to create one, add a user, give that user a password. (easy, can google) For webservers, you need

Re: I am new in this world of Python.

2017-07-17 Thread Lachlan Musicman
Adil, If you are looking for a long list of exercises to practice on, try the Euler project https://projecteuler.net/archives It starts easy cheers L. -- "The antidote to apocalypticism is *apocalyptic civics*. Apocalyptic civics is the insistence that we cannot ignore the truth, nor should

M2M through listing on source model

2017-08-08 Thread Lachlan Musicman
I have a situation where there is a M2M with a through model for extra information, as per https://docs.djangoproject.com/en/1.11/topics/db/models/#extra-fields-on-many-to-many-relationships When using Class Based Generic Views in the documented situation above, how would I show a list of members

'ModelFormOptions' object has no attribute 'label'

2017-08-20 Thread Lachlan Musicman
Hi All, I'm seeing this error when I start my uwsgi > Exception Type: AttributeError Exception Value: > > 'ModelFormOptions' object has no attribute 'label' > Exception Location: /opt/virtualenvs/traceback/lib/python3.4/site-packages/django/forms/models.py in _get_foreign_key, line 1023 Bu

<    1   2   3   4   5   >