Re: multilanguage folder names in urls?

2007-04-11 Thread Rohan

> Hi! Is it possible to use i18n for folder names in url patterns? For
> example "/accounts" in english would translate automatically to
> "konten" in German.

Hi, Here's my solution to what I think is the same requirement:

First of all setup urlpatterns in urls.py to map all the language
variations to the appropriate views. I found this step to be necessary
as:
a) I don't know how to rebuild urlpatterns when the language changes
b) it's probably faster to have urlpatterns static and built for all
languages.

--start code--

# 'stores_uri' is a translatable 'folder' name

for language in settings.LANGUAGES:
translation.activate(language[0])

urlpatterns += patterns('views',
(r'^(?P[a-z]{2})/'+_('stores_uri')+'/$',
'stores'),
(r'^(?P[a-z]{2})/'+_('products_uri')+'/$',
'products'),
)

--end code--

Then in the templates, I build the urls by referring to the
"stores_uri" message id, like so:

--start code--


{% trans "stores"%}

--end code--

I made a seperate message id for the URI with idea that the
translation shouldn't be changed once released (as it will cause a URI
change)



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



Download Weather Toolbar

2007-01-20 Thread rohan$

Download Weather Toolbar - Instant weather reports, forecasts, and
radar images anytime for FREE! - http://surl.in/HLWTD238206SVRAKSX


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



Download weather toolbar

2007-01-22 Thread rohan$

Download Weather Toolbar - Instant weather reports, forecasts, and
radar images anytime for FREE! - http://surl.in/HLWTD238206SVRAKSX


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



geodjango error

2012-03-17 Thread rohan
I am following the geodjango tutorial on djangoproject. I have
installed postgresql with postgis. and tested orginfo with GDAL
sucessfully. However, I am getting an error while running syncdb.

django.core.exceptions.ImproperlyConfigured: Could not import user-
defined GEOMETRY_BACKEND "geos".

I am unable to crack it as PostGIS already has geos folder in it and I
have given the right path.

below is my database config.

Any help would be greatly appreciated.

DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis', # Add
'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'geodjango',  # Or path to
database file if using sqlite3.
'USER': '',  # Not used with sqlite3.
'PASSWORD': '',  # Not used with sqlite3.
'HOST': '',  # Set to empty string for
localhost. Not used with sqlite3.
'PORT': '',  # Set to empty string for
default. Not used with sqlite3.
}
}

C:\Python27\Lib\site-packages\django\bin\geodjango>python manage.py
syncdb
Traceback (most recent call last):
  File "manage.py", line 14, in 
execute_manager(settings)
  File "C:\Python27\lib\site-packages\django\core\management
\__init__.py", line
438, in execute_manager
utility.execute()
  File "C:\Python27\lib\site-packages\django\core\management
\__init__.py", line
379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Python27\lib\site-packages\django\core\management
\__init__.py", line
261, in fetch_command
klass = load_command_class(app_name, subcommand)
  File "C:\Python27\lib\site-packages\django\core\management
\__init__.py", line
67, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name,
name))
  File "C:\Python27\lib\site-packages\django\utils\importlib.py", line
35, in im
port_module
__import__(name)
  File "C:\Python27\lib\site-packages\django\core\management\commands
\syncdb.py"
, line 7, in 
from django.core.management.sql import custom_sql_for_model,
emit_post_sync_
signal
  File "C:\Python27\lib\site-packages\django\core\management\sql.py",
line 6, in
 
from django.db import models
  File "C:\Python27\lib\site-packages\django\db\__init__.py", line 78,
in 
connection = connections[DEFAULT_DB_ALIAS]
  File "C:\Python27\lib\site-packages\django\db\utils.py", line 93, in
__getitem
__
backend = load_backend(db['ENGINE'])
  File "C:\Python27\lib\site-packages\django\db\utils.py", line 33, in
load_back
end
return import_module('.base', backend_name)
  File "C:\Python27\lib\site-packages\django\utils\importlib.py", line
35, in im
port_module
__import__(name)
  File "C:\Python27\lib\site-packages\django\contrib\gis\db\backends
\postgis\bas
e.py", line 5, in 
from django.contrib.gis.db.backends.postgis.operations import
PostGISOperati
ons
  File "C:\Python27\lib\site-packages\django\contrib\gis\db\backends
\postgis\ope
rations.py", line 8, in 
from django.contrib.gis.geometry.backend import Geometry
  File "C:\Python27\lib\site-packages\django\contrib\gis\geometry
\backend\__init
__.py", line 14, in 
'"%s".' % geom_backend)
django.core.exceptions.ImproperlyConfigured: Could not import user-
defined GEOME
TRY_BACKEND "geos".

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



Re: How can Selenium see a record that I can't find from a debugger?

2012-07-02 Thread Rohan

Hi Bryan,

I believe the problem is that selenium and the django testing framework 
are looking up different databases. To run selenium, you would be 
starting the actual server


One solution is to use 'manage.py testserver ' for running 
the selenium tests. This will ensure that the data is populated into the 
testserver, and will be deleted once the server is stopped



On 7/2/2012 11:17 AM, Bryan wrote:

I'm still stuck regarding how to delete a user from the database directly.

On Tuesday, June 26, 2012 9:59:09 AM UTC-4, Bryan wrote:

I am creating Selenium tests for my App.
I can create a new user, but I can't seem to figure out how to
have it deleted from the database.

After the tests run successfully the first time, subsequent tests
fail because the username already exists.

**Why am I not able to query the newly created record in the
debugger despite being able to see the new record on the page?**

**How do I delete a record from the database in a test?**

This is what I have been doing:

from selenium import webdriver
from django.utils import unittest
from forum.models import Question, Answer, User

class TestOSQAAuthentication(unittest.TestCase):
scheme = 'http'
host = 'localhost'
port = ''

def setUp(self):
self._driver = webdriver.Firefox()
self._driver.implicitly_wait(25)


def test_anon_can_create_new_account_manually(self):
   
self._driver.get('http://localhost:8000/account/local/register/

')
   
self._driver.find_element_by_id('id_username').send_keys('MrManual')
   
self._driver.find_element_by_id('id_email').send_keys('t...@gmail.com

')
   
self._driver.find_element_by_id('id_password1').send_keys('test')
   
self._driver.find_element_by_id('id_password2').send_keys('test')

self._driver.find_element_by_id('bnewaccount').click()
# verify MrManual was created
self._driver.get('http://localhost:8000/users/
')
self._driver.find_element_by_link_text('MrManual')
# MrManual seems to be created, but I don't see
MrManual in the database during debugging with:
# import ipdb; ipdb.set_trace()
#ipdb> User.objects.all()
#[, , ]
# here I am trying to delete the user from the
database directly.
User.objects.filter(username="MrManual").delete()
"""For some reason I can't delete the record from the
database from the test.
Selenium can find the new user in the browser, but I
can't query the database to find it."""

--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/_swPDw1iq-0J.

To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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



Re: Deployment: Apache2, wsgi (Debian squeeze)

2012-07-03 Thread Rohan
If you change '/django' to '/' in your WSGIScriptAlias directive, then 
everything will be forwarded to django, but apache will no longer check 
in DocumentRoot since all url paths begin with a '/' and will be matched 
by your wsgi alias


This means you would need another way of handling static content that 
doesn't need to be rendered by django. I personally use an nginx proxy 
in front of apache which serves static content directly and forwards 
dynamic requests to apache.


In answer to your question of how you handle the same problem through 
urls.py, you can use the django static files app as explained in 
https://docs.djangoproject.com/en/dev/howto/static-files/


For example, having the following in urls.py

url(r'^media/(?P.*)$', 'django.views.static.serve', 
{'document_root': settings.MEDIA_ROOT,}),


lets django serve requests beginning with '/media' directly if your 
media files are located at MEDIA_ROOT simlar to how apache serves 
content from DocumentRoot. However, as the django documentation 
explains, this is highly inefficient, and NOT recommended for production 
since webservers do a better job of handling static content. As Kenneth 
suggested, setting up a virtual host in apache is an excellent way to 
start off.


On 7/3/2012 3:30 AM, kenneth gonsalves wrote:

On Tue, 2012-07-03 at 15:03 +1200, Matt Smith wrote:

Now I feel I'm stuck
between that old way of doing things and the django/wsgi way which I
can't get my head around even after reading the docs.

I would suggest that you start with trying to understand the concept of
virtual host in Apache. Try to set up a virtual host serving static
content at the start and once you understand that, things will start
falling in place (I am from a similar background from you, and thats how
I did it.



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



Re: submit parameters to py script

2012-07-06 Thread Rohan
For a cgi script or a wsgi script, all you need to do is add a script 
alias in your apache conf (if you're using apache). The parameters 
should be available as a a dictionary in both the cases 
(cgi.FieldStorage() and envrion).


Although it would help to know why you want to do this. If you already 
have django up and running, you could just implement the functionality 
of your script as a view function


On 7/6/2012 6:20 PM, Smaran Harihar wrote:

Hey Djangoers,

I am trying to execute a python script on submit button on a html file.

So i have created a view which renders a html template file and on 
'submit', I wish to send few parameters to the py script.


I wanted to know,

1. where should I keep my py script?
2. I have not modified my html into Django template, but what 
modifications will it need if I want to send parameters to py script 
on submit?


--
Thanks & Regards
Smaran Harihar

--
You received this message because you are subscribed to the Google 
Groups "Django users" group.

To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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



Re: Getting images to appear in html using Django.

2012-07-09 Thread Rohan

Hi Jak,
I would suggest removing the "," after MEDIA_ROOT in your settings file 
if it indeed is there. Could you also be a little more specific about 
the problem. Is the rest of the page loading fine? and if it is, do you 
see /media/ being pre-pended to your file name when you see the source 
of your html page? Are you getting a page not found error when you're 
trying to access the image directly ( /media/FAPLogo.jpg) ?


Additionally, are you by chance pointing ADMIN_MEDIA_PREFIX  in your 
settings.py to /media/ as well?


On 7/8/2012 6:30 PM, Jak wrote:

Update:

I'm now using requestcontext in my view.

my new view is
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.template.loader import get_template
from django.template import RequestContext

def homepage(request):
 return render_to_response ('index.html',
  
context_instance=RequestContext(request))


But it's still not working.

Thanks again!

On Jul 8, 5:26 pm, Jak  wrote:

Hello All,

I am new to Django and I'm trying to create a simple website. I am
trying to get an jpg to appear in the base template but I cant get it
to show up.

In setting.py
MEDIA_ROOT = '/Users/Jak/projects/fap/mysite/media',
MEDIA_URL = '/media/'

urls.py
(r'^media/(?P.*)$', 'django.views.static.serve',
  {'document_root': settings.MEDIA_ROOT}),

HTML
  

views.py
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.template.loader import get_template

def homepage(request):
 return render_to_response ('index.html')

any ideas on what the problem could be? I dont get an error when I run
the server.

Thanks

Jak



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



Re: Deployment: Apache2, wsgi (Debian squeeze)

2012-07-09 Thread Rohan

Hi Matt,
If you do not have static serving enabled in your django application 
mapping to /static/ in urls.py, then the content is being served by Apache.


What is your MaxRequestsPerChild in your apache conf?

One of the reasons production environments use a different web server 
for serving static content is that wsgi applications are blocking 
applications and the server blocks activity until the wsgi request is 
handled. This could affect your performance for concurrent requests if 
you have a single process


On 7/9/2012 3:25 AM, Matt Smith wrote:

Thx Kenneth, Rohan, Melvyn.

I've arrived at something that works:

httpd.conf:
WSGIScriptAlias / 
/usr/local/django/projectName/apache/django.wsgi
Alias  /static 
/usr/local/django/projectName/static


So everything that's not a template lives under 
/usr/local/django/projectName/static. Is this ok? Does this mean when 
I link to say /static/foo.jpg in a template that foo.jpg is being 
served up by apache directly, ie not handled by wsgi?


I've noticed that the site is slower to load up than before django? Is 
this normal?





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



How to create a single data view from multiple data sources

2011-06-14 Thread rohan
I have two tables in my database with one common field. Is it possible
to write a web app to create views using django?

Any help would be greatly appreciated.

Thank you

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



Re: How to create a single data view from multiple data sources

2011-06-14 Thread rohan
Can you please be a bit more specific? The link you provided is for
Django tutorials. It would be great if you could guide me to the
specific page.

On Jun 14, 10:16 am, Shawn Milochik  wrote:
> On 06/14/2011 10:42 AM, rohan wrote:
>
> > I have two tables in my database with one common field. Is it possible
> > to write a web app to create views using django?
>
> > Any help would be greatly appreciated.
>
> > Thank you
>
> Yes, it is.
>
> Do the tutorial and then re-do it using your own data.
>
> https://docs.djangoproject.com/en/1.3/

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



problem with creating foreign keys

2011-03-29 Thread rohan
Hello,

I am new to Django and am trying to design a chemistry database in
Django and am stuck with creating the relations between the tables.

Below are my models. When I try to validate I get an error stating
that the reverse query name for field 'species2ID' clashes with m2m
fileID 'Compunds.reactions'. Add a related_name argument to the
definition for 'species2ID'. The same is repeated for species1ID.

I basically want to create two foreign keys in the reactions table
which correspond to my compounds table have a manytomany relationship
between compounds and reactions table at the same time. Can anyone
please guide me with respect to this. I can provide the schema if
needed.

Thank you.


from django.db import models

class Elements(models.Model):
name = models.CharField(max_length = 20)
atomicNumber = models.IntegerField(blank=True,null=True)
atomicSymbol = models.CharField(max_length =5)
freezingPointKelvin = models.FloatField(blank=True,null=True)
boilingPointKelvin = models.FloatField(blank=True,null=True)
mass = models.FloatField(blank=True,null=True)
density = models.FloatField(blank=True,null=True)
radiusAtomic = models.FloatField(blank=True,null=True)
radiusIonic = models.FloatField(blank=True,null=True)
compounds = models.ManyToManyField('Compounds')

class Compounds(models.Model):
name= models.CharField(max_length = 30)
mass = models.FloatField(blank=True,null=True)
radius = models.FloatField(blank=True,null=True)
reactions = models.ManyToManyField('Reactions')
simulations = models.ManyToManyField('Simulations')


class Reactions(models.Model):
species1ID = models.ForeignKey(Compounds)
species2ID = models.ForeignKey(Compounds)
reactionid= models.CharField(max_length = 20)

class Productsets(models.Model):
energyReleased = models.FloatField(blank=True,null=True)
reactions = models.ManyToManyField('Reactions')
compounds= models.ForeignKey(Compounds)

class Simulations(models.Model):
number = models.IntegerField(blank=True,null=True)
name = models.TextField()
species = models.ManyToManyField('Compounds')

class Lessons(models.Model):
number = models.IntegerField(blank=True,null=True)
name = models.TextField()
simulations = models.ForeignKey(Simulations)

class Units(models.Model):
number = models.IntegerField(blank=True,null=True)
name = models.CharField(max_length = 40)
lessons=models.ForeignKey(Lessons)

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



How to store the database in the project root

2011-03-29 Thread rohan
Hi,

I am creating an app and want to store the database and the images
within the project. The main motive behind this is I want to create a
database with django's admin interface and want to use it on other
computers later. In order to do this I will need to use relative
paths. I tried using os.path.dirname but doesnt seem to work for me.
below is the initial part of my settings file. I am using sqlite3. Can
someone please guide me in the right path.

Thank you



import os.path
import sys
import re

PROJECT_ROOT = os.path.dirname(os.path.realpath(__file__))

DEBUG = True
TEMPLATE_DEBUG = DEBUG

ADMINS = (
# ('Your Name', 'your_em...@domain.com'),
)

MANAGERS = ADMINS

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add
'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME':
os.path.dirname(os.path.realpath(__file__)),  # Or
path to database file if using sqlite3.
'USER': '',  # Not used with sqlite3.
'PASSWORD': '',  # Not used with sqlite3.
'HOST': '',  # Set to empty string for
localhost. Not used with sqlite3.
'PORT': '',  # Set to empty string for
default. Not used with sqlite3.
}
}


TIME_ZONE = 'America/Chicago'

LANGUAGE_CODE = 'en-us'

SITE_ID = 1

USE_I18N = True

USE_L10N = True

MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'static')

MEDIA_URL = '/static/'

ADMIN_MEDIA_PREFIX = '/media/'

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



Re: How to store the database in the project root

2011-03-29 Thread rohan
I got it working.


I just used os.path.join(PROJECT_ROOT,'db/chemdb') in place of
database name. It created the database within a folder called db
inside the project.

On Mar 29, 1:50 pm, Shawn Milochik  wrote:
> This works for me:
>
> DIRNAME = os.path.dirname(__file__)

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



How to store multiple instances of a single object in the database

2011-03-30 Thread rohan
Hi,

I am creating a chemistry database using django's admin interface in
Sqlite3.

The database has a simulations table which has a many to many
relationship with the compounds table.
Each simulation needs to start off with a fixed number of compounds
that it has and each simulation can have 1 or more compounds. suppose
a simulation has water molecule and hcl molecule, it must start off
with 25 water molecules and 10 hcl molecules. Is there anyway in
Django to define this within the database? Please let me know if the
question is not clear and I will post my models here.

Thank you

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



Re: How to store multiple instances of a single object in the database

2011-03-30 Thread rohan
Hey Ryan,

That seems very helpful. I will try using this argument.
Thanks a lot.

Rohan
On Mar 30, 5:10 pm, Ryan Osborn  wrote:
> Have you considered using the 'through' argument for the many to many
> field?  This lets you specify your own intermediate table to which you can
> add extra data.  So you could add in a quantity field so you would know how
> many of each molecule you need.
>
> Here is the 
> documentation:http://docs.djangoproject.com/en/1.3/topics/db/models/#intermediary-m...
>
> Hope this helps,
>
> Ryan

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



Re: How to store multiple instances of a single object in the database

2011-03-30 Thread rohan
The method works perfectly. Thanks once again.

On Mar 30, 5:36 pm, rohan  wrote:
> Hey Ryan,
>
> That seems very helpful. I will try using this argument.
> Thanks a lot.
>
> Rohan
> On Mar 30, 5:10 pm, Ryan Osborn  wrote:
>
>
>
>
>
>
>
> > Have you considered using the 'through' argument for the many to many
> > field?  This lets you specify your own intermediate table to which you can
> > add extra data.  So you could add in a quantity field so you would know how
> > many of each molecule you need.
>
> > Here is the 
> > documentation:http://docs.djangoproject.com/en/1.3/topics/db/models/#intermediary-m...
>
> > Hope this helps,
>
> > Ryan

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



Django with AJAX, execution of long processes

2010-08-07 Thread Rohan Jain
Hi!

I have a problem with django and ajax.
I am giving requests from ajax which run a process that takes some
time and has many stages. Is there any way to return the various
stages as responses, so the user does not have to see only the loading
image but can also the current status of the process.

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



django queryset get only one result for one column pair

2010-08-14 Thread Rohan Jain
I have a field 'submission' which has a 'user' and a 'problem'.
How can i get a django queryset search result which will give a list
of only one result per user-problem pair.

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



Re: django queryset get only one result for one column pair

2010-08-14 Thread Rohan Jain
Actually there may be many submissions with a user-problem pair but i
want to list only the last one per user - problem pair.
Like:

let p1 be two problems , u1, u2 be two users and s1,s2 two submissions
by user u1 on problem and s3,s4 by u2.

so i want to get a queryset with only the last submission by u1,u2 on
p1.

On Aug 14, 5:57 pm, Kenneth Gonsalves  wrote:
> On Sat, 2010-08-14 at 05:45 -0700, Rohan Jain wrote:
> > I have a field 'submission' which has a 'user' and a 'problem'.
> > How can i get a django queryset search result which will give a list
> > of only one result per user-problem pair.
>
> does your model not have a unique_together for user and problem?
> --
> regards
> Kenneth Gonsalves

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



Re: django queryset get only one result for one column pair

2010-08-14 Thread Rohan Jain


On Aug 14, 5:57 pm, Kenneth Gonsalves  wrote:
> On Sat, 2010-08-14 at 05:45 -0700, Rohan Jain wrote:
> > I have a field 'submission' which has a 'user' and a 'problem'.
> > How can i get a django queryset search result which will give a list
> > of only one result per user-problem pair.
>
> does your model not have a unique_together for user and problem?
> --
> regards
> Kenneth Gonsalves

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



Re: django queryset get only one result for one column pair

2010-08-14 Thread Rohan Jain
My models are defined like this:

class Problem(models.Model):
title = models.CharField('Title', max_length = 100)
question = models.TextField('Question')

class Submission(models.Model):
user = models.ForeignKey(User)
problem = models.ForeignKey(Problem)
solution = models.CharKey()
time = models.DateTimeField('Time', auto_now_add=True)

I want to run a sql command on submission field and get the list of
submissions ordered by submission time and will include only one
result if there are more than one submissions by a same user in one
problem.

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



Re: Any job queue systems that integrates with Django & allow scheduling jobs by date?

2010-08-17 Thread Rohan Jain
i think what you need is http://code.google.com/p/django-cron/

Also you may want to check out http://celeryq.org/ if you want to do
parallel processing,
distribute jobs to other computers to ease the web server load.

On Aug 18, 5:10 am, Andy  wrote:
> I have a Django application.
>
> One of my models looks like this:
>
>     class MyModel(models.Model):
>
>         def house_cleaning(self):
>         // cleaning up data of the model instance
>
> Every time when I update an instance of MyModel, I'd need to clean up
> the data N days later. So I'd like to schedule a job to call
>
>     this_instance.house_cleaning()
>
> N days from now.
>
> Is there any job queue that would allow me to:
>
>  - Integrate well with Django - allow me to call a method of
> individual model instances
>  - Only run jobs that are scheduled to run today
>  - Ideally handle failures gracefully
>
> Thanks

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



Re: Object ID is not assigned after calling save() on a new object

2010-08-24 Thread Rohan Jain
Django assigns an id field to models automatically, so you dont need
to define it seperately. And even if you define it you have to assign
auto_increment = true so that it is automatically filled.

On Aug 24, 2:55 pm, Dan  wrote:
> Hi,
>
> I have some troubles with my Django model: whenever I create a new
> object the ID (primary key) is not being assigned to it after calling
> obj.save().
>
> I am on RHEL with Python 2.4.3 and Django 1.2.1 (with MySQL backend).
>
> I've uploaded a code snippet which clearly shows the 
> problem:http://pastebin.com/qtRgZVQY
>
> For the reference, this is the model I am using:
> class Attribute(models.Model):
>     id = models.PositiveIntegerField( db_column='attribute_id',
> primary_key=True )
>     name = models.CharField(max_length=255,
> db_column='attribute_name', unique=True)
>     _touchDate =
> models.DateTimeField( db_column='attribute_touchDate', editable=False,
> auto_now=True)
>     _touchUser = models.CharField(max_length=255,
> db_column='attribute_touchUser', editable=False, default='Unknown')
>
>     class Meta:
>         db_table = 'attribute'
>         app_label = 'lib'
>         ordering = ( 'name', )
>
>     def __unicode__(self):
>         return self.name
>
> Could anybody point me into some directions in order to solve the
> problem?
>
> Regards,
> Daniel

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



Ajax with Django

2010-02-04 Thread Rohan Shah
Any good documentation available on how to implement AJAX with Django ?

-- 
Thanks and Regards,
Rohan Shah


++[>>++>+++>+<<<<-]
>++. >+++.---. ---.. >++. <<+. >--.
---.+++.

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



Can't able to accept the friend request in my django website

2021-12-02 Thread Rohan buks
I'm getting the following error:

Environment:


Request Method: GET
Request URL: http://127.0.0.1:8000/users/friend-request/accept/7/

Django Version: 2.1
Python Version: 3.8.10
Installed Applications:
['users.apps.UsersConfig',
 'feed.apps.FeedConfig',
 'crispy_forms',
 'stdimage',
 'django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']



Traceback:

File 
"/home/rohan/.local/share/virtualenvs/ByteWalk-master/lib/python3.8/site-packages/django/db/backends/utils.py"
 
in _execute
  85. return self.cursor.execute(sql, params)

File 
"/home/rohan/.local/share/virtualenvs/ByteWalk-master/lib/python3.8/site-packages/django/db/backends/sqlite3/base.py"
 
in execute
  296. return Database.Cursor.execute(self, query, params)

The above exception (no such table: main.users_profile__old) was the direct 
cause of the following exception:

File 
"/home/rohan/.local/share/virtualenvs/ByteWalk-master/lib/python3.8/site-packages/django/core/handlers/exception.py"
 
in inner
  34. response = get_response(request)

File 
"/home/rohan/.local/share/virtualenvs/ByteWalk-master/lib/python3.8/site-packages/django/core/handlers/base.py"
 
in _get_response
  126. response = self.process_exception_by_middleware(e, 
request)

File 
"/home/rohan/.local/share/virtualenvs/ByteWalk-master/lib/python3.8/site-packages/django/core/handlers/base.py"
 
in _get_response
  124. response = wrapped_callback(request, *callback_args, 
**callback_kwargs)

File 
"/home/rohan/.local/share/virtualenvs/ByteWalk-master/lib/python3.8/site-packages/django/contrib/auth/decorators.py"
 
in _wrapped_view
  21. return view_func(request, *args, **kwargs)

File "/home/rohan/ByteWalk-master/users/views.py" in accept_friend_request
  88. user1.profile.friends.add(user2.profile)

File 
"/home/rohan/.local/share/virtualenvs/ByteWalk-master/lib/python3.8/site-packages/django/db/models/fields/related_descriptors.py"
 
in add
  926. self._add_items(self.source_field_name, 
self.target_field_name, *objs)

File 
"/home/rohan/.local/share/virtualenvs/ByteWalk-master/lib/python3.8/site-packages/django/db/models/fields/related_descriptors.py"
 
in _add_items
  1088.
 self.through._default_manager.using(db).bulk_create([

File 
"/home/rohan/.local/share/virtualenvs/ByteWalk-master/lib/python3.8/site-packages/django/db/models/query.py"
 
in bulk_create
  465. ids = self._batched_insert(objs_without_pk, fields, 
batch_size)

File 
"/home/rohan/.local/share/virtualenvs/ByteWalk-master/lib/python3.8/site-packages/django/db/models/query.py"
 
in _batched_insert
  1152.     self._insert(item, fields=fields, using=self.db)

File 
"/home/rohan/.local/share/virtualenvs/ByteWalk-master/lib/python3.8/site-packages/django/db/models/query.py"
 
in _insert
  1133. return 
query.get_compiler(using=using).execute_sql(return_id)

File 
"/home/rohan/.local/share/virtualenvs/ByteWalk-master/lib/python3.8/site-packages/django/db/models/sql/compiler.py"
 
in execute_sql
  1285. cursor.execute(sql, params)

File 
"/home/rohan/.local/share/virtualenvs/ByteWalk-master/lib/python3.8/site-packages/django/db/backends/utils.py"
 
in execute
  100. return super().execute(sql, params)

File 
"/home/rohan/.local/share/virtualenvs/ByteWalk-master/lib/python3.8/site-packages/django/db/backends/utils.py"
 
in execute
  68. return self._execute_with_wrappers(sql, params, many=False, 
executor=self._execute)

File 
"/home/rohan/.local/share/virtualenvs/ByteWalk-master/lib/python3.8/site-packages/django/db/backends/utils.py"
 
in _execute_with_wrappers
  77. return executor(sql, params, many, context)

File 
"/home/rohan/.local/share/virtualenvs/ByteWalk-master/lib/python3.8/site-packages/django/db/backends/utils.py"
 
in _execute
  85. return self.cursor.execute(sql, params)

File 
"/home/rohan/.local/share/virtualenvs/ByteWalk-master/lib/python3.8/site-packages/django/db/utils.py"
 
in __exit__
  89. raise dj_exc_value.with

Re: secret api keys

2022-10-26 Thread Michael Rohan
Hi,

This is one of the drivers for my package:

https://django-yamlconf.readthedocs.io/en/latest/

Externalize setting values to yaml files.

Take care,
Michael

On Wed, Oct 26, 2022 at 9:45 PM Mike Dewhirst  wrote:

> On 27/10/2022 3:32 pm, Mike Dewhirst wrote:
>
> Not a dumb question but frequently asked.
>
> There are two approaches - one is to export your secrets as environment
> vars and read them from there. The other is to keep them in disk files and
> read them as required.
>
> In both cases the idea is to keep secrets out of your code and thus out of
> your repo.
>
> I prefer the latter approach.
>
>
> Further to that, the secrets are consumed by your code on the server which
> constructs html from a template rendered with values inserted by your code
> and sends that all to the browser which made the request.
>
> So if you don't include your secrets in your constructed html they won't
> appear in the browser and will remain secret.
>
> My preferred approach (above) is only secure if the files containing the
> secrets are stored on the server in a location accessible to the web server
> (Apache perhaps in your case) but access is denied to a browser.
>
> In my case, I use a "creds" directory which satisfies that scenario.
>
>
> Cheers
>
> Mike
>
>  Original message 
> From: john fabiani  
> Date: 27/10/22 02:09 (GMT+10:00)
> To: django-users@googlegroups.com
> Subject: secret api keys
>
> Hi,
>
> Maybe a dumb question but if I add secret keys in my settings.py file
> (or should it be placed) will they be protected from the front end side
> (the part that is displayed to the user of the website).
>
> For example I have a secret key to access Authorize Net.  Will it be
> protected from someone opening the website and using chrome to see the
> source?
>
> Johnf
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/eeb82d0a-f18d-c253-a613-24c685307f41%40jfcomputer.com
> .
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/6068b999-3cca-f4e3-cb58-493e08800187%40dewhirst.com.au
> <https://groups.google.com/d/msgid/django-users/6068b999-3cca-f4e3-cb58-493e08800187%40dewhirst.com.au?utm_medium=email&utm_source=footer>
> .
>
>
>
> --
> Signed email is an absolute defence against phishing. This email has
> been signed with my private key. If you import my public key you can
> automatically decrypt my signature and be sure it came from me. Just
> ask and I'll send it to you. Your email software can handle signing.
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/51795697-9488-777d-a2de-53517c3e8f46%40dewhirst.com.au
> <https://groups.google.com/d/msgid/django-users/51795697-9488-777d-a2de-53517c3e8f46%40dewhirst.com.au?utm_medium=email&utm_source=footer>
> .
>


-- 
Michael Rohan
mro...@acm.org

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOCsNFjA_5G6SgVtquiqAxxMp0yOaiKE67fuVZ%2BSCN9%2B9Q1mQQ%40mail.gmail.com.


Re: ANN: django-yamlconf 1.0.0

2019-02-28 Thread Michael Rohan
Hi Folks,

Have published to documentation on this module to readthedocs;

https://django-yamlconf.readthedocs.io/en/latest/

Take care,
Michael.

On Mon, Aug 13, 2018 at 5:39 PM Michael Rohan 
wrote:

> Hi Folks,
>
>
>
> The package Django-yamlconf 1.0.0 has been uploaded to pypi.  There are a
> number of YAML (and other formats) support modules for managing Django
> settings.  The main difference here is:
>
>1. The directory tree is used to store multiple YAML config files with
>definitions higher up the tree over-riding definitions lower down (intent
>being a committed version for development values, production settings being
>in, e.g., “/var/myapp” or mapped into a container).
>2. The settings that can be adjust is not constrained: simply add a
>definition to a YAML file loaded and it’s available as a setting (the setup
>is an import and a load at the end of the settings file)
>3. Can set elements within dictionaries in the settings using a dot’ed
>notation, e.g., DATABASES.default.NAME: mydb
>4. For debugging purposes, a view is available which can be added to
>the supported URLs
>
>
>
> For more information and deeper documentation, see the GitHub page,
>
>
>
> https://github.com/vmware/django-yamlconf
>
>
>
> Feedback, bug reports, etc., are welcome.
>
>
>
> Take care,
>
> Michael.
>
> --
> 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 to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/7db78e8c-d965-4d7f-8067-826468227b6b%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/7db78e8c-d965-4d7f-8067-826468227b6b%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Michael Rohan
mro...@acm.org

-- 
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 to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOCsNFhY_Ge0v95%2B-foVznKF6PUWa8eqxZ76OX_zscMt%2B-av3w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


ANN: django-yamlconf 1.1.0

2019-03-17 Thread Michael Rohan
Hi Folks,

Have release v1.1.0 for django-yamlconf, a module supporting Django
settings via YAML files (searching up the directory hierarchy, e.g., in a
K8s environment, adding a "final" set of settings via "/APPLICATION.yaml",
see the documentation a https://django-yamlconf.readthedocs.io/en/latest/
for more detailed info.  The primary driver was the update to PyYAML load
function to require a Loader kwarg.

Take care,
Michael.

-- 
Michael Rohan
mro...@acm.org

-- 
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 to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOCsNFjwxeBPMtfRFczc%3Dn%2B5Nku5nShDbFLX-Ukz2y8LxbXxFw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


New functionalities expected in Django 2.

2017-06-13 Thread Rohan Purekar
Is django 2 going to have inbuilt package for creating API's to cater to 
ajax requests and JSON responses for which we use DRF. Another thing which 
was on my mind was If Django 2 will come out with support for Token Auth as 
a default package along with the current session based login.

-- 
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 to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b539390d-dea4-418f-a94f-94b34447c047%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to set custom template in Class PasswordResetView

2017-06-13 Thread Rohan Purekar
I have implemented class based password reset view as instructed in 
django1.11 but the template being used is the default template, I want to 
use a custom template. Where I am stuck is If I have to use a custom 
template then I will have to call get and post functions to return the 
template to be rendered but what do I write in those functions I am not 
getting that part. 

Thanks in advance

-- 
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 to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4b879e25-e02c-41d7-a459-3dc19bae6d0d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


ANN: django-yamlconf v1.2.1 is available

2020-02-24 Thread Michael Rohan
 Hi Folks,

Have release v1.2.1 for django-yamlconf, a module supporting Django
settings via YAML files (searching up the directory hierarchy, e.g., in a
K8s environment, adding a "final" set of settings via "/APPLICATION.yaml",
see the documentation a https://django-yamlconf.readthedocs.io/en/latest/
for more detailed info.

The updates for the this release are:

- Tagged with ``v1.2.1``.
- Fixed the long description which caused failures for "pip install" of
v1.2.0.

Take care,
Michael.


-- 
Michael Rohan
mro...@acm.org

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOCsNFjR4kVsisswSPkOUWD6zVjfK%3DBZQJ9yQ5R7tp9mpPEyGg%40mail.gmail.com.


Re: sphinx inside

2020-05-01 Thread Michael Rohan
Hi,

I believe it's probably easiest to simply create the Sphinx html files in 
one of the static directories (probably should add to the top level one if 
you have one, or one of the apps if the docs are app specific) and just let 
the static file handling serve them.  You could use whitenoise to have 
Django serve them (if you want to go that route).

Take care,
Michael.

On Friday, May 1, 2020 at 1:02:59 PM UTC-7, bengoshi wrote:
>
> I tried a 
>
> path('docs/', TemplateView.as_view(template_name="docs/html/index.html"))
>
> then I can see the index.html but without css and no link works..
>
> Greetings
>
> bengoshi
> On 5/1/20 4:25 PM, Motaz Hejaze wrote:
>
> Make a view that returns a template only , and give it a url
>
> On Fri, 1 May 2020, 10:09 am Kai Kobschätzki,  > wrote:
>
>> Hi Amit,
>>
>> thanks for your response. But in this way, I can't use the sphinx 
>> templates, the links are not correct and after every new make html (or 
>> using sphinx-autobuild) I have to copy the changed or new files. Are there 
>> no more likable way?
>>
>> Greetings
>>
>> bengoshi
>> On 5/1/20 1:53 AM, Amit Gupta wrote:
>>
>> Hii  
>> If u want to just add your file in your django project u can probably 
>> copy and paste the file in your project file and after that you can 
>> successfully use your file in the project by just writing the name of  your 
>> file with correct extension
>>
>> On Fri, 1 May, 2020, 1:29 AM Kai Kobschätzki, > > wrote:
>>
>>> Hi,
>>>
>>> I installed sphinx and I get an documentation in
>>> project_main/docs/_build/html, starting with html/index.html. In so far
>>> - fine.
>>>
>>> Now I want to present this documents inside my project so I can see in
>>> the nav-bar a "doc" where I can see them. But I have no idea how to
>>> start it. I tried it with a simple function in a view inside an app, but
>>> then I need a symbolic-link for getting the index.html, but then I can't
>>> get the rest of the documentation.
>>>
>>> I tried to google it but I only find tutorials for using sphinx to make
>>> a documentation for the django-project but I didn't find a tip how I can
>>> realize it.
>>>
>>> Could anyone give a kick-off for it or a link for a tutorial? Perhaps I
>>> have only the wrong keywords..
>>>
>>> Greetings
>>>
>>> bengoshi
>>>
>>>
>>>
>>> -- 
>>> 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...@googlegroups.com .
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/17689333-b06c-1dfc-1f18-341689914c42%40gmail.com
>>> .
>>>
>> -- 
>> 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...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CAGCPjY-tNBKxj%3Dk-e9ew_6DtySK%2BDPE1QJyyMsXi%2Bjt4f-qA4g%40mail.gmail.com
>>  
>> 
>> .
>>
>> -- 
>> 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...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/6e32e790-46bd-bb1b-24a2-3e765f0a273a%40gmail.com
>>  
>> 
>> .
>>
> -- 
> 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...@googlegroups.com .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAHV4E-c741j1swLvKEmjtrmJeC5RfDzxV5XEBvpvsZLZ8W9FPg%40mail.gmail.com
>  
> 
> .
>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/692d8b57-8103-4f2b-9ad9-c8390194ac26%40googlegroups.com.


Re: How can I create a new table without primary key filed?

2015-11-24 Thread Rohan Nagalkar
Hi, Though its a too old question, but just thought of answering because i 
also got the same issue
One thing you can do is first migrate(syncdb) to bdatabase and then load 
the data.


On Monday, 10 November 2008 16:29:37 UTC+5:30, XQ Kuang wrote:
>
> Hi, all. 
>
> How can I create a new table without primary key in Django modeling. ? 
>
> I'm porting a old program to Django web framework. After inspect 
> database to modules.py and then syncdb, It create the id filed with 
> primary key attribute, how can I disable this feature ?

-- 
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 to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c27e5bf7-9554-4cfb-850f-024e35d3015a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


ANN: django-yamlconf 1.0.0

2018-08-13 Thread Michael Rohan


Hi Folks,

 

The package Django-yamlconf 1.0.0 has been uploaded to pypi.  There are a 
number of YAML (and other formats) support modules for managing Django 
settings.  The main difference here is:

   1. The directory tree is used to store multiple YAML config files with 
   definitions higher up the tree over-riding definitions lower down (intent 
   being a committed version for development values, production settings being 
   in, e.g., “/var/myapp” or mapped into a container).
   2. The settings that can be adjust is not constrained: simply add a 
   definition to a YAML file loaded and it’s available as a setting (the setup 
   is an import and a load at the end of the settings file)
   3. Can set elements within dictionaries in the settings using a dot’ed 
   notation, e.g., DATABASES.default.NAME: mydb
   4. For debugging purposes, a view is available which can be added to the 
   supported URLs

 

For more information and deeper documentation, see the GitHub page,

 

https://github.com/vmware/django-yamlconf

 

Feedback, bug reports, etc., are welcome.

 

Take care,

Michael.

-- 
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 to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7db78e8c-d965-4d7f-8067-826468227b6b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django Mysql Bulk_Create Ids

2020-09-27 Thread Rohan Nahata
How can we make this happen? 
What steps would be needed so that bulk_create ends up returning the ids of 
the items that just got created? I don't want to be machine gunning my db 
with save statements to retrieve ids. 

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/05b8f31e-f4e7-4f3f-b94a-2dea27568102n%40googlegroups.com.


Re: Django SECRET KEY

2020-11-04 Thread Michael Rohan
Hi Folks,

An extension of this local file is the project django-yamlconf (See
https://django-yamlconf.readthedocs.io/en/latest/).  It allows general
over-ride of settings.  It is my project (full disclosure).

Take care,
Michael.

On Wed, Nov 4, 2020 at 3:51 PM Mike Dewhirst  wrote:

> On 5/11/2020 1:54 am, Kegan Ronholt wrote:
> > What is the best practice for hiding SECRET key in settings.py in
> > production. I am finding all sorts of different ways to do it, but
> > none seem to work.
>
> I keep it in a file left out of the repository but in a "standard"
> location known to the web server.
>
> I have a simple utility to read the file into a list and just use a list
> item as the secret key. I like it because there are typicaly half a
> dozen different secrets per project. They include database credentials,
> email server details, captcha keys and so on. It is handy having a
> system to get all such stuff without needing to store it unsafely. I
> also like using the top few lines for credentials and lower lines for
> comments.
>
> My standard location for such files includes a directory name based on
> project name established in the settings so I don't have to think too
> hard to manage credentials of any sort when creating new projects.
>
> My view is that the only way secrecy can be compromised is if the server
> itself is pwned. At that point you have to start again anyway.
>
> Cheers
>
> Mike
>
> >
> >
> > --
> > 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
> > <mailto:django-users+unsubscr...@googlegroups.com>.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/django-users/6660766c-6ed4-4500-9006-c8289158f749n%40googlegroups.com
> > <
> https://groups.google.com/d/msgid/django-users/6660766c-6ed4-4500-9006-c8289158f749n%40googlegroups.com?utm_medium=email&utm_source=footer
> >.
>
>
> --
> Signed email is an absolute defence against phishing. This email has
> been signed with my private key. If you import my public key you can
> automatically decrypt my signature and be sure it came from me. Just
> ask and I'll send it to you. Your email software can handle signing.
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/ad2ead73-7a13-b5ac-ee10-cf60edc92323%40dewhirst.com.au
> .
>


-- 
Michael Rohan
mro...@acm.org

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOCsNFiQ%2BoTW-gSjh37jg0CBvFOw6kc3jrMvfDTB15LtP0BLiQ%40mail.gmail.com.


ANN: django-yamlconf v1.4.0 is available

2021-03-03 Thread Michael Rohan
Hi Folks,

Have released v1.4.0 for django-yamlconf, a module supporting Django
settings via YAML files (searching up the directory hierarchy, e.g., in a
K8s environment, adding a "final" set of settings via "/APPLICATION.yaml",
see the documentation a https://django-yamlconf.readthedocs.io/en/latest/
for more detailed info.

The updates for the this release are:

- Added support for JSON encoded environment values if decorated with
":jsonenv".  If JSON decoding fails (invalid JSON string), the value is
used as is.  This allows the definition of more complex values via the
environment, list, dictionaries, etc.  This can be used in K8s
environments, e.g., Concourse (for me).

- Added a `CODE-OF-CONDUCT` file for contributors.

Take care,
Michael


-- 
Michael Rohan
mro...@acm.org

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOCsNFhSOuHUGur-ruPmvFrZEJ7mndGfd0B9x5cgCKV3Cn%3D4pQ%40mail.gmail.com.


Re: How to best secure environment variables (secret key, passwords etc.) stored in .yml files?

2020-01-30 Thread Michael Rohan
Hi,

Just fyi, it was, in part, to solve this problem that I implemented the
django-yamlconf module:

https://django-yamlconf.readthedocs.io/en/latest/

While getting the data into either a private yaml file or env variable in
the container isn't addressed, it does allow injecting the values into the
Django app without modifying the committed sources.

Take care,
Michael.

On Thu, Jan 30, 2020 at 6:46 AM Chris Wedgwood  wrote:

> Hi Tom
>
> You are definitely not overthinking this. it's important.
>
> This is an area that has baked my noodle for a while now and I always am
> left wondering "Do I have this right?" "Am I vulnerable to attack?" .
> and I still haven't figured it out completely. It's like static files  I
> never really feeel like I get it entirely :)
>
> Firstly you should never need to store a password/token/secret in Source
> Control ever. If you are stop and think there must be a better way.
>
> I use environment variables .env to store my secrets but the trick is
> ALWAYS put that in your .gitignore  file. If you start a new git repository
> there is an option to create a .gitignore file
> for Python that is a great starting point.
>
> To complement my *.env* file it has a .env.example file that I DO put in
> source control with a dummy password.
>
> .env file:
>
> MAILGUN_API_KEY =asjdhasds78dy9s8dy012287e210eu209e72
>
> .env.example:
>
> MAILGUN_API_KEY=ThisIsNotARealToken
>
> So when I do local development  I can populate my .env fie with local dev
> secrets.
>
> For production deployments, I use *Ansible *for which I provide
> production tokens and secrets in a separate file also not in source control.
>
> The Ansible deployment requires an ssh password that I store in a Password
> Manager that has two-factor authentication.
>
> The docker-compose file can read environment variables from the .env file.
>
> Have a look at Django-Cookiecutter and see how they do it. That helped me
> a lot when I started out
>
> cheers
> Chris
>
>
>
>
>
>
>
>
>
>
>
> On Thursday, 30 January 2020 12:41:01 UTC, Tom Moore wrote:
>>
>> Hi there, I'm following the guidelines by making sure the environment
>> variables are stored outside of the settings.py files.
>>
>> The project is "dockerised" and so the environment variables have been
>> stored in files *docker-compose.yml* and *docker-compose-prod.yml*.
>>
>> This includes things like the project's secret key, API keys, and
>> database passwords.
>>
>> *My question is: *
>> • Just because environment variables are stored in .yml files, won't they
>> be equally insecure the moment I commit the project folder to a git repo
>> (and especially if I push that repo to GitHub)?
>> e.g. the Secret Key will forevermore be stored in the git repo (in
>> earlier versions, even if I later move it to another file in subsequent
>> commits).
>>
>> Is there an even more secure way of storing environment variables? Or am
>> I overthinking it (as I'm the only developer and the GitHub repo is set to
>> Private)?
>>
>> Many thanks in advance for your help.
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/55f28dec-7c9a-4cae-b658-f89772aa1bd7%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/55f28dec-7c9a-4cae-b658-f89772aa1bd7%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Michael Rohan
mro...@acm.org

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOCsNFhLqucCRWb%3DbsneUdKVuWkNqQR%3DKL_P3zVXAAthzDxAPw%40mail.gmail.com.


Re:

2020-02-22 Thread ROHAN Gupta
Check this out:-
 https://realpython.com/modern-web-automation-with-python-and-selenium/

On Sat, 22 Feb 2020, 19:39 Suraj Kumar, 
wrote:

> Do you know Automation through Python.
> I want to learn automation tools.
>
> Tools like appium, selenium
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACCwaoVZuL2awcQyPo0YPHaaB3k51PsxbN70NOJotXyctaYvCA%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGbkg7pv2PHauitkOCTdybVG0rYVc8-wpN8ZdF%3DA_NUWMZRSQQ%40mail.gmail.com.


ANN: django-yamlconf v1.2.0 is available

2020-02-23 Thread Michael Rohan
 Hi Folks,

Have release v1.2.0 for django-yamlconf, a module supporting Django
settings via YAML files (searching up the directory hierarchy, e.g., in a
K8s environment, adding a "final" set of settings via "/APPLICATION.yaml",
see the documentation a https://django-yamlconf.readthedocs.io/en/latest/
for more detailed info.

The updates for the this release are:

- Tagged with ``v1.2.0``.
- Updates to support Django 3.0: Simply use "`six`" instead of the
  support "`django.utils.six`" package and use "`render`" instead of
  "`render_to_response`".
- `ycsysfiles` should generate executable files if the source template
  file is executable.
- Ensure the absolute path is used when searching for YAML control
  files.  This issue is seen when running Django apps under uWSGI
  control.
- Added the built-in attribute ``CPU_COUNT`` (primarily for use in uWSGI
  ini files) giving the number of available CPUs.

Take care,
Michael.

-- 
Michael Rohan
mro...@acm.org

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOCsNFhTf1Ar3paJ-3tJdVVZ1qO%2B-FWEzDOkiDtQwOBHJwiKRw%40mail.gmail.com.