Re: Can't create editable foreign key field in Django admin: going to give up on django

2016-09-12 Thread Mike Dewhirst

On 13/09/2016 3:02 PM, Hanh Kieu wrote:
Hey guys, I'm creating a translation app that allows you to translate 
from one object to the other. My translation model has two foreign 
keys that links to two words, and on the admin site I want the Admin 
to be able to input two different words. The words they enter should 
be saved as individual words, as well as a translation. However, it 
looks like this isn't possible at all in Django. I've been trying so 
hard to read documentation but I am struggling. My Models look like this:


class Language(models.Model):
 language_text = models.CharField(max_length=200)

 def __str__(self):
 return self.language_text


class Word(models.Model):
 language = models.ForeignKey(Language,on_delete=models.CASCADE)
 word_text = models.CharField(max_length=200)

 def __str__(self):
 return self.word_text


class Translation(models.Model):
 #word1 belongs to one word word1 = 
models.OneToOneField(Word,on_delete=models.CASCADE,related_name="Translation_word1")
 #word2 belongs to another word word2 = 
models.OneToOneField(Word,on_delete=models.CASCADE,related_name="Translation_word2")


Word has a FK to Language so a word exists in a language and presumably 
language_text will contain the name of the language like Ruby or French etc.


So for that word to exist in another language, another word in that 
other language must have a FK to that other language. So if you have 
enough words in enough languages it would certainly be useful to connect 
them via a translation record.


But perhaps 1:1 is not what you want?

Maybe a particular word can be translated into two or three languages?

If so, you need an intermediate table which connects any one word with 
many other words which belong in different languages. Sometimes too, the 
same word is in more than one language with the same meaning.


One translation record needs to make a single connection between any two 
word records. So your Translation needs a FK to each of two different words.


Because you probably want to enter words for which you don't have the 
translation immediately to hand, it might be worthwhile permitting 
Null=True and blank=True.


Hth

I want the admin page for Translation to be able to take in two words 
and two languages and create a translation from them (rather than 
individually creating one word, then individually creating another 
word, then indiviudally creating a translation)


I've tried using TranslationForm(models.ModelForm), however when I 
submit it gives me an error that there are NULL values for my models 
:C. Help I am really lost and no one has been of help, I'm getting 
really frustrated with this aspect of django.


If someone could take time to actually understand my problem and help 
out that would be great please :C


--
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/9ab72b11-b7b3-4c1a-bf26-3ed4befb212f%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
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/1c91bf93-9a58-2c1a-bfd6-b88e237a58af%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Re: Can't create editable foreign key field in Django admin: going to give up on django

2016-09-12 Thread ludovic coues
Have you looked at
https://docs.djangoproject.com/en/1.10/ref/contrib/admin/#inlinemodeladmin-objects
?
It's still early morning here so I haven't to it with your specific use
case but the django tutorial use this feature to create a poll and its
response in the same form.

2016-09-13 7:29 GMT+02:00 Luis Zárate :

> See https://github.com/django-parler/django-parler
>
> 2016-09-12 23:02 GMT-06:00 Hanh Kieu :
>
>> Hey guys, I'm creating a translation app that allows you to translate
>> from one object to the other. My translation model has two foreign keys
>> that links to two words, and on the admin site I want the Admin to be able
>> to input two different words. The words they enter should be saved as
>> individual words, as well as a translation. However, it looks like this
>> isn't possible at all in Django. I've been trying so hard to read
>> documentation but I am struggling. My Models look like this:
>>
>> class Language(models.Model):
>> language_text = models.CharField(max_length=200)
>>
>> def __str__(self):
>> return self.language_text
>>
>>
>> class Word(models.Model):
>> language = models.ForeignKey(Language, on_delete=models.CASCADE)
>> word_text = models.CharField(max_length=200)
>>
>> def __str__(self):
>> return self.word_text
>>
>>
>> class Translation(models.Model):
>> #word1 belongs to one word
>> word1 = models.OneToOneField(Word, on_delete=models.CASCADE, 
>> related_name="Translation_word1")
>> #word2 belongs to another word
>> word2 = models.OneToOneField(Word, on_delete=models.CASCADE, 
>> related_name="Translation_word2")
>>
>>
>>
>>
>> I want the admin page for Translation to be able to take in two words and 
>> two languages and create a translation from them (rather than individually 
>> creating one word, then individually creating another word, then 
>> indiviudally creating a translation)
>>
>> I've tried using TranslationForm(models.ModelForm), however when I submit it 
>> gives me an error that there are NULL values for my models :C. Help I am 
>> really lost and no one has been of help, I'm getting really frustrated with 
>> this aspect of django.
>>
>> If someone could take time to actually understand my problem and help out 
>> that would be great please :C
>>
>> --
>> 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/ms
>> gid/django-users/9ab72b11-b7b3-4c1a-bf26-3ed4befb212f%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> "La utopía sirve para caminar" Fernando Birri
>
>
> --
> 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/CAG%2B5VyNZOT2-Hp2i2yC_MO7R73P%
> 2BBiDoP%3D%3DrX-aiy35THfxO%3Dw%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 

Cordialement, Coues Ludovic
+336 148 743 42

-- 
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/CAEuG%2BTbx4vO0eNC2pWfowVOZ%2BZJmYqqLT_d9ROhejqAitr90%2Bw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can't create editable foreign key field in Django admin: going to give up on django

2016-09-12 Thread Luis Zárate
See https://github.com/django-parler/django-parler

2016-09-12 23:02 GMT-06:00 Hanh Kieu :

> Hey guys, I'm creating a translation app that allows you to translate from
> one object to the other. My translation model has two foreign keys that
> links to two words, and on the admin site I want the Admin to be able to
> input two different words. The words they enter should be saved as
> individual words, as well as a translation. However, it looks like this
> isn't possible at all in Django. I've been trying so hard to read
> documentation but I am struggling. My Models look like this:
>
> class Language(models.Model):
> language_text = models.CharField(max_length=200)
>
> def __str__(self):
> return self.language_text
>
>
> class Word(models.Model):
> language = models.ForeignKey(Language, on_delete=models.CASCADE)
> word_text = models.CharField(max_length=200)
>
> def __str__(self):
> return self.word_text
>
>
> class Translation(models.Model):
> #word1 belongs to one word
> word1 = models.OneToOneField(Word, on_delete=models.CASCADE, 
> related_name="Translation_word1")
> #word2 belongs to another word
> word2 = models.OneToOneField(Word, on_delete=models.CASCADE, 
> related_name="Translation_word2")
>
>
>
>
> I want the admin page for Translation to be able to take in two words and two 
> languages and create a translation from them (rather than individually 
> creating one word, then individually creating another word, then indiviudally 
> creating a translation)
>
> I've tried using TranslationForm(models.ModelForm), however when I submit it 
> gives me an error that there are NULL values for my models :C. Help I am 
> really lost and no one has been of help, I'm getting really frustrated with 
> this aspect of django.
>
> If someone could take time to actually understand my problem and help out 
> that would be great please :C
>
> --
> 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/9ab72b11-b7b3-4c1a-bf26-3ed4befb212f%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
"La utopía sirve para caminar" Fernando Birri

-- 
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/CAG%2B5VyNZOT2-Hp2i2yC_MO7R73P%2BBiDoP%3D%3DrX-aiy35THfxO%3Dw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Can't create editable foreign key field in Django admin: going to give up on django

2016-09-12 Thread Hanh Kieu
Hey guys, I'm creating a translation app that allows you to translate from 
one object to the other. My translation model has two foreign keys that 
links to two words, and on the admin site I want the Admin to be able to 
input two different words. The words they enter should be saved as 
individual words, as well as a translation. However, it looks like this 
isn't possible at all in Django. I've been trying so hard to read 
documentation but I am struggling. My Models look like this:

class Language(models.Model):
language_text = models.CharField(max_length=200)

def __str__(self):
return self.language_text


class Word(models.Model):
language = models.ForeignKey(Language, on_delete=models.CASCADE)
word_text = models.CharField(max_length=200)

def __str__(self):
return self.word_text


class Translation(models.Model):
#word1 belongs to one word
word1 = models.OneToOneField(Word, on_delete=models.CASCADE, 
related_name="Translation_word1")
#word2 belongs to another word
word2 = models.OneToOneField(Word, on_delete=models.CASCADE, 
related_name="Translation_word2")




I want the admin page for Translation to be able to take in two words and two 
languages and create a translation from them (rather than individually creating 
one word, then individually creating another word, then indiviudally creating a 
translation)

I've tried using TranslationForm(models.ModelForm), however when I submit it 
gives me an error that there are NULL values for my models :C. Help I am really 
lost and no one has been of help, I'm getting really frustrated with this 
aspect of django.

If someone could take time to actually understand my problem and help out that 
would be great please :C

-- 
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/9ab72b11-b7b3-4c1a-bf26-3ed4befb212f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Creation of default site not triggering post_save signal

2016-09-12 Thread Matt Thompson
Hi Simon,

Thank you very much for your prompt reply!  I've added the following to my 
app, which seems to work just fine:

@receiver(models.signals.post_migrate)
def gen_site_config_post_migrate(plan, **kwargs):
# A migration of the `django.contrib.sites` app was applied.
if plan and any(migration.app_label == 'sites' for migration, _ in 
plan):
try:
site = Site.objects.get(name='example.com')
except ObjectDoesNotExist:
pass
else:
SiteConfig.objects.get_or_create(
site=site,
admin_email='ad...@example.com',
remote=False
)

It seems the code inside the if statement is called several times (7, to be 
exact) when I run initial migrations, with the site finally getting created 
at the end.  This is why I've had to add some exception handling for when 
the site doesn't exist.

Simon, one last question for you -- where should this code live?  I 
currently have it shoved in my model file but that doesn't feel quite right.

Thank you again!

--Matt

On Saturday, September 10, 2016 at 10:42:16 PM UTC-4, Simon Charette wrote:
>
> Hi Matt,
>
> I worked on the changes that broke your code.
>
> Starting with 1.10 the migration signals are passed an `apps` kwarg 
> representing
> the state of models before and after the specified migrations are applied.
>
> This allows signal receivers to manipulate model definitions that are
> synchronized with their actual database representation just like a data
> migrations would (e.g. `RunPython` operations).
>
> Before this change was introduced the signal receivers were performing 
> queries
> using the globally available model definitions which could lead to failures
> when querying the underlying tables as their schema were not synchronized 
> with
> their global model definitions.
>
> In your case, the signals you attached to the global `Site` model are not 
> fired
> anymore as the queries are performed using the migration specific one which
> you cannot attach listeners to.
>
> It's hard for me to come up with a complete solution without the actual 
> code
> attached to `post_save(sender=Site)` but something along these lines 
> should do:
>
> @receiver(post_migrate)
> def sync_site(plan, **kwargs):
> # A migration of the `django.contrib.sites` app was applied.
> if plan and any(migration.app_label == 'sites' for migration, _ in 
> plan):
> # ... perform actions
>
> Let me know if you need more details,
> Simon
> Le samedi 10 septembre 2016 21:59:56 UTC-4, Matt Thompson a écrit :
>>
>> Hi All,
>>
>> I have a small Django app that uses the sites framework and has a 
>> post_save signal on Site that does some bits and bobs when a new site is 
>> created.  On 1.9.7, when you run migrations for the first time, it 
>> correctly triggers the post_save signal.  However, after upgrading to 
>> 1.10.1, dropping the database, and re-running migrations, the post_save 
>> signal I have setup on Site doesn't seem to be triggering.  I tried reading 
>> the 1.10 release notes and while there was mention of a pre_migrate() and 
>> post_migrate() signals, I couldn't make heads or tails on whether that is 
>> related.
>>
>> If this is a deliberate change, can someone please point me to the 
>> specifics?  If it's a bug, I'd be more than happy to file a bug.
>>
>> Thanks!
>>
>> --Matt
>>
>

-- 
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/dfc9ae9c-d7fb-4f2a-a857-bae133f92b03%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Unexpected poor template performance

2016-09-12 Thread Rich Rauenzahn

I'm working on a project that needs to occasionally render very large 
tables -- I'm picking hundreds of thousands of cells as a test point for 
trying out back end implementation scalability.

I'm parallelizing some of the rendering through ajax calls that returns 
large subsets of the rendered cells ("content") within 
a JSON structure.  I'm using a short template to render each cell:


  {{ datapoint.score }}



template = get_template('cell.djhtml')

for datapoint in self._iterate_datapoints():
datapoint_cell[datapoint.foo_id][datapoint.bar_id] = 
template.render(dict(datapoint=datapoint))


If I change the template.render() call to just a "%s" % datapoint.score, the code is an order of magnitude 
faster.

My assumption (and my reading of the django code I think confirmed) that 
the template is compiled only once, so I'm ok there.

Is this difference surprising or unexpected?  Would a single (consolidated) 
render() be expected to be much faster? (I'm trying to think of a way to 
refactor it to a single render, but I'm not looking forward to rendering 
json in a django template)

I'm also considering I may just need to return structured json and create 
the elements manually on the client side -- although if I have to do it 
that manually, I might as well use interpolation on the backend python 
without using a template...

Oh, and I just tried jinja2 -- it was much closer to interpolation speed.   
Perhaps that is my best answer.

Any thoughts or pointers on my predicament?

Thanks!
Rich

-- 
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/cb85b941-964c-46c8-8e84-148fdb6049ca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Database is not reset after StaticLiveServerTestCase (Django 1.9.5)

2016-09-12 Thread Tim Graham
Yes, a minimal example project that demonstrates the issue would be 
helpful. My guess is that you have a mistake in your tests that's causing 
some state to leak between them.

On Monday, September 12, 2016 at 9:36:23 AM UTC-4, ankitj...@gmail.com 
wrote:
>
> Hello,
>
> I have a Python project that is using a Selenium script to emulate a user. 
> I am running this script within a Django TestCase and I use the 
> StaticLiveServerTestCase subclass to run a live Django server in the 
> background.
>
> I have also have other Unit Tests.
>
> If I run all the tests together (The Unit Tests along with the Live Server 
> Tests) using *python manage.py test*, all the test-cases that run after 
> the Selenium/Live Server test case fail. Running the unit tests separately 
> shows no failures. It seems that the database is not reset cleanly because 
> of which the subsequent test cases cannot get the Django objects that they 
> need to test against.
>
> My situation is similar to the one described in this StackOverflow 
> question here except for one difference that I face this issue even when I 
> use django test runner.
>
> http://stackoverflow.com/questions/32998166/with-py-test-database-is-not-reset-after-liveservertestcase
>
> Is there a solution to this where I can run all the tests at once and also 
> cleanly reset the database everytime? Or should I run the selenium test and 
> the Unit tests seperately?
> (I can show the code [Github] if necessary)
>
> Thanks
>

-- 
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/9d212919-4f66-4812-9b94-89f5581f0ce8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Extracting the username:password from the host

2016-09-12 Thread Christophe Pettus

On Sep 12, 2016, at 12:40 PM, Carl Meyer  wrote:

> Yes, it should be in `request.META['HTTP_AUTHORIZATION']`; see
> https://www.djangosnippets.org/snippets/243/ for an example.

... and now it works.  OK, clearly, either me or the server need more coffee.  
Thank you!

--
-- Christophe Pettus
   x...@thebuild.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 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/276ABF19-EBAE-43D4-8DAC-0D3088E9DCCB%40thebuild.com.
For more options, visit https://groups.google.com/d/optout.


Re: Extracting the username:password from the host

2016-09-12 Thread Carl Meyer
Hi Christophe,

On 09/12/2016 03:35 PM, Christophe Pettus wrote:
> I've encountered a service that does postbacks as part of its API.
> The only authentication mechanism is putting the username and
> password in the POST URL in the form:
> 
> https://user:p...@example.com/api/endpoint
> 
> Is there a portable way of extracting that information from the
> request object?

Yes, it should be in `request.META['HTTP_AUTHORIZATION']`; see
https://www.djangosnippets.org/snippets/243/ for an example.

The user:pass@host URL syntax is just a way of expressing credentials
for HTTP Basic Authentication; the values should end up in the
Authorization header.

Carl

-- 
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/ff41ac39-6fb9-43c1-b254-8751ba925dc7%40oddbird.net.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


Extracting the username:password from the host

2016-09-12 Thread Christophe Pettus
I've encountered a service that does postbacks as part of its API.  The only 
authentication mechanism is putting the username and password in the POST URL 
in the form:

https://user:p...@example.com/api/endpoint

Is there a portable way of extracting that information from the request object?

--
-- Christophe Pettus
   x...@thebuild.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 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/83CD6EA1-A315-4395-96AC-106DF438AE5A%40thebuild.com.
For more options, visit https://groups.google.com/d/optout.


Re: Import css in Django

2016-09-12 Thread ludovic coues
manage.py collectstatic is made for that. It will copy every static file in
your project into a single directory. Even those included in django like
the css of django admin.


2016-09-12 16:57 GMT+02:00 Jonathan Cheng :

> i use href="{% static '/assets/css/main.css' %}
> and the css worked
> but i want to use the all files in assets
> is there any other way to do it?
>
> ludovic coues於 2016年9月12日星期一 UTC+8上午1時32分42秒寫道:
>>
>> If you look at the html send by django, what is the href value ?
>>
>> 2016-09-11 19:15 GMT+02:00 Jonathan Cheng :
>>
>>> i fixed usint STATIC_ROOD = '/static/'
>>> it seems to no error
>>> but when i connect to my runserver
>>> the css of  assets just doesn't work
>>>
>>>
>>> Jonathan Cheng於 2016年9月12日星期一 UTC+8上午1時04分22秒寫道:
>>>
 here i explain , because  i just test how main.css work, finally i want
 to use the assets and images .
 and i use the python mange.py collectstatic
 it showed

 ImproperlyConfigured: The STATICFILES_DIRS setting should not contain
> the STATIC_ROOT setting
>

 ludovic coues於 2016年9月12日星期一 UTC+8上午12時53分08秒寫道:
>
> I mentionned tree because I have doubt about what "static - assets -
> css - main.css" means. If your path is really
> /mysite/static/assets/css/main.css, then you want  rel="stylesheet" text = 'html/css' href="{% static
> 'assets/css/main.css' %}" />.
>
> At least with a debug configuration, django will search for static
> file in each apps' static directory for the path you used as arguments
> for static.
> With a production configuration, you should use manage.py
> collectstatic which will grab all static file and copy them in a
> single directory.
>
> 2016-09-11 18:18 GMT+02:00 Jonathan Cheng :
> >
> > https://gist.github.com/cj10243/fb557903441d4a3e95190b854fbaabe1
> >
> > ludovic coues於 2016年9月12日星期一 UTC+8上午12時05分12秒寫道:
> >>
> >> I have a hard time to read the paths you use. The command tree
> produce
> >> a nice tree view of a directory, it might help. You can also use
> >> service like http://paste2.org/ or https://gist.github.com/ to
> share
> >> it
> >>
> >> 2016-09-11 17:58 GMT+02:00 Jonathan Cheng :
> >> > thx reply,but it just can see the original html with no css,is my
> path
> >> > setted correct?
> >> >
> >> > ludovic coues於 2016年9月11日星期日 UTC+8下午11時45分24秒寫道:
> >> >>
> >> >> Have you tried to add a few newlines to be sure about which line
> is the
> >> >> issue ?
> >> >>
> >> >> Also, in you email, there is a space between % and } in the load
> >> >> staticfiles tag
> >> >>
> >> >> 2016-09-11 7:29 GMT+02:00 Jonathan Cheng :
>
> >> >> > I use django1.10
> >> >> >
> >> >> > i reference the official doc
> >> >> > https://docs.djangoproject.com/en/1.10/intro/tutorial06/
> >> >> >
> >> >> > my project name:mysite
> >> >> >
> >> >> > structure:
> >> >> >
> >> >> > - mysite-
> >> >> >
> >> >> >  - mysite - urls.py
> >> >> >
> >> >> >-views.py
> >> >> >
> >> >> > ...
> >> >> >
> >> >> >  - templates - index.html
> >> >> >
> >> >> >  - images
> >> >> >  - static - mysite - assets - css - main.css
> >> >> >
> >> >> > - js
> >> >> >
> >> >> > ...
> >> >> > In my index.html
> >> >> >
> >> >> > add
> >> >> >
> >> >> > `{% load staticfiles % }
> >> >> > `
> >> >> >
> >> >> > it said i have a Invalid block tag about TemplateSyntaxError
> >> >> > ``
> >> >> >
> >> >> > views.py (about static files part)
> >> >> > ```STATICFILES_DIRS = [
> >> >> > os.path.join(BASE_DIR, "static"),
> >> >> > '/mysite/static/',
> >> >> > ]
> >> >> > STATIC_URL = '/static/'
> >> >> > STATIC_ROOT='/mysite/static/'```
> >> >> >
> >> >> > what's part should i notice?
> >> >> >
> >> >> > --
> >> >> > 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 https://groups.google.com/grou
> p/django-users.
> >> >> > To view this discussion on the web visit
> >> >> >
> >> >> >
> >> >> > https://groups.google.com/d/msgid/django-users/ef2ea6eb-d1cb
> 

Re: create connection error

2016-09-12 Thread ludovic coues
Is there anything in the console ?

2016-09-12 3:46 GMT+02:00 :

> def contact(request):
> error = []
> if request.method == 'POST':
> if not request.POST.get('subject', ''):
> error.append("please enter a subject")
> if not request.POST.get('message',''):
> error.append("please enter a message")
> if request.POST.get('email') and "@" not in request.POST["email"]:
> error.append("Please enter a valid e-mail")
> if not error:
> # send_mail(request.POST['subject'], request.POST['message'],
> request.POST.get('email', 'mxb...@126.com'), ['2229009...@qq.com'],
> fail_silently=True)
> send_mail('subject', 'this is the message of email', 'mxb...@126.com', ['
> 2229009...@qq.com'], fail_silently=True)
> return HttpResponseRedirect('/contact/thanks/')
> return render_to_response('contact.html', {'error' : error})
>
>
> STATIC_URL = '/static/'
>
> EMAIL_POST = 'smtp.126.com'
> EMAIL_PORT = 25
> EMAIL_HOST_USER = 'mxb...@126.com'
> EMAIL_HOST_PASSWORD = ''
> EMAIL_SUBJECT_PREFTX = u''
> EMAIL_USE_TLS = True
>
> SERVER_EMAIL = '2229009...@qq.com'
>
>
> error at /contact/
>
> [Errno 10061]
>
> Request Method: POST
> Request URL: http://127.0.0.1:8000/contact/
> Django Version: 1.10
> Exception Type: error
> Exception Value:
>
> [Errno 10061]
>
> Exception Location: D:\Python\lib\socket.py in create_connection, line 571
> Python Executable: D:\Python\python.exe
> Python Version: 2.7.3
> Python Path:
>
> ['C:\\Users\\miaoxu\\mysite',
>  'D:\\Python\\lib\\site-packages\\django-1.10-py2.7.egg',
>  'D:\\Python\\python27.zip',
>  'D:\\Python\\DLLs',
>  'D:\\Python\\lib',
>  'D:\\Python\\lib\\plat-win',
>  'D:\\Python\\lib\\lib-tk',
>  'D:\\Python',
>  'D:\\Python\\lib\\site-packages',
>  'D:\\Python\\lib\\site-packages\\PIL',
>  'D:\\Python\\lib\\site-packages\\win32',
>  'D:\\Python\\lib\\site-packages\\win32\\lib',
>  'D:\\Python\\lib\\site-packages\\Pythonwin']
>
> Server time: 星期一, 12 九月 2016 01:46:23 +
>
>
> --
> 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/789f6303-87f6-4d20-9e1b-16fa8db0e943%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 

Cordialement, Coues Ludovic
+336 148 743 42

-- 
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/CAEuG%2BTZwGOZLLC1Zm_orVv5b8G0rn5pwdeeTL7nRn4%2BwNmtgNQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Import css in Django

2016-09-12 Thread Jonathan Cheng
i use href="{% static '/assets/css/main.css' %}
and the css worked
but i want to use the all files in assets
is there any other way to do it?

ludovic coues於 2016年9月12日星期一 UTC+8上午1時32分42秒寫道:
>
> If you look at the html send by django, what is the href value ?
>
> 2016-09-11 19:15 GMT+02:00 Jonathan Cheng  >:
>
>> i fixed usint STATIC_ROOD = '/static/'
>> it seems to no error
>> but when i connect to my runserver
>> the css of  assets just doesn't work
>>
>>
>> Jonathan Cheng於 2016年9月12日星期一 UTC+8上午1時04分22秒寫道:
>>
>>> here i explain , because  i just test how main.css work, finally i want 
>>> to use the assets and images .
>>> and i use the python mange.py collectstatic
>>> it showed 
>>>
>>> ImproperlyConfigured: The STATICFILES_DIRS setting should not contain 
 the STATIC_ROOT setting 

>>>
>>> ludovic coues於 2016年9月12日星期一 UTC+8上午12時53分08秒寫道:

 I mentionned tree because I have doubt about what "static - assets - 
 css - main.css" means. If your path is really 
 /mysite/static/assets/css/main.css, then you want >>> rel="stylesheet" text = 'html/css' href="{% static 
 'assets/css/main.css' %}" />. 

 At least with a debug configuration, django will search for static 
 file in each apps' static directory for the path you used as arguments 
 for static. 
 With a production configuration, you should use manage.py 
 collectstatic which will grab all static file and copy them in a 
 single directory. 

 2016-09-11 18:18 GMT+02:00 Jonathan Cheng : 
 > 
 > https://gist.github.com/cj10243/fb557903441d4a3e95190b854fbaabe1 
 > 
 > ludovic coues於 2016年9月12日星期一 UTC+8上午12時05分12秒寫道: 
 >> 
 >> I have a hard time to read the paths you use. The command tree 
 produce 
 >> a nice tree view of a directory, it might help. You can also use 
 >> service like http://paste2.org/ or https://gist.github.com/ to 
 share 
 >> it 
 >> 
 >> 2016-09-11 17:58 GMT+02:00 Jonathan Cheng : 
 >> > thx reply,but it just can see the original html with no css,is my 
 path 
 >> > setted correct? 
 >> > 
 >> > ludovic coues於 2016年9月11日星期日 UTC+8下午11時45分24秒寫道: 
 >> >> 
 >> >> Have you tried to add a few newlines to be sure about which line 
 is the 
 >> >> issue ? 
 >> >> 
 >> >> Also, in you email, there is a space between % and } in the load 
 >> >> staticfiles tag 
 >> >> 
 >> >> 2016-09-11 7:29 GMT+02:00 Jonathan Cheng : 
 >> >> > I use django1.10 
 >> >> > 
 >> >> > i reference the official doc 
 >> >> > https://docs.djangoproject.com/en/1.10/intro/tutorial06/ 
 >> >> > 
 >> >> > my project name:mysite 
 >> >> > 
 >> >> > structure: 
 >> >> > 
 >> >> > - mysite- 
 >> >> > 
 >> >> >  - mysite - urls.py 
 >> >> > 
 >> >> >-views.py 
 >> >> > 
 >> >> > ... 
 >> >> > 
 >> >> >  - templates - index.html 
 >> >> > 
 >> >> >  - images 
 >> >> >  - static - mysite - assets - css - main.css 
 >> >> > 
 >> >> > - js 
 >> >> > 
 >> >> > ... 
 >> >> > In my index.html 
 >> >> > 
 >> >> > add 
 >> >> > 
 >> >> > `{% load staticfiles % } 
 >> >> > ` 
 >> >> > 
 >> >> > it said i have a Invalid block tag about TemplateSyntaxError 
 >> >> > `` 
 >> >> > 
 >> >> > views.py (about static files part) 
 >> >> > ```STATICFILES_DIRS = [ 
 >> >> > os.path.join(BASE_DIR, "static"), 
 >> >> > '/mysite/static/', 
 >> >> > ] 
 >> >> > STATIC_URL = '/static/' 
 >> >> > STATIC_ROOT='/mysite/static/'``` 
 >> >> > 
 >> >> > what's part should i notice? 
 >> >> > 
 >> >> > -- 
 >> >> > 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 
 https://groups.google.com/group/django-users. 
 >> >> > To view this discussion on the web visit 
 >> >> > 
 >> >> > 
 >> >> > 
 https://groups.google.com/d/msgid/django-users/ef2ea6eb-d1cb-40e2-abef-1af246e02e98%40googlegroups.com.
  

 >> >> > For more options, visit https://groups.google.com/d/optout. 
 >> >> 
 >> >> 
 >> >> 
 >> >> -- 
 >> >> 
 >> >> Cordialement, Coues Ludovic 
 >> >> +336 148 743 42 
 >> > 
 >> > -- 
 >> > You received this message 

Re: Import css in Django

2016-09-12 Thread Jonathan Cheng
i change into href="{% static '/assets/css/main.css' %}
and it worked
but if i want to use the all files in static
is there any way to do it?

ludovic coues於 2016年9月12日星期一 UTC+8上午1時32分42秒寫道:
>
> If you look at the html send by django, what is the href value ?
>
> 2016-09-11 19:15 GMT+02:00 Jonathan Cheng  >:
>
>> i fixed usint STATIC_ROOD = '/static/'
>> it seems to no error
>> but when i connect to my runserver
>> the css of  assets just doesn't work
>>
>>
>> Jonathan Cheng於 2016年9月12日星期一 UTC+8上午1時04分22秒寫道:
>>
>>> here i explain , because  i just test how main.css work, finally i want 
>>> to use the assets and images .
>>> and i use the python mange.py collectstatic
>>> it showed 
>>>
>>> ImproperlyConfigured: The STATICFILES_DIRS setting should not contain 
 the STATIC_ROOT setting 

>>>
>>> ludovic coues於 2016年9月12日星期一 UTC+8上午12時53分08秒寫道:

 I mentionned tree because I have doubt about what "static - assets - 
 css - main.css" means. If your path is really 
 /mysite/static/assets/css/main.css, then you want >>> rel="stylesheet" text = 'html/css' href="{% static 
 'assets/css/main.css' %}" />. 

 At least with a debug configuration, django will search for static 
 file in each apps' static directory for the path you used as arguments 
 for static. 
 With a production configuration, you should use manage.py 
 collectstatic which will grab all static file and copy them in a 
 single directory. 

 2016-09-11 18:18 GMT+02:00 Jonathan Cheng : 
 > 
 > https://gist.github.com/cj10243/fb557903441d4a3e95190b854fbaabe1 
 > 
 > ludovic coues於 2016年9月12日星期一 UTC+8上午12時05分12秒寫道: 
 >> 
 >> I have a hard time to read the paths you use. The command tree 
 produce 
 >> a nice tree view of a directory, it might help. You can also use 
 >> service like http://paste2.org/ or https://gist.github.com/ to 
 share 
 >> it 
 >> 
 >> 2016-09-11 17:58 GMT+02:00 Jonathan Cheng : 
 >> > thx reply,but it just can see the original html with no css,is my 
 path 
 >> > setted correct? 
 >> > 
 >> > ludovic coues於 2016年9月11日星期日 UTC+8下午11時45分24秒寫道: 
 >> >> 
 >> >> Have you tried to add a few newlines to be sure about which line 
 is the 
 >> >> issue ? 
 >> >> 
 >> >> Also, in you email, there is a space between % and } in the load 
 >> >> staticfiles tag 
 >> >> 
 >> >> 2016-09-11 7:29 GMT+02:00 Jonathan Cheng : 
 >> >> > I use django1.10 
 >> >> > 
 >> >> > i reference the official doc 
 >> >> > https://docs.djangoproject.com/en/1.10/intro/tutorial06/ 
 >> >> > 
 >> >> > my project name:mysite 
 >> >> > 
 >> >> > structure: 
 >> >> > 
 >> >> > - mysite- 
 >> >> > 
 >> >> >  - mysite - urls.py 
 >> >> > 
 >> >> >-views.py 
 >> >> > 
 >> >> > ... 
 >> >> > 
 >> >> >  - templates - index.html 
 >> >> > 
 >> >> >  - images 
 >> >> >  - static - mysite - assets - css - main.css 
 >> >> > 
 >> >> > - js 
 >> >> > 
 >> >> > ... 
 >> >> > In my index.html 
 >> >> > 
 >> >> > add 
 >> >> > 
 >> >> > `{% load staticfiles % } 
 >> >> > ` 
 >> >> > 
 >> >> > it said i have a Invalid block tag about TemplateSyntaxError 
 >> >> > `` 
 >> >> > 
 >> >> > views.py (about static files part) 
 >> >> > ```STATICFILES_DIRS = [ 
 >> >> > os.path.join(BASE_DIR, "static"), 
 >> >> > '/mysite/static/', 
 >> >> > ] 
 >> >> > STATIC_URL = '/static/' 
 >> >> > STATIC_ROOT='/mysite/static/'``` 
 >> >> > 
 >> >> > what's part should i notice? 
 >> >> > 
 >> >> > -- 
 >> >> > 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 
 https://groups.google.com/group/django-users. 
 >> >> > To view this discussion on the web visit 
 >> >> > 
 >> >> > 
 >> >> > 
 https://groups.google.com/d/msgid/django-users/ef2ea6eb-d1cb-40e2-abef-1af246e02e98%40googlegroups.com.
  

 >> >> > For more options, visit https://groups.google.com/d/optout. 
 >> >> 
 >> >> 
 >> >> 
 >> >> -- 
 >> >> 
 >> >> Cordialement, Coues Ludovic 
 >> >> +336 148 743 42 
 >> > 
 >> > -- 
 >> > You received this message 

Re: Import css in Django

2016-09-12 Thread Jonathan Cheng
i use href="{% static '/assets/css/main.css' %}" 
and it worked 
but if i want to use the all files in static
is there any way to do?

ludovic coues於 2016年9月12日星期一 UTC+8上午1時32分42秒寫道:
>
> If you look at the html send by django, what is the href value ?
>
> 2016-09-11 19:15 GMT+02:00 Jonathan Cheng  >:
>
>> i fixed usint STATIC_ROOD = '/static/'
>> it seems to no error
>> but when i connect to my runserver
>> the css of  assets just doesn't work
>>
>>
>> Jonathan Cheng於 2016年9月12日星期一 UTC+8上午1時04分22秒寫道:
>>
>>> here i explain , because  i just test how main.css work, finally i want 
>>> to use the assets and images .
>>> and i use the python mange.py collectstatic
>>> it showed 
>>>
>>> ImproperlyConfigured: The STATICFILES_DIRS setting should not contain 
 the STATIC_ROOT setting 

>>>
>>> ludovic coues於 2016年9月12日星期一 UTC+8上午12時53分08秒寫道:

 I mentionned tree because I have doubt about what "static - assets - 
 css - main.css" means. If your path is really 
 /mysite/static/assets/css/main.css, then you want >>> rel="stylesheet" text = 'html/css' href="{% static 
 'assets/css/main.css' %}" />. 

 At least with a debug configuration, django will search for static 
 file in each apps' static directory for the path you used as arguments 
 for static. 
 With a production configuration, you should use manage.py 
 collectstatic which will grab all static file and copy them in a 
 single directory. 

 2016-09-11 18:18 GMT+02:00 Jonathan Cheng : 
 > 
 > https://gist.github.com/cj10243/fb557903441d4a3e95190b854fbaabe1 
 > 
 > ludovic coues於 2016年9月12日星期一 UTC+8上午12時05分12秒寫道: 
 >> 
 >> I have a hard time to read the paths you use. The command tree 
 produce 
 >> a nice tree view of a directory, it might help. You can also use 
 >> service like http://paste2.org/ or https://gist.github.com/ to 
 share 
 >> it 
 >> 
 >> 2016-09-11 17:58 GMT+02:00 Jonathan Cheng : 
 >> > thx reply,but it just can see the original html with no css,is my 
 path 
 >> > setted correct? 
 >> > 
 >> > ludovic coues於 2016年9月11日星期日 UTC+8下午11時45分24秒寫道: 
 >> >> 
 >> >> Have you tried to add a few newlines to be sure about which line 
 is the 
 >> >> issue ? 
 >> >> 
 >> >> Also, in you email, there is a space between % and } in the load 
 >> >> staticfiles tag 
 >> >> 
 >> >> 2016-09-11 7:29 GMT+02:00 Jonathan Cheng : 
 >> >> > I use django1.10 
 >> >> > 
 >> >> > i reference the official doc 
 >> >> > https://docs.djangoproject.com/en/1.10/intro/tutorial06/ 
 >> >> > 
 >> >> > my project name:mysite 
 >> >> > 
 >> >> > structure: 
 >> >> > 
 >> >> > - mysite- 
 >> >> > 
 >> >> >  - mysite - urls.py 
 >> >> > 
 >> >> >-views.py 
 >> >> > 
 >> >> > ... 
 >> >> > 
 >> >> >  - templates - index.html 
 >> >> > 
 >> >> >  - images 
 >> >> >  - static - mysite - assets - css - main.css 
 >> >> > 
 >> >> > - js 
 >> >> > 
 >> >> > ... 
 >> >> > In my index.html 
 >> >> > 
 >> >> > add 
 >> >> > 
 >> >> > `{% load staticfiles % } 
 >> >> > ` 
 >> >> > 
 >> >> > it said i have a Invalid block tag about TemplateSyntaxError 
 >> >> > `` 
 >> >> > 
 >> >> > views.py (about static files part) 
 >> >> > ```STATICFILES_DIRS = [ 
 >> >> > os.path.join(BASE_DIR, "static"), 
 >> >> > '/mysite/static/', 
 >> >> > ] 
 >> >> > STATIC_URL = '/static/' 
 >> >> > STATIC_ROOT='/mysite/static/'``` 
 >> >> > 
 >> >> > what's part should i notice? 
 >> >> > 
 >> >> > -- 
 >> >> > 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 
 https://groups.google.com/group/django-users. 
 >> >> > To view this discussion on the web visit 
 >> >> > 
 >> >> > 
 >> >> > 
 https://groups.google.com/d/msgid/django-users/ef2ea6eb-d1cb-40e2-abef-1af246e02e98%40googlegroups.com.
  

 >> >> > For more options, visit https://groups.google.com/d/optout. 
 >> >> 
 >> >> 
 >> >> 
 >> >> -- 
 >> >> 
 >> >> Cordialement, Coues Ludovic 
 >> >> +336 148 743 42 
 >> > 
 >> > -- 
 >> > You received this message because you 

Re: Django Ticketing Application

2016-09-12 Thread Jonathan Adcock
You could try https://djangopackages.org/

On Monday, September 12, 2016 at 12:18:38 PM UTC+1, Alexandra wrote:
>
> Hi, could you please suggest other forums where I can find this 
> information?
> Thank you 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/744da0aa-fce5-45bc-b0e9-a12621e14a12%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Ticketing Application

2016-09-12 Thread Sergiy Khohlov
 Hello Alexandra,
 Have have no answer due to no question. You have decided to do
application. It is good , but you have not informed us about steps which
are done. In tho case nobody can help you. I was thinking that this a adv
email for popularizing you commercial chat client.  No more.


Many thanks,

Serge


+380 636150445
skype: skhohlov

On Mon, Sep 12, 2016 at 4:45 PM, M Hashmi  wrote:

> Hello Alexandra,
>
> You are at the right forum. But chatting as ticket needs some workout.
> Each message needs to be contain with all ticketing properties and upon
> selection of a message it should act as ticket. Now for that simply If you
> can, start with DjangoSocketIO
> at https://djangopackages.org/grids/g/chat/. After you've created and
> integrated in your project then extend this with submodel of Tickets. Then
> in view you can define that if you select a particular message to be
> treated as ticket then how should that particular message behave.
>
> Or you simply can use two packages like DjangoSocketIO and DjangoHelpDesk
> and create a sublayer model that combines feature of both the packages and
> then you iterate the behaviour in your view.
>
> It may look complicated but to keep it simple I hope this will be a good
> start. Craft your app with a visual work process or mockup and then
> everybody will start helping you.
>
> With generic question It will be hard for anyone to help you and yes you
> can treat a chat as ticket.
>
> Looking forward you start working on it so this group can help you create
> it.
> Hope this is helpful.
>
> Regards,
> Mudassar
>
> On Mon, Sep 12, 2016 at 4:18 AM, Alexandra 
> wrote:
>
>> Hi, could you please suggest other forums where I can find this
>> information?
>> Thank you 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/ms
>> gid/django-users/fe028722-d44a-40ff-b26d-d9813268213c%40googlegroups.com
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> 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/CANoUts6zSMSk_bPQg1x%2B3GfEG1YrfauAFTNPbV5UKUjTsmm0
> Hw%40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CADTRxJPYi7GLFY4Ysxj5t0soG6aTnXbvx-%3D94o_dRX3ZjfU%2BwQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Ticketing Application

2016-09-12 Thread M Hashmi
Hello Alexandra,

You are at the right forum. But chatting as ticket needs some workout. Each
message needs to be contain with all ticketing properties and upon
selection of a message it should act as ticket. Now for that simply If you
can, start with DjangoSocketIO
at https://djangopackages.org/grids/g/chat/. After you've created and
integrated in your project then extend this with submodel of Tickets. Then
in view you can define that if you select a particular message to be
treated as ticket then how should that particular message behave.

Or you simply can use two packages like DjangoSocketIO and DjangoHelpDesk
and create a sublayer model that combines feature of both the packages and
then you iterate the behaviour in your view.

It may look complicated but to keep it simple I hope this will be a good
start. Craft your app with a visual work process or mockup and then
everybody will start helping you.

With generic question It will be hard for anyone to help you and yes you
can treat a chat as ticket.

Looking forward you start working on it so this group can help you create
it.
Hope this is helpful.

Regards,
Mudassar

On Mon, Sep 12, 2016 at 4:18 AM, Alexandra 
wrote:

> Hi, could you please suggest other forums where I can find this
> information?
> Thank you 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/fe028722-d44a-40ff-b26d-d9813268213c%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CANoUts6zSMSk_bPQg1x%2B3GfEG1YrfauAFTNPbV5UKUjTsmm0Hw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Regex Validators doesn't validate while working in a shell

2016-09-12 Thread Daniel Roseman
On Monday, 12 September 2016 14:36:23 UTC+1, ashish...@finoit.co.in wrote:
>
> I've configured user's username field in following way
>
> username = models.CharField(
> _('username'),
> max_length=30,
> unique=True,
> help_text=_('Required. 30 characters or fewer. Letters, digits 
> and @/./+/-/_ only.'),
> validators=[
> validators.RegexValidator(
> r'^[\w.+-]+$',
> _('Enter a valid username. This value may contain only '
>   'letters, numbers ' 'and ./+/-/_ characters.')
> ),
> ],
> error_messages={
> 'unique': _("A user with that username already exists."),
> },
> )
>
> I'm getting error in admin panel but not in django-shell.
>
>
> Though django raises an error for maximum length in shell.
>
> Is it a bug? Or am I missing something.
>


This has nothing to do with being in the shell.

Validators aren't run on save, and that is the case everywhere, as noted 
explicitly in the validators 
documentation: 
https://docs.djangoproject.com/en/1.10/ref/validators/#how-validators-are-run
-- 
DR.

-- 
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/9fa63938-11d8-40ca-b3b5-d531aa295c9c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Database is not reset after StaticLiveServerTestCase (Django 1.9.5)

2016-09-12 Thread ankitjavalkar
Hello,

I have a Python project that is using a Selenium script to emulate a user. 
I am running this script within a Django TestCase and I use the 
StaticLiveServerTestCase subclass to run a live Django server in the 
background.

I have also have other Unit Tests.

If I run all the tests together (The Unit Tests along with the Live Server 
Tests) using *python manage.py test*, all the test-cases that run after the 
Selenium/Live Server test case fail. Running the unit tests separately 
shows no failures. It seems that the database is not reset cleanly because 
of which the subsequent test cases cannot get the Django objects that they 
need to test against.

My situation is similar to the one described in this StackOverflow question 
here except for one difference that I face this issue even when I use 
django test runner.
http://stackoverflow.com/questions/32998166/with-py-test-database-is-not-reset-after-liveservertestcase

Is there a solution to this where I can run all the tests at once and also 
cleanly reset the database everytime? Or should I run the selenium test and 
the Unit tests seperately?
(I can show the code [Github] if necessary)

Thanks

-- 
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/80040200-dd30-4e0f-8e33-c06c418e7b13%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


create connection error

2016-09-12 Thread miaoxu99999
def contact(request):
error = []
if request.method == 'POST':
if not request.POST.get('subject', ''):
error.append("please enter a subject")
if not request.POST.get('message',''):
error.append("please enter a message")
if request.POST.get('email') and "@" not in request.POST["email"]:
error.append("Please enter a valid e-mail")
if not error:
# send_mail(request.POST['subject'], request.POST['message'], 
request.POST.get('email', 'mxb...@126.com'), ['2229009...@qq.com'], 
fail_silently=True)
send_mail('subject', 'this is the message of email', 'mxb...@126.com', 
['2229009...@qq.com'], fail_silently=True)
return HttpResponseRedirect('/contact/thanks/')
return render_to_response('contact.html', {'error' : error})


STATIC_URL = '/static/'

EMAIL_POST = 'smtp.126.com'
EMAIL_PORT = 25
EMAIL_HOST_USER = 'mxb...@126.com'
EMAIL_HOST_PASSWORD = ''
EMAIL_SUBJECT_PREFTX = u''
EMAIL_USE_TLS = True

SERVER_EMAIL = '2229009...@qq.com'


error at /contact/

[Errno 10061] 

Request Method: POST
Request URL: http://127.0.0.1:8000/contact/
Django Version: 1.10
Exception Type: error
Exception Value: 

[Errno 10061] 

Exception Location: D:\Python\lib\socket.py in create_connection, line 571
Python Executable: D:\Python\python.exe
Python Version: 2.7.3
Python Path: 

['C:\\Users\\miaoxu\\mysite',
 'D:\\Python\\lib\\site-packages\\django-1.10-py2.7.egg',
 'D:\\Python\\python27.zip',
 'D:\\Python\\DLLs',
 'D:\\Python\\lib',
 'D:\\Python\\lib\\plat-win',
 'D:\\Python\\lib\\lib-tk',
 'D:\\Python',
 'D:\\Python\\lib\\site-packages',
 'D:\\Python\\lib\\site-packages\\PIL',
 'D:\\Python\\lib\\site-packages\\win32',
 'D:\\Python\\lib\\site-packages\\win32\\lib',
 'D:\\Python\\lib\\site-packages\\Pythonwin']

Server time: 星期一, 12 九月 2016 01:46:23 +


-- 
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/789f6303-87f6-4d20-9e1b-16fa8db0e943%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Regex Validators doesn't validate while working in a shell

2016-09-12 Thread ashish . goyal
I've configured user's username field in following way

username = models.CharField(
_('username'),
max_length=30,
unique=True,
help_text=_('Required. 30 characters or fewer. Letters, digits and 
@/./+/-/_ only.'),
validators=[
validators.RegexValidator(
r'^[\w.+-]+$',
_('Enter a valid username. This value may contain only '
  'letters, numbers ' 'and ./+/-/_ characters.')
),
],
error_messages={
'unique': _("A user with that username already exists."),
},
)

I'm getting error in admin panel but not in django-shell.








Though django raises an error for maximum length in shell.

Is it a bug? Or am I missing something.

-- 
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/3bbed56d-091d-492f-bac7-a3175df0e556%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django with digital certificates

2016-09-12 Thread Dimitris Kougioumtzis
I have an application with django framework. The users have in their usb 
sticks their certificates. How to access their certificates from the django 
application to the client computer ; 

-- 
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/023276d3-41d9-4b75-8971-9b3642ace0c7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Ticketing Application

2016-09-12 Thread Alexandra
Hi, could you please suggest other forums where I can find this information?
Thank you 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/fe028722-d44a-40ff-b26d-d9813268213c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Ticketing Application

2016-09-12 Thread Alexandra


On Friday, September 9, 2016 at 7:09:21 PM UTC+8, Alexandra wrote:
>
> Hi! 
> It's necessary to integrate a Chat bot (as Zopim) and Ticketing system in 
> a new app.
> Chatting has to become a ticket. 
> Can you suggest any Django Ticketing App which we can use for it?
> Thank you 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/2a894bdc-f10b-479b-8bf5-7e0324602063%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.