Re: Digest for django-users@googlegroups.com - 14 updates in 2 topics

2024-02-24 Thread EDWIN NIWAHA
I am Interested.
+256 787320738

On Sat, Feb 24, 2024, 4:01 PM  wrote:

> django-users@googlegroups.com
> 
>  Google
> Groups
> 
> 
> Topic digest
> View all topics
> 
>
>- Exciting Opportunity: Join Our Django WhatsApp Bulk Messaging
>Project! <#m_1945082586141920503_group_thread_0> - 13 Updates
>- Data model design questio: graph in database
><#m_1945082586141920503_group_thread_1> - 1 Update
>
> Exciting Opportunity: Join Our Django WhatsApp Bulk Messaging Project!
> 
> agoume koufana stephane : Feb 23 01:49PM +0100
>
> Hello I'm interested ,
> My number : +33 646523241 .
> Available on whatsapp and Telegram .
> Regards,
>
>
>
>
> *---*
> *software ingeneer ,*
> *interested by enterprise architecture and social entrepreneurship*
> *Developpeur web & mobile Full stack | CDO ~#one day *
>
> *skype: stephane.agoume1*
> *mail : ago...@stephaneagoume.com *
> *tel : +33 646523241*
>
>
> Le dim. 18 févr. 2024 à 17:48, SURAJ TIWARI  a
> écrit :
>
> fady ghalayiny : Feb 23 03:47PM +0200
>
> Interested where is the link to join the group?
>
> On Wed, Feb 21, 2024, 9:42 PM Najeeb Mansur Sayaya 
> wrote:
>
> Zeeshan Iqbal : Feb 23 08:58AM -0800
>
> Hi,
> Thanks for giving such a great opportunity. Consider adding me in your
> team. I would love to learn this skill for bulk messaging.
>
> Regard,
>
> Zeeshan Iqbal
>
> On Sunday, February 18, 2024 at 9:48:37 PM UTC+5 SURAJ TIWARI wrote:
>
> Sekou Dynasty : Feb 23 06:18PM +0100
>
> Hi,
>
> Thank you for such a wonderful opportunity. And would it be possible to add
> +234 815 738 8907?
>
> I do appreciate your time.
>
> On Fri, 23 Feb 2024 at 18:06, Zeeshan Iqbal  >
> wrote:
>
> Francis Akabo : Feb 23 05:47PM
>
> I am interested in this project. Kindly get me started.
>
> Regards.
>
> talk fun : Feb 23 11:42PM +0530
>
> Hi django users
> My dear friends,
> Can anyone help to create django food ordering website
> It is assessment given by company
> Kindly any one help
>
> On Fri, 23 Feb, 2024, 11:18 pm Francis Akabo, 
> wrote:
>
> talk fun : Feb 23 11:43PM +0530
>
> Hi i need help to create django food ordering website
> It is assessment to complete
> Kindly need your help
>
> Sang : Feb 23 11:50PM +0530
>
> I can help you with building food ordering web app in django. Catch me up
> at sangr...@hotmail.com
>
> Salaudeen Ridwan : Feb 23 07:29PM +0100
>
> I am interested
>
> kabika Dieumerci : Feb 23 07:44PM +0200
>
> Hi, add : +25766320871
>
> Mwesigwa Joshua : Feb 23 08:26PM +0300
>
> Thanks alot for your invitation to this project. Am very excited to express
> my interest in working with you so as to familiarize myself with the core
> workarounds of the framework. Please consider me on +256762511280. Thank
> you
>
> Benjamin Nwoke : Feb 23 06:52PM +0100
>
> I'm interested, I wish to have the details
>
> Lakhjeet Samra : Feb 24 09:09AM
>
> Hi,
>
> I am interested to join django developers team. I want to know how to
> import calendar in Django project, so my users can add their future events.
>
>
> Lakhjeet
>
> Back to top <#m_1945082586141920503_digest_top>
> Data model design questio: graph in database
> 
> Sébastien Hinderer : Feb 23 09:20PM
> +0100
>
> Dear all,
>
> Using the mailing list rather than the forum because, like many visually
> impaired people, I find mailing lists way easier to use than forums, I
> hope the list is still active.
>
> I need to store in database and manipulate graphs of which both
> vertices and edges can each be of several types.
>
> At the moment I am modelling this as follows:
>
> class Vertex(models.Model):
> pass
>
> class Vertex_type_1(Vertex):
> # Data specific to vertices of type 1
> ...
>
> class Vertex_type_2(Vertex):
> # Data specific to vertices of type 2
> ...
>
> class Edge(models.Model):
> src = models.ForeignKey(Vertex,
> on_delete=models.CASCADE, related_name="+")
> dst = models.ForeignKey(Vertex,
> on_delete=models.CASCADE, related_name="+")
> class Meta:
> unique_together = ['src', 'dst']
>
> class Edge_type_1(Edge):
> # Data specific to edges of type 1
> ...
>
> class Edge_type_2(Edge):
> # Data specific to edges of type 2
> ...
>
> I will have to wwite algorithms that work at the graph level, e.g.
> to find paths. However, once a path has been found, at some point it
> will become necessary to see which types of vertices and edges it is
> that are involved in the path 

Django server not working on my windows pc

2019-10-16 Thread Edwin Cooper Van Dyke
I do exactly same as tutorial but when I map url, it get either server not 
connected or circular import error, no sr import Error

-- 
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/fa3a8cd0-fa0e-484b-9403-ddd9211796a3%40googlegroups.com.


Django Client Put method Data Access from Request View

2013-06-07 Thread Edwin Lunando
Hi everyone,

I'm building a REST API and i need to use the Client.put() method. For 
example 

response = self.client.put(reverse('api:update_user'), {access_token: 
'123123123123'})

When I run the test, I do not know where the data is placed. request.GET 
and request.POST is empty. request.META['QUERY_STRING'] is empty. Where are 
my PUT data?

I tried to see the put method code and it shows like this:

def put(self, path, data='', content_type='application/octet-stream',
**extra):
"Construct a PUT request."
return self.generic('PUT', path, data, content_type, **extra)

def generic(self, method, path,
data='', content_type='application/octet-stream', **extra):
parsed = urlparse(path)
data = force_bytes(data, settings.DEFAULT_CHARSET)
r = {
'PATH_INFO':  self._get_path(parsed),
'QUERY_STRING':   force_str(parsed[4]),
'REQUEST_METHOD': str(method),
}
if data:
r.update({
'CONTENT_LENGTH': len(data),
'CONTENT_TYPE':   str(content_type),
'wsgi.input': FakePayload(data),
})
r.update(extra)
return self.request(**r)

The data parameter is included to 'wsgi.input' not to QUERY_STRING. How can 
i access my data from the request object at my view?

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: PHP vs Django

2013-01-27 Thread Edwin Lunando
Although, your question is out of topic, let me share my experience. Most 
of the times, framework skill is only a plus in your resume. Your algorithm 
skill, application design, and analysis is the major component that will 
determine that you will be hired or not(if you apply as a software 
engineer). You will undergo several interview including technical interview 
after applying to one of the companies you've listed. 

On Monday, January 28, 2013 10:54:21 AM UTC+7, Vijaya Reddy wrote:
>
> Is it possible to get job in companies like Google,Amazon,Cisco,.
>
>
> On Sun, Jan 27, 2013 at 7:50 PM, Nikhil Verma 
>  > wrote:
>
>> Well i would say  its all about money and passion for programming.In Web 
>> development you are uncertain which you have to learn next.
>>
>> My personnel opinion:-
>>
>> php is a crap. Its a horrible language.
>>
>> Python well i would say the king of all and the framework Django is 
>> amazing.
>>
>> Thanks
>>
>>
>>
>> On Mon, Jan 28, 2013 at 9:10 AM, Londerson Araújo 
>> > > wrote:
>>
>>> Man, i work with PHP for 5 years more or less, and Python is the 
>>> the answer for my life. 
>>>
>>> -- 
>>> 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...@googlegroups.com .
>>> To post to this group, send email to django...@googlegroups.com
>>> .
>>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>  
>>>  
>>>
>>
>>
>>
>> -- 
>> Regards
>> Nikhil Verma
>> +91-958-273-3156
>>
>>  -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com
>> .
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 
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.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: PHP vs Django

2013-01-27 Thread Edwin Lunando
Your question final answer is always go with your preference. PHP and 
Django is a whole different thing. PHP is a language and Django is a 
framework. If I tell you what to choose to build a web app, go for Django 
because it is a framework. Code a web app from scratch by PHP is 
just tormenting. PHP dose have a lot of framework that you can learn. will 
list some of both advantages.

PHP:

   1. Web standard
   2. Easy to deploy
   3. Lot's of framework choices
   4. Easier than Django to find host server that support PHP

Django:

   1. It's Python
   2. Django full-framework feature really lessen the code you need to write
   3. Django-admin give instant content management system that 
   production-ready
   4. Lot's of feature that can be found on Django documentation page.


On Monday, January 28, 2013 10:36:37 AM UTC+7, Vijaya Reddy wrote:
>
> Hello All,
>
> I want to build my career in web development. I have learned CSS,HTML,JS. 
> Now i am planning to learn either PHP or Dajngo. I have good knowledge in 
> python.
> Which one is good(Django or PHP)?
>
>
> Thanks and Regards
> Vijaya Reddy
>

-- 
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.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Model user with pk 1L does not exist at Admin

2013-01-27 Thread Edwin Lunando
Here is my model:

class UserSIMS(models.Model):
TATA_USAHA = 0
DOSEN = 1
MAHASISWA = 2
TYPE_CHOICES = ((TATA_USAHA, 'Tata Usaha'), (DOSEN, 'Dosen'), 
(MAHASISWA, 'Mahasiswa'))
user = models.OneToOneField(User)
type = models.IntegerField(choices=TYPE_CHOICES) # 0 = TU 1 = dosen 2 = 
mahasiswa

class Group(models.Model):
name = models.CharField(max_length=100)
lecturer = models.ForeignKey(User, null=True, blank=True, 
limit_choices_to={'usersims': UserSIMS.DOSEN})
company = models.ForeignKey(Company, null=True, blank=True)
tor = models.FileField(upload_to='tor', null=True, blank=True)
logact = models.FileField(upload_to='logact', null=True, blank=True)
document = models.FileField(upload_to='document', null=True, blank=True)
created_at = models.DateTimeField(null=True, blank=True)
updated_at = models.DateTimeField(null=True, blank=True)

def save(self, *args, **kwargs):
if not self.id:
self.created_at = datetime.datetime.today()
self.updated_at = datetime.datetime.today()
super(Group, self).save(*args, **kwargs)

And this is my group admin model

class GroupAdmin(admin.ModelAdmin):
list_display = ("name", "lecturer", "company")
def formfield_for_foreignkey(self, db_field, request, **kwargs):
if db_field.name == "lecturer":
kwargs["queryset"] = 
User.objects.filter(usersims__type=UserSIMS.DOSEN)
return super(GroupAdmin, self).formfield_for_foreignkey(db_field, 
request, **kwargs)

admin.site.register(Group, GroupAdmin)

When i tried to update the group or add a new group, there are error like 
this "Model user with pk 1L does not exist". 




What should I do? Thanks in advance. :D

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Problems with first tutorial

2012-08-28 Thread Snorre Edwin
I
>
> It makes sense, since my guess is that you have Python 3.2 installed. 
> Django 1.4 does not support python 3.x, only 2.5 through 2.7. Django 1.5 
> will be the first release supporting Python 3.x. 
>
> -- 
> Melvyn Sopacua 
>

It doesnt make much sense when i have django version 1.5:
C:\Prosjekter\Djangotest\testproject>django-admin.py version
1.5

Any other clues to what this might be? 

-- 
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/-/dISk6GW3dfYJ.
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: Problems with first tutorial

2012-08-28 Thread Snorre Edwin
C:\Prosjekter\Djangotest\testproject>python manage.py shell --traceback
Traceback (most recent call last):
  File 
"C:\Python32\lib\site-packages\django\core\management\commands\shell.py", 
line 64, in handle_noargs
self.run_shell(shell=interface)
  File 
"C:\Python32\lib\site-packages\django\core\management\commands\shell.py", 
line 48, in run_shell
raise ImportError
ImportError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python32\lib\site-packages\django\core\management\base.py", line 
222, in run_from_argv
self.execute(*args, **options.__dict__)
  File "C:\Python32\lib\site-packages\django\core\management\base.py", line 
252, in execute
output = self.handle(*args, **options)
  File "C:\Python32\lib\site-packages\django\core\management\base.py", line 
382, in handle
return self.handle_noargs(**options)
  File 
"C:\Python32\lib\site-packages\django\core\management\commands\shell.py", 
line 92, in handle_noargs
import user
ImportError: No module named user
ImportError: No module named user


Does it make any sense to you?

On Tuesday, August 28, 2012 11:47:09 AM UTC+2, Melvyn Sopacua wrote:
>
> On 28-8-2012 11:21, Snorre Edwin wrote: 
> > It didnt seem to work. All i get is the error: 
> > 
> > C:\Prosjekter\Djangotest\testproject>python manage.py shell 
> > ImportError: No module named user 
>
> The traceback should show where the import error is raised: 
> python manage.py shell --traceback 
>
> -- 
> Melvyn Sopacua 
>

-- 
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/-/7EfdIYBayF8J.
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: Problems with first tutorial

2012-08-28 Thread Snorre Edwin
It didnt seem to work. All i get is the error:

C:\Prosjekter\Djangotest\testproject>python manage.py shell
ImportError: No module named user

Maybe i do it from the wrong directory, this is my buildtree:

Djangotest>testproject>testproject(have settings.py and everything created 
with djangoadmin),polls(have models, views and stuff),manage.py

If first tried to create the batch file in the first testproject folder, 
the one above where manage.py is. That didnt work.
I also tried to move it down to the next folder and it didnt work there 
either.
This is the batch file i wrote:

set TESTPROJECT_HOME=%CD%
set DJANGO_SETTINGS_MODULE=testproject.settings
set PYTHONPATH=%TESTPROJECT_HOME%

Any clue why it doesnt work?

On Tuesday, August 28, 2012 4:53:58 AM UTC+2, trebor63 wrote:
>
> I hope this helps, when working under windows (XP/7) this just works for 
> me.
>
> Replace  with whatever you have named it.
>
> From the directory above where the project was created create a batch file 
> (ie .bat) containing the following
>
> set _HOME=%CD%
>
> set DJANGO_SETTINGS_MODULE=.settings
>
> set PYTHONPATH=%_HOME%
>
> You can add any other additional pythonpath requirements with the 
> delimiter of a semicolon ‘;’
>
>  
>
> You could also hardcode the “_HOME” variable, but this is up to 
> you
>
>  
>
> Once done the following should work for you via the command prompt.
>
>  
>
> Run the batch file above from the directory it was created in
>
> 
>
> cd 
>
> manage.py shell
>
> On Tuesday, 28 August 2012 09:01:25 UTC+10, Snorre Edwin wrote:
>>
>> Im on the Playing with the API part and seem to catch some troubles.
>> Everything has gone smoothly until this part.
>>
>> I write this and get the next error. This is with my enviromen_variable: 
>> DJANGO_SETTINGS_MODULE 
>> set to where I can find the settings.py in my project.
>>
>> C:\Prosjekter\Djangotest\testproject>python manage.py shell
>> ImportError: Could not import settings 
>> 'C:\Prosjekter\Djangotest\testproject\testproject' (Is it on sys.path?): 
>> Import by filename is not supported.
>>
>> With out the env variable I get this error:
>> C:\Prosjekter\Djangotest\testproject>python manage.py shell
>> ImportError: No module named user
>>
>> I have done the sync part and I can see that the postgreSQL have the 
>> tables in its database.
>> I have also done everything right until this part.
>>
>> As i understood, I did not have to set env variable when I used python 
>> manage.py shell.
>>
>> Can someone help me please:)
>>
>

-- 
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/-/qi2KY8SzDKoJ.
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.



Problems with first tutorial

2012-08-27 Thread Snorre Edwin
Im on the Playing with the API part and seem to catch some troubles.
Everything has gone smoothly until this part.

I write this and get the next error. This is with my enviromen_variable: 
DJANGO_SETTINGS_MODULE 
set to where I can find the settings.py in my project.

C:\Prosjekter\Djangotest\testproject>python manage.py shell
ImportError: Could not import settings 
'C:\Prosjekter\Djangotest\testproject\testproject' (Is it on sys.path?): 
Import by filename is not supported.

With out the env variable I get this error:
C:\Prosjekter\Djangotest\testproject>python manage.py shell
ImportError: No module named user

I have done the sync part and I can see that the postgreSQL have the tables 
in its database.
I have also done everything right until this part.

As i understood, I did not have to set env variable when I used python 
manage.py shell.

Can someone help me please:)

-- 
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/-/K6AnN76HChoJ.
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: Weird behaviour in Django logging (Django 1.3 RC)

2011-03-09 Thread Edwin
I've had help from SO:
http://stackoverflow.com/questions/5249265/strange-behaviour-in-django-logging-django-1-3-rc/5250829#5250829

The solution is simply to explicitly call self.format(record) on my
emit() method under DatabaseHandler.

Hope this helps whoever face a similar problem.


-Edwin

On Mar 7, 8:58 am, Edwin <edwinja...@gmail.com> wrote:
> Sorry I wasn't clear enough. Here's the stack trace:
>
> Traceback:
> File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
> base.py" in get_response
>   89.                     response = middleware_method(request)
> File "/home/user/projects/django/../django/common/middleware.py" in
> process_request
>   27.             return login(request, **defaults)
> File "/usr/local/lib/python2.6/dist-packages/django/utils/
> decorators.py" in _wrapped_view
>   93.                     response = view_func(request, *args,
> **kwargs)
> File "/usr/local/lib/python2.6/dist-packages/django/views/decorators/
> cache.py" in _wrapped_view_func
>   79.         response = view_func(request, *args, **kwargs)
> File "/home/user/projects/django/../django/apps/django_extra_auth/
> views.py" in login
>   57.             auth_login(request, form.get_user())
> File "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/
> __init__.py" in login
>   85.     user_logged_in.send(sender=user.__class__, request=request,
> user=user)
> File "/usr/local/lib/python2.6/dist-packages/django/dispatch/
> dispatcher.py" in send
>   172.             response = receiver(signal=self, sender=sender,
> **named)
> File "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/
> models.py" in update_last_login
>   50.     user.save()
> File "/usr/local/lib/python2.6/dist-packages/django/db/models/base.py"
> in save
>   460.         self.save_base(using=using, force_insert=force_insert,
> force_update=force_update)
> File "/usr/local/lib/python2.6/dist-packages/django/db/models/base.py"
> in save_base
>   570.                 created=(not record_exists), raw=raw,
> using=using)
> File "/usr/local/lib/python2.6/dist-packages/django/dispatch/
> dispatcher.py" in send
>   172.             response = receiver(signal=self, sender=sender,
> **named)
> File "/home/user/projects/django/apps/history/audit.py" in
> post_save_handler
>   102.             logging.log_to_db(logging.INFO, msg, log_type)
> File "/home/user/projects/django/apps/history/__init__.py" in
> log_to_db
>   61.         db_logger.log(level, msg, extra=extras)
> File "/usr/lib/python2.6/logging/__init__.py" in log
>   1119.             self._log(level, msg, args, **kwargs)
> File "/usr/lib/python2.6/logging/__init__.py" in _log
>   1173.         self.handle(record)
> File "/usr/lib/python2.6/logging/__init__.py" in handle
>   1183.             self.callHandlers(record)
> File "/usr/lib/python2.6/logging/__init__.py" in callHandlers
>   1220.                     hdlr.handle(record)
> File "/usr/lib/python2.6/logging/__init__.py" in handle
>   679.                 self.emit(record)
> File "/home/user/projects/django/apps/history/handlers.py" in emit
>   11.         timestamp = datetime.strptime(record.asctime,
> settings.LOG_DATE_FORMAT)
>
> Also, I have a wrapper to call db_logger, which you can see from the
> stacktrace:
>     def log_to_db(self, level, msg, log_type, extra={}):
>         db_logger = logging.getLogger('db_logger')
>         extras = {
>             'category': log_type.category.name,
>             'sub_category': log_type.sub_category.name,
>             'type_id': log_type.type_id,
>         }
>         extras.update(extra)
>         db_logger.log(level, msg, extra=extras)
>
> My DB Handler looks like this:
>
> class DatabaseHandler(logging.Handler):
>     def emit(self, record):
>         user = getattr(record, 'user', None)
>         category = getattr(record, 'category', None)
>         sub_category = getattr(record, 'sub_category', None)
>         type_id = getattr(record, 'type_id', None)
>         timestamp = datetime.strptime(record.asctime,
> settings.LOG_DATE_FORMAT)
>         from history.models import LogRecord
>         LogRecord.objects.create(timestamp=timestamp,
> level=record.levelname,
>             category=category, sub_category=sub_category,
> type_id=type_id,
>             message=record.message, user=user)
>
> Thanks again.
>
> On Mar 5, 10:59 pm, Russell Keith-Magee <russ...@keith-magee.com>
> wrote:
>
> > On Sat, Mar 5, 2011 at 10:41 AM, Edwin <edwinja...@gmail.com> wr

Re: Weird behaviour in Django logging (Django 1.3 RC)

2011-03-07 Thread Edwin
Sorry I wasn't clear enough. Here's the stack trace:

Traceback:
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
base.py" in get_response
  89. response = middleware_method(request)
File "/home/user/projects/django/../django/common/middleware.py" in
process_request
  27. return login(request, **defaults)
File "/usr/local/lib/python2.6/dist-packages/django/utils/
decorators.py" in _wrapped_view
  93. response = view_func(request, *args,
**kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/views/decorators/
cache.py" in _wrapped_view_func
  79. response = view_func(request, *args, **kwargs)
File "/home/user/projects/django/../django/apps/django_extra_auth/
views.py" in login
  57. auth_login(request, form.get_user())
File "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/
__init__.py" in login
  85. user_logged_in.send(sender=user.__class__, request=request,
user=user)
File "/usr/local/lib/python2.6/dist-packages/django/dispatch/
dispatcher.py" in send
  172. response = receiver(signal=self, sender=sender,
**named)
File "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/
models.py" in update_last_login
  50. user.save()
File "/usr/local/lib/python2.6/dist-packages/django/db/models/base.py"
in save
  460. self.save_base(using=using, force_insert=force_insert,
force_update=force_update)
File "/usr/local/lib/python2.6/dist-packages/django/db/models/base.py"
in save_base
  570. created=(not record_exists), raw=raw,
using=using)
File "/usr/local/lib/python2.6/dist-packages/django/dispatch/
dispatcher.py" in send
  172. response = receiver(signal=self, sender=sender,
**named)
File "/home/user/projects/django/apps/history/audit.py" in
post_save_handler
  102. logging.log_to_db(logging.INFO, msg, log_type)
File "/home/user/projects/django/apps/history/__init__.py" in
log_to_db
  61. db_logger.log(level, msg, extra=extras)
File "/usr/lib/python2.6/logging/__init__.py" in log
  1119. self._log(level, msg, args, **kwargs)
File "/usr/lib/python2.6/logging/__init__.py" in _log
  1173. self.handle(record)
File "/usr/lib/python2.6/logging/__init__.py" in handle
  1183. self.callHandlers(record)
File "/usr/lib/python2.6/logging/__init__.py" in callHandlers
  1220. hdlr.handle(record)
File "/usr/lib/python2.6/logging/__init__.py" in handle
  679. self.emit(record)
File "/home/user/projects/django/apps/history/handlers.py" in emit
  11. timestamp = datetime.strptime(record.asctime,
settings.LOG_DATE_FORMAT)


Also, I have a wrapper to call db_logger, which you can see from the
stacktrace:
def log_to_db(self, level, msg, log_type, extra={}):
db_logger = logging.getLogger('db_logger')
extras = {
'category': log_type.category.name,
'sub_category': log_type.sub_category.name,
'type_id': log_type.type_id,
}
extras.update(extra)
db_logger.log(level, msg, extra=extras)


My DB Handler looks like this:

class DatabaseHandler(logging.Handler):
def emit(self, record):
user = getattr(record, 'user', None)
category = getattr(record, 'category', None)
sub_category = getattr(record, 'sub_category', None)
type_id = getattr(record, 'type_id', None)
timestamp = datetime.strptime(record.asctime,
settings.LOG_DATE_FORMAT)
from history.models import LogRecord
LogRecord.objects.create(timestamp=timestamp,
level=record.levelname,
category=category, sub_category=sub_category,
type_id=type_id,
message=record.message, user=user)


Thanks again.

On Mar 5, 10:59 pm, Russell Keith-Magee <russ...@keith-magee.com>
wrote:
> On Sat, Mar 5, 2011 at 10:41 AM, Edwin <edwinja...@gmail.com> wrote:
> > I'm getting a strange behaviour when setting up logging. Here's my
> > logging configuration:
>
> > LOGGING =
> > {
> >    'version': 1,
> >    'disable_existing_loggers': True,
> >    'formatters': {
> >        'admin_configuration': {
> >            'format': '%(asctime)s %(levelname)s %(category)s %
> > (sub_category)s %(type_id)s %(message)s',
> >            'datefmt': LOG_DATE_FORMAT,
> >        },
> >    },
> >    'handlers': {
> >        'admin_console': {
> >            'level':'DEBUG',
> >            'class':'logging.StreamHandler',
> >            'formatter': 'admin_configuration'
> >        },
> >        'db': {
> >            'level':'DEBUG',
> >            'class':'apps.history.h

Weird behaviour in Django logging (Django 1.3 RC)

2011-03-04 Thread Edwin
I'm getting a strange behaviour when setting up logging. Here's my
logging configuration:

LOGGING =
{
'version': 1,
'disable_existing_loggers': True,
'formatters': {
'admin_configuration': {
'format': '%(asctime)s %(levelname)s %(category)s %
(sub_category)s %(type_id)s %(message)s',
'datefmt': LOG_DATE_FORMAT,
},
},
'handlers': {
'admin_console': {
'level':'DEBUG',
'class':'logging.StreamHandler',
'formatter': 'admin_configuration'
},
'db': {
'level':'DEBUG',
'class':'apps.history.handlers.DatabaseHandler',
'formatter': 'admin_configuration'
},
},
'loggers': {
'db_logger': {
'handlers': [ 'admin_console', 'db' ],
'level': 'DEBUG',
'propagate': False,
},
}
}

I then created a Database log handler and the log record will be
created using signals (e.g. on model save/delete) because I'm trying
to keep track of model changes.  As you can see from my config, the
logger has 2 handlers, 1 for DB and 1 for stdout (stream handler).

I use the logger this way:

logging.getLogger('db_logger').log(level, msg, extra=extras)

where extras are extra attributes I'm passing to the logger.

Now the weird thing is, when I change the order of 'handlers'
definition under 'db_logger' to ['db', 'admin_console'], the logger
raises this error:
LogRecord instance has no attribute 'asctime'

After checking the record instance, 'message' attribute is generated
either, but all of my extra attributes are there.
The same error happens if I remove 'admin_console' handler. The only
way I can get the logger to work is that the handler must be in the
original order:  'handlers': [ 'admin_console', 'db' ]


Any idea why this is happening??


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-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.



Import problem: app name cannot be the same as project name?

2011-01-21 Thread Edwin
I have an app that's called the same way as my project name (let's
name it 'blog'). My directory structure is:

blog
   apps
  blog
  models.py
  books
  management
  models.py


Everything works fine except that when i created a custom command
inside another app, call it 'books', Django can't find it.. as it
turns out, somehow django gets confused and the project root path for
searching apps in the management tool
(django.core.management.__init__.py) becomes blog.apps.blog instead of
just blog as the project name. This results in django can't find of my
custom commands inside books app because it's searching on a wrong
path!

One thing to mention is that in my INCLUDED_APPS, i define my apps
using its project name as well:
INCLUDED_APPS = (
  'blog.apps.blog',
  'blog.apps.books',
)

This is also one reason why Django can't find my custom command i
guess... but i need to define full path (including project name) here
otherwise I get errors when my AlreadyRegistered from admin because
admin.py is imported twice with different method (when I don't specify
project name in settings.py, django tries to import admin.py using
'apps.blog.admin' and I'm importing it using
'blog.apps.blog.admin')...

My use of import is probably the root cause of everything.. I've heard
various people say that do relative import within apps so that they're
reusable but many Python devs say that always use absolute import. So
tried using absolute import all the time...

I know my question is a bit all over the place here... but can anyone
suggest what to do?

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-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.



running Django on a very small VPS

2008-08-27 Thread Edwin W

I was just wondering whether anyone out there has experience with
running a Django application on a really small VPS.  I'm using Django
for small personal projects and experimentation, and I found vpslink
which has a plan with 2.5 GB of disk space but only 64 MB RAM.  I know
that it won't work out of the box and that I'll have to do some tuning
to Apache to get it to work, I found this link which suggests it's
possible:

http://brizzled.clapper.org/id/73

I also came across this discussion in the group:

http://groups.google.com/group/django-users/browse_thread/thread/19b9d007eba5fefd/7582c8e0e214864d?lnk=gst=ram#7582c8e0e214864d

So am I crazy to try to push the limits this low?  Any additional tips
would be appreciated as well!
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Showing images in Django Admin

2007-04-04 Thread Edwin W

The django filebrowser admin extension may be close to what you're
looking for, it will display thumbnails of images on a filesystem
being browsed.  I'm not sure how it integrates with the models though,
haven't tried it myself.  You'll need PIL as pointed out on the
website.

http://trac.dedhost-sil-076.sil.at/trac/filebrowser/

Hope this helps!

On Apr 4, 9:06 am, "brian corrigan" <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I have a django model and want to include an image field. Is there a
> way of displaying this field in the admin templates as an image (not
> the string path of the image) or do I have to write my own template
> for that?
>
> Cheers
>
> Brian


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---