Re: User to Model relationship- implement a "like" feature on a Model

2014-08-25 Thread amarshall
Thanks ! I'll get to work on that and see how it goes! On Monday, August 25, 2014 8:26:35 PM UTC-4, Tim Chase wrote: > > On 2014-08-25 17:00, amarshall wrote: > > Hmm, That may work. I should have also noted one thing. I'm > > actually using Django as the backend for mobile application. Both >

Re: User to Model relationship- implement a "like" feature on a Model

2014-08-25 Thread Tim Chase
On 2014-08-25 17:00, amarshall wrote: > Hmm, That may work. I should have also noted one thing. I'm > actually using Django as the backend for mobile application. Both > *Android* and iOS. So I'd like to do something like this, in the > simplest matter: > > pseudocode: > > get

Re: User to Model relationship- implement a "like" feature on a Model

2014-08-25 Thread amarshall
Hmm, That may work. I should have also noted one thing. I'm actually using Django as the backend for mobile application. Both *Android* and iOS. So I'd like to do something like this, in the simplest matter: pseudocode: get information from the server. if this_user HAS NOT

Re: User to Model relationship- implement a "like" feature on a Model

2014-08-25 Thread Mario Gudelj
The other way would be to simply wire a cookie to user's browser and use js to disable the the like button if the cookie is present if you can get away with it. Not sure if you need to store that info against the user to see which items they liked... On 26/08/2014 8:41 am, "amarshall"

Re: Model - def __unicode__(self) - doesn't work

2014-08-25 Thread Mario Gudelj
Your problem is in the add view. Post your view code On 26/08/2014 7:20 am, "Przemek Ciborowski" wrote: > Hello guys, > > I'm really beginner in django. > I have extremely simple example: > > class Vlan(models.Model): > name = models.CharField(max_length=30, name='Vlan

User to Model relationship- implement a "like" feature on a Model

2014-08-25 Thread amarshall
Hi, I'm trying to implement likes on a Model in which 1 user will be able to like an a model (named "event") "once" and only once. so, I have a model like this: class Event(models.Model): user = models.ForeignKey(User) . #other fields . likes =

Re: Model - def __unicode__(self) - doesn't work

2014-08-25 Thread Babatunde Akinyanmi
Hi Przemek, I'm not sure there's a name attribute for Field and its subclasses. Does removing the name attribute work? On 25 Aug 2014 22:19, "Przemek Ciborowski" wrote: Hello guys, I'm really beginner in django. I have extremely simple example: class Vlan(models.Model):

Re: Changing URL

2014-08-25 Thread Babatunde Akinyanmi
On 25 Aug 2014 22:12, "Jagger" wrote: > > It works. Thanks. I removed the hardcoded URLs from the templates and I refer to index in this way: > > NEWS > > You asked why I gave the two patterns the same name. > The website default page is 'index'. It contains the news. The News

TypeError: "Source code string cannot contain null bytes"

2014-08-25 Thread Kamal Singh
Hi , I am new to this group and Django . I am trying to learn Django by making a blog app and everything was working fine till last night. Today when I tried to run server I got error with : Unhandled exception in thread started by function check_errors..wrapper at 0x.(some big hexadecimal

Model - def __unicode__(self) - doesn't work

2014-08-25 Thread Przemek Ciborowski
Hello guys, I'm really beginner in django. I have extremely simple example: class Vlan(models.Model): name = models.CharField(max_length=30, name='Vlan name') number = models.IntegerField(default=0, name='Vlan number') def __unicode__(self): return self.name When I'm trying

Re: Changing URL

2014-08-25 Thread Jagger
It works. Thanks. I removed the hardcoded URLs from the templates and I refer to index in this way: NEWS You asked why I gave the two patterns the same name. The website default page is 'index'. It contains the news. The News menu also points to index. Pattern A maps index to root: url(r'^$',

Re: Improvement to objects.get_or_create and objects.update_or_create

2014-08-25 Thread Benjamin Scherrey
Hi Andrew, Thanx for the feedback. I'm glad to hear you've independently encountered the same issue as I have. 1) unique_together would not be difficult to handle but I also don't think it's necessarily an absolute requirement. The default behavior would ultimately take advantage of a

Re: websockets in django

2014-08-25 Thread Carlos Aguilar
gevent-socketio to use websockets with django app. Best Regards On Mon, Aug 25, 2014 at 10:20 AM, Avraham Serour wrote: > it seems that uwsgi supports websockets, has anyone experimented with that? > > using uwsgi is a fairly common and recommended way to deploy django, it

Re: django and websockets in phonegap app

2014-08-25 Thread zubair alam
I think server should notify all the clients about the change in states whenever a client has changed shared states. I guess in your solution, client is asking server weather there is some change in the shared states or not, which is not a correct approach. On Sunday, August 24, 2014 2:54:22

Re: websockets in django

2014-08-25 Thread Avraham Serour
it seems that uwsgi supports websockets, has anyone experimented with that? using uwsgi is a fairly common and recommended way to deploy django, it would be nice to also use it for the ws part of the application, maybe memory savings or performance so I am curious about it but didn't have a

Re: websockets in django

2014-08-25 Thread Bill Freeman
+1 on tornado. I may be behind the times, but I don't think that the Django architecture lends itself to persistent connections. Also, Django is intended to run behind another server, such as Apachi, nginx, etc., and that server, too, would need to be amenable to persistent connections. This

Re: muliple pagination on same page

2014-08-25 Thread hardik sottany
I want to do pagination using filter on same page which show all on same page On Aug 25, 2014 7:26 PM, "Collin Anderson" wrote: > What do you have so far? > > -- > You received this message because you are subscribed to a topic in the > Google Groups "Django users" group. >

Re: muliple pagination on same page

2014-08-25 Thread hardik sottany
I have model with date time pk appointment details On Aug 25, 2014 7:26 PM, "Collin Anderson" wrote: > What do you have so far? > > -- > You received this message because you are subscribed to a topic in the > Google Groups "Django users" group. > To unsubscribe from this

Re: UUID for unique directory name

2014-08-25 Thread Amelie Bacle
Thanks for this, I was sure there were something to get access to the value of a field ! On Monday, August 25, 2014 4:00:23 PM UTC+2, Collin Anderson wrote: > > Roughly something like this: > > def dir_file(analysis, file_name): # should live outside your model > return '%s/%s' %

Re: UUID for unique directory name

2014-08-25 Thread Collin Anderson
Roughly something like this: def dir_file(analysis, file_name): # should live outside your model return '%s/%s' % (analysis.uuidDir, file_name) then models.FileField(upload_to=dir_file) -- You received this message because you are subscribed to the Google Groups "Django users"

Re: muliple pagination on same page

2014-08-25 Thread Collin Anderson
What do you have so far? -- 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

Re: Improvement to objects.get_or_create and objects.update_or_create

2014-08-25 Thread Andrew Farrell
I have long wanted something like this. However, it would need to be able to handle: 1) possible unique_together clauses 2) communicating clearly to the user what it tried to do and what went wrong when it errors The thing that has made me wary of suggesting something like this is the fact that

Error importing dbapi2...

2014-08-25 Thread Fred Stluka
I'm getting error: django.core.exceptions.ImproperlyConfigured: Error loading either pysqlite2 or sqlite3 modules (tried in that order): cannot import name dbapi2 Any suggestions? Details: My settings.py contains: DATABASE = { 'default': { 'ENGINE': 'django.db.backends.sqlite3',

UUID for unique directory name

2014-08-25 Thread Amelie Bacle
Hello everybody, I'm developing an app for the first time with Django and I have a problem with upload path and UUID. I have a form with 3 fields for uploading text files. So I want to save those 3 files in the same directory which have a unique name. First I did this a big random number but

muliple pagination on same page

2014-08-25 Thread hardik sottany
hello friend i want to use pagination for today appointment tommorows appoint and past appointment can any1 help me out in quite greater need -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving

Improvement to objects.get_or_create and objects.update_or_create

2014-08-25 Thread Benjamin Scherrey
Just want to run an idea by the list for a feature improvement for the oft-used convenience functions get_or_create and update_or_create. I'll just talk about get_or_create for now on but everything I saw going forward applies to both. It's a common idiom to populate a dictionary and simply pass

Re: Changing URL

2014-08-25 Thread Babatunde Akinyanmi
Ok. I'm replying inline: On 24 Aug 2014 18:43, "Jagger" wrote: > > The link is in the base.html of spweb app: > > NEWS > This link is relative so the browser will append the href attribute to the present URL. You should change it to: NEWS >> >> On 24 Aug 2014 12:30, "Jagger"