These are chat archives for django/django

Nov 2016
Nov 02 2016 07:08 UTC
Please if someone is online and is fimiliar with django
plzz reply asap
Filip Figiel
Nov 02 2016 10:16 UTC
@Prabhjyotgambhir what's up?
Jourdan Rodrigues
Nov 02 2016 12:09 UTC
@Prabhjyotgambhir I'm here, too.
Sherif O.
Nov 02 2016 21:02 UTC
how do i check if a database table is empty then if true do some other operations
Jourdan Rodrigues
Nov 02 2016 21:10 UTC
Tables are represented by Models.
if not ModelName.objects.exists(): do_something();
Sherif O.
Nov 02 2016 21:12 UTC
thanks… but could i do something like this?
def form(request):
  form = RefGenForm(request.POST or None)
    temp = RefGen.objects.filter(ref_number__isnull=False).latest('ref_number')
    if form.is_valid():
      RefGen.ref_number = temp + 1
  except RefGen.DoesNotExist:
    if form.is_valid():

  return render(request, 'cusrefgen/index.html', {'form': form})
Sherif O.
Nov 02 2016 21:18 UTC
@jourdanrodrigues thanks for the assistance.